diff --git a/luoo_common/src/main/java/constants/TaskPointIdConstants.java b/luoo_common/src/main/java/constants/TaskPointIdConstants.java index aa69beb..810275c 100644 --- a/luoo_common/src/main/java/constants/TaskPointIdConstants.java +++ b/luoo_common/src/main/java/constants/TaskPointIdConstants.java @@ -12,14 +12,8 @@ public class TaskPointIdConstants { public static final String NEW_USER_WELCOME_AWARD = "1"; // 修改头像 public static final String MODIFY_AVATAR = "2"; - // 修改昵称 - public static final String MODIFY_NICKNAME = "3"; - // 修改签名 - public static final String MODIFY_SIGNATURE = "4"; - // 完善生日 - public static final String MODIFY_BIRTHDAY = "5"; - // 完善性别 - public static final String MODIFY_SEX = "6"; + // 修改个人信息 + public static final String MODIFY_INFORMATION = "3"; // 开通会员 public static final String BUY_MEMBER = "7"; // 成功关注1位用户 diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java index 3466952..f51cd3c 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java @@ -151,17 +151,14 @@ public class MyController extends BaseController { } } - // 修改了昵称 - boolean isChangeNickName = !Objects.equals(nickName, user.getNickName()); - - // 修改了签名 - boolean isChangeSignature = !Objects.equals(userInfoUpdateDto.getSignature(), user.getSignature()); - - // 修改了生日 - boolean isChangeBirthDay = !Objects.equals(userInfoUpdateDto.getBirthDay(), user.getBirthday()); - - // 修改了性别 - boolean isChangeSex = !Objects.equals(userInfoUpdateDto.getSex(), user.getSex()); + // 信息是否已完善 + if (StringUtils.isNotBlank(userInfoUpdateDto.getBirthDay()) + || StringUtils.isNotBlank(userInfoUpdateDto.getNickName()) + || !Objects.isNull(userInfoUpdateDto.getSex()) + || StringUtils.isNotBlank(userInfoUpdateDto.getBirthDay()) + ) { + userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_INFORMATION, authorization); + } if (StringUtils.isNotBlank(userInfoUpdateDto.getInvitationCode()) && StringUtils.isBlank(user.getInvitationUserId())) { // 只有没有被邀请过的才会触发,再次修改无效 @@ -190,26 +187,6 @@ public class MyController extends BaseController { userInfoService.update(user); List resultList = new ArrayList<>(); - if (isChangeNickName) { - // 修改了昵称 - Integer point = userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_NICKNAME, authorization); - resultList.add("修改了昵称,积分增加" + point + "分"); - } - if (isChangeSignature) { - // 修改了签名 - Integer point = userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_SIGNATURE, authorization); - resultList.add("修改了签名,积分增加" + point + "分"); - } - if (isChangeBirthDay) { - // 修改了生日 - Integer point = userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_BIRTHDAY, authorization); - resultList.add("修改了签名,积分增加" + point + "分"); - } - if (isChangeSex) { - // 修改了性别 - Integer point = userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_SEX, authorization); - resultList.add("修改了签名,积分增加" + point + "分"); - } return Result.success(resultList); } @@ -245,7 +222,7 @@ public class MyController extends BaseController { userInfoService.update(user); rabbitTemplate.convertAndSend("userInfoCommentCache", userLoginDto.getUserId()); - userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_AVATAR, userLoginDto.getUserId()); + userPointLogService.addByTaskNew(TaskPointIdConstants.MODIFY_AVATAR, authorization); return Result.success(Constants.RESOURCE_PREFIX + user.getThumbnail()); } diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java index 87351aa..fbed865 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java @@ -267,14 +267,13 @@ public class UserInfoService { } userInfo.setLastLoginTime(new Date()); userInfoDao.save(userInfo); - + String token = Constants.TOKEN_PREFIX + + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); if(isNewUser) { // 只有新用户会获得积分 - userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, userInfo.getId()); + userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token); } - - return Constants.TOKEN_PREFIX - + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); + return token; } /** @@ -338,14 +337,14 @@ public class UserInfoService { } userInfo.setLastLoginTime(new Date()); userInfoDao.save(userInfo); + String token = Constants.TOKEN_PREFIX + + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); if(isNewUser) { // 只有新用户会获得积分 - userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, userInfo.getId()); + userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token); } - - return Constants.TOKEN_PREFIX - + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); + return token; } public String appleLoginOrRegister(UserInfo loginUserInfo) { @@ -376,13 +375,13 @@ public class UserInfoService { } userInfo.setLastLoginTime(new Date()); userInfoDao.save(userInfo); - + String token = Constants.TOKEN_PREFIX + + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); if(isNewUser) { // 只有新用户会获得积分 - userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, userInfo.getId()); + userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token); } - return Constants.TOKEN_PREFIX - + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); + return token; } // @@ -459,13 +458,13 @@ public class UserInfoService { } userInfo.setLastLoginTime(new Date()); userInfoDao.save(userInfo); - + String token = Constants.TOKEN_PREFIX + + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); if(isNewUser) { // 只有新用户会获得积分 - userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, userInfo.getId()); + userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token); } - return Constants.TOKEN_PREFIX - + jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar()); + return token; }