release: 1.1 根据邀请码获取用户部分信息

release-2024-04-25
huangyw 1 month ago
parent dc05223d61
commit 46e7cf56f8

@ -38,6 +38,7 @@ public class ErrorConstants {
public final static String USER_ALREADY_EXISTS_ARTIST = "用户已发起过音乐人审核";
public final static String USER_STATUS_ERROR = "用户状态错误";
public final static String USER_NAME_ALREADY_EXISTS = "用户名已存在";
public final static String USER_INVITE_CODE_NOT_EXIST = "邀请码不存在";
// 会员部分
public static final String MEMBERSHIP_CODE_NOT_EXISTS = "会员码不存在";

@ -18,8 +18,10 @@ import com.luoo.user.pojo.*;
import com.luoo.user.service.*;
import com.luoo.user.util.EmojiConverterUtil;
import com.luoo.user.util.IpUtil;
import com.luoo.user.vo.userinfo.UserInfoForInviteVO;
import com.luoo.user.vo.userinfo.UserinfoShippingAddressAppVO;
import constants.Constants;
import constants.ErrorConstants;
import constants.TaskPointIdConstants;
import controller.BaseController;
import dto.UserLoginDto;
@ -132,6 +134,17 @@ public class MyController extends BaseController {
return Result.success(userRespDTO);
}
@ApiOperation(value = "1.1 根据邀请码获取用户部分信息", notes = "无认证")
@GetMapping("/userInfo/invite")
public Result<UserInfoForInviteVO> getUserInfoForInvite(String inviteCode) {
UserInfo userInfoByInvitationCode = userInfoService.getUserInfoByInvitationCode(inviteCode);
if(userInfoByInvitationCode != null) {
return Result.success(new UserInfoForInviteVO(userInfoByInvitationCode.getNickName(), userInfoByInvitationCode.getAvatar(), inviteCode));
} else {
return Result.failed(ErrorConstants.USER_INVITE_CODE_NOT_EXIST);
}
}
@ApiOperation(value = "2.更新个人信息", notes = "游客无法编辑个人信息")
@PutMapping("/userInfo")
@GlobalInterceptor(checkAppUserLogin = true)

@ -269,7 +269,7 @@ public class UserInfoService {
userInfoDao.save(userInfo);
String token = Constants.TOKEN_PREFIX
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
if(isNewUser) {
if (isNewUser) {
// 只有新用户会获得积分
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
}
@ -343,7 +343,7 @@ public class UserInfoService {
String token = Constants.TOKEN_PREFIX
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
if(isNewUser) {
if (isNewUser) {
// 只有新用户会获得积分
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
}
@ -383,7 +383,7 @@ public class UserInfoService {
userInfoDao.save(userInfo);
String token = Constants.TOKEN_PREFIX
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
if(isNewUser) {
if (isNewUser) {
// 只有新用户会获得积分
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
}
@ -469,7 +469,7 @@ public class UserInfoService {
userInfoDao.save(userInfo);
String token = Constants.TOKEN_PREFIX
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
if(isNewUser) {
if (isNewUser) {
// 只有新用户会获得积分
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, token);
}
@ -820,7 +820,7 @@ public class UserInfoService {
long totalElements = withdrawPage.getTotalElements();
List<Withdraw> content = withdrawPage.getContent();
for (Withdraw withdraw : content) {
if(withdraw.getState() != null) {
if (withdraw.getState() != null) {
withdraw.setStateStr(Objects.requireNonNull(WithdrawStateEnum.getByCode(withdraw.getState())).getDesc());
}
}
@ -853,11 +853,11 @@ public class UserInfoService {
if (o == null) {
throw new BizException("二维码失效!");
}
if(!String.valueOf(o).equals("0") && !String.valueOf(o).equals("1")) {
if (!String.valueOf(o).equals("0") && !String.valueOf(o).equals("1")) {
throw new BizException("登录认证已完成");
}
if(type == 1) {
if (type == 1) {
// 扫码
redisTemplate.opsForValue().set(token, 1, 60, TimeUnit.SECONDS);
} else {
@ -884,7 +884,7 @@ public class UserInfoService {
public String createInvitationCode(String token) {
UserLoginDto user = jwtUtil.getUserLoginDto(token);
UserInfo byId = userInfoDao.getById(user.getUserId());
if(StringUtils.isNotBlank(byId.getInvitationCode())) {
if (StringUtils.isNotBlank(byId.getInvitationCode())) {
return byId.getInvitationCode();
}
@ -907,4 +907,14 @@ public class UserInfoService {
public List<UserInfo> getExpireVipList() {
return userInfoDao.getExpireVipList();
}
/**
*
*
* @param invitationCode
* @return
*/
public UserInfo getUserInfoByInvitationCode(String invitationCode) {
return userInfoDao.findByInvitationCode(invitationCode);
}
}

@ -0,0 +1,31 @@
package com.luoo.user.vo.userinfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @program: luoo_parent
* @description: h5
* @author: yawei.huang
* @create: 2024-10-10 08:14
**/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserInfoForInviteVO implements Serializable {
private static final long serialVersionUID = -3383281434773850094L;
@ApiModelProperty(value = "用户昵称")
private String nickName;
@ApiModelProperty(value = "用户头像")
private String avatar;
@ApiModelProperty(value = "邀请码")
private String inviteCode;
}
Loading…
Cancel
Save