加入会员修改
This commit is contained in:
@@ -252,15 +252,18 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
userInfoService.updateById(userInfo);
|
||||
|
||||
ShopUser shopUser = getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
|
||||
if (shopUser != null && shopUser.getIsVip() == 1) {
|
||||
if (shopUser == null) {
|
||||
shopUser = new ShopUser();
|
||||
shopUser.setShopId(shopId);
|
||||
shopUser.setUserId(userId);
|
||||
} else if (shopUser.getIsVip() == 1) {
|
||||
throw new ApiNotPrintException("您已加入店铺会员");
|
||||
}
|
||||
shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);
|
||||
shopUser.setIsVip(1);
|
||||
shopUser.setCode(generateCode(shopId));
|
||||
shopUser.setJoinTime(DateUtil.date().toLocalDateTime());
|
||||
shopUser.setShopId(shopId);
|
||||
shopUser.setUserId(userId);
|
||||
|
||||
return saveOrUpdate(shopUser);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user