展示/绑定关系

This commit is contained in:
wangw 2025-10-29 16:25:57 +08:00
parent 9794dbaa05
commit 911ca038ae
1 changed files with 9 additions and 1 deletions

View File

@ -260,6 +260,14 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
if (parent.getStatus() == 9) {
throw new CzgException("绑定失败该邀请人分销身份已被取消");
}
ShopUser parentShopUser = shopUserService.getById(parent.getId());
AssertUtil.isNull(parentShopUser, "邀请人不存在");
if (parentShopUser.getDistributionUserId() != null && parentShopUser.getDistributionUserId().equals(shopUser.getId())) {
throw new CzgException("存在绑定关系,不可绑定");
}
if (parentShopUser.getDistributionUserParentId() != null && parentShopUser.getDistributionUserParentId().equals(shopUser.getId())) {
throw new CzgException("存在绑定关系,不可绑定");
}
ShopUser newShopUser = new ShopUser();
newShopUser.setId(shopUser.getId());
newShopUser.setDistributionUserId(parent.getId());
@ -284,7 +292,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
}
MkDistributionLevelConfig levelConfig = levelConfigService.getOne(QueryWrapper.create()
.eq(MkDistributionLevelConfig::getShopId, parent.getShopId())
.le(MkDistributionLevelConfig::getInviteCount, parent.getInviteCount())
.le(MkDistributionLevelConfig::getInviteCount, newDistributionUser.getInviteCount())
.gt(MkDistributionLevelConfig::getId, parent.getDistributionLevelId())
.orderBy(MkDistributionLevelConfig::getId).asc().limit(1));
if (levelConfig != null) {