瀏覽代碼

Merge branch 'dev/2024/0529/update-app-Y' of feifan/mall-backend-app into master

修改注册
Yangzw 10 月之前
父節點
當前提交
0c0edb92ef

+ 1 - 1
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/controller/app/auth/AppAuthController.java

@@ -99,7 +99,7 @@ public class AppAuthController {
     }
 
     @PostMapping("/social-login-validate-sms-code")
-    @Operation(summary = "社交快捷登录-校验手机验证码")
+    @Operation(summary = "社交快捷注册-校验手机验证码")
     public CommonResult<AppAuthLoginRespVO> socialLoginValidateSmsCode(@RequestBody @Validated SocialLoginValidateSmsCodeReqVO requestVO) {
         authService.validateSmsCode(getLoginUserId(), requestVO.getReqVO());
         return success(authService.socialRegister(requestVO.getRegisterReqVO(), requestVO.getReqVO().getMobile(), false, true));

+ 3 - 0
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/service/auth/MemberAuthServiceImpl.java

@@ -121,6 +121,9 @@ public class MemberAuthServiceImpl implements MemberAuthService {
             throw exception(AUTH_USERNAME_EXISTS);
         }
 
+        //校验手机号注册是否达到上限
+        verifyMobileIsMaximize(phone);
+
         //微信能绑定的账号上限校验
         if(socialUserApi.wxBindIsMax(socialUser.getId())){
             throw exception(AUTH_SOCIAL_USER_BIND_MAX);

+ 1 - 0
feifan-module-system/feifan-module-system-api/src/main/java/cn/newfeifan/mall/module/system/enums/ErrorCodeConstants.java

@@ -176,5 +176,6 @@ public interface ErrorCodeConstants {
     ErrorCode WECHAT_MSG_TEMPLATE_REDIS_NOT_EXISTS = new ErrorCode(1_002_028_002, "我想消息模板缓存异常");
     ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1_002_028_003, "系统配置不存在");
     ErrorCode CONFIG_REDIS_NOT_EXISTS = new ErrorCode(1_002_028_004, "系统配置不存在");
+    ErrorCode AUTH_SOCIAL_USER_BIND_MAX = new ErrorCode(1_004_012_004, "此微信号已经到达绑定的上限了");
 
 }

+ 11 - 0
feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/social/SocialUserServiceImpl.java

@@ -6,6 +6,7 @@ import cn.newfeifan.mall.framework.common.exception.ServiceException;
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.common.util.json.JsonUtils;
 import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.newfeifan.mall.module.system.api.social.SocialUserApi;
 import cn.newfeifan.mall.module.system.api.social.dto.SocialUserBindReqDTO;
 import cn.newfeifan.mall.module.system.api.social.dto.SocialUserRespDTO;
 import cn.newfeifan.mall.module.system.controller.admin.socail.vo.user.SocialUserPageReqVO;
@@ -17,6 +18,7 @@ import cn.newfeifan.mall.module.system.enums.social.SocialTypeEnum;
 import com.alibaba.fastjson.JSONObject;
 import com.xingyuv.jushauth.model.AuthUser;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -55,6 +57,10 @@ public class SocialUserServiceImpl implements SocialUserService {
     @Resource
     private StringRedisTemplate stringRedisTemplate;
 
+    @Resource
+    @Lazy
+    private SocialUserApi socialUserApi;
+
     @Override
     public List<SocialUserDO> getSocialUserList(Long userId, Integer userType) {
         // 获得绑定
@@ -74,6 +80,11 @@ public class SocialUserServiceImpl implements SocialUserService {
                 reqDTO.getCode(), reqDTO.getState());
         Assert.notNull(socialUser, "社交用户不能为空");
 
+        //微信能绑定的账号上限校验
+        if(socialUserApi.wxBindIsMax(socialUser.getId())){
+            throw exception(AUTH_SOCIAL_USER_BIND_MAX);
+        }
+
         // 社交用户可能之前绑定过别的用户,需要进行解绑
 //        socialUserBindMapper.deleteByUserTypeAndSocialUserId(reqDTO.getUserType(), socialUser.getId());