加入会员修改

This commit is contained in:
张松
2025-03-11 17:57:24 +08:00
parent 19c93f89b0
commit c45a8535e2

View File

@@ -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);
}