Răsfoiți Sursa

修改发送微信消息及同手机号多绑定

Yangzw 5 luni în urmă
părinte
comite
eda57ca2b3

+ 3 - 0
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/dal/mysql/user/MemberUserMapper.java

@@ -95,4 +95,7 @@ public interface MemberUserMapper extends BaseMapperX<MemberUserDO> {
         return update(null, lambdaUpdateWrapper);
     }
 
+    default List<MemberUserDO> selectListByMobile(String mobile){
+        return selectList(MemberUserDO::getMobile,mobile);
+    }
 }

+ 8 - 6
feifan-module-member/feifan-module-member-biz/src/main/java/cn/newfeifan/mall/module/member/service/user/MemberUserServiceImpl.java

@@ -237,7 +237,7 @@ public class MemberUserServiceImpl implements MemberUserService {
         // 校验存在
         validateUserExists(updateReqVO.getId());
         // 校验手机唯一
-        validateMobileUnique(updateReqVO.getId(), updateReqVO.getMobile());
+//        validateMobileUnique(updateReqVO.getId(), updateReqVO.getMobile());
 
         // 更新
         MemberUserDO updateObj = MemberUserConvert.INSTANCE.convert(updateReqVO);
@@ -321,14 +321,16 @@ public class MemberUserServiceImpl implements MemberUserService {
 
     @Override
     public void updateUserByMobile(Long systemUserId, String mobile) {
-        if(StrUtil.isEmpty(mobile)){
+        if (StrUtil.isEmpty(mobile)) {
             return;
         }
 
-        MemberUserDO memberUserDO = memberUserMapper.selectByMobile(mobile);
-        if(memberUserDO!=null){
-            memberUserDO.setSystemUsersId(systemUserId);
-            memberUserMapper.updateById(memberUserDO);
+        List<MemberUserDO> memberUserDOS = memberUserMapper.selectListByMobile(mobile);
+        if (!memberUserDOS.isEmpty()) {
+            for (MemberUserDO memberUserDO : memberUserDOS) {
+                memberUserDO.setSystemUsersId(systemUserId);
+                memberUserMapper.updateById(memberUserDO);
+            }
         }
     }