Browse Source

注销账号,修改名称和头像

liujc 1 month ago
parent
commit
eda0e40611

+ 1 - 0
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/dal/dao/SysUserDao.java

@@ -188,4 +188,5 @@ public interface SysUserDao extends BaseDAO<Long, SysUser> {
 
     SysUser getCustomerServiceByFriendLeast();
 
+    void updateNameAndImg(@Param("userId") Long userId);
 }

+ 4 - 0
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/service/impl/SysUserServiceImpl.java

@@ -441,6 +441,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
             log.error("logoffByPhone check error", e);
             throw new BizException("数据检查失败");
         }
+        SysUser sysUser = sysUserDao.queryByPhone(phone);
         int num = sysUserDao.countByPhone(phone);
         //冻结相关所有客户端账号
         sysUserDao.updateLockStatusByPhone(phone);
@@ -449,6 +450,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
         if(i < 1){
             throw new BizException("用户不存在或已注销");
         }
+
+        // 修改名称 和头像
+        sysUserDao.updateNameAndImg(sysUser.getId());
         // 解散群、退群、删除好友关系
         adminFeignService.logoffQuitImGroup(phone);
 

+ 5 - 0
cooleshow-auth/auth-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -405,4 +405,9 @@
               limit 1) t
                  left join sys_user m on m.id_ = t.user_id_
     </select>
+
+    <update id="updateNameAndImg">
+        update sys_user set bak_username_ = username_,username_ = concat('账号已注销',id_)
+                          ,avatar_ = (select param_value_ from sys_config where param_name_ = 'logoff_img') where id_= #{userId};
+    </update>
 </mapper>

+ 1 - 0
cooleshow-common/src/main/java/com/yonge/cooleshow/common/constant/SysConfigConstant.java

@@ -478,4 +478,5 @@ public interface SysConfigConstant {
      */
     String TENANT_ALBUM_MUSIC_TYPE_CATEGORY = "tenant_album_music_type_category";
     String COURSE_SUBJECT_MAP = "course_subject_map";
+    String LOGOFF_IMG = "logoff_img";
 }