|
|
@ -7,6 +7,7 @@ import com.luoo.user.dao.UserInfoDao;
|
|
|
|
import com.luoo.user.dao.UserPointLogDao;
|
|
|
|
import com.luoo.user.dao.UserPointLogDao;
|
|
|
|
import com.luoo.user.dao.UserRealNameDao;
|
|
|
|
import com.luoo.user.dao.UserRealNameDao;
|
|
|
|
import com.luoo.user.dao.WithdrawDao;
|
|
|
|
import com.luoo.user.dao.WithdrawDao;
|
|
|
|
|
|
|
|
import com.luoo.user.dto.UserInfoUpdateDto;
|
|
|
|
import com.luoo.user.dto.UserQueryReq;
|
|
|
|
import com.luoo.user.dto.UserQueryReq;
|
|
|
|
import com.luoo.user.dto.UserRealNameCheckDto;
|
|
|
|
import com.luoo.user.dto.UserRealNameCheckDto;
|
|
|
|
import com.luoo.user.dto.UserRealNameFormDto;
|
|
|
|
import com.luoo.user.dto.UserRealNameFormDto;
|
|
|
@ -270,17 +271,30 @@ public class UserInfoService {
|
|
|
|
if(isNewUser) {
|
|
|
|
if(isNewUser) {
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
// 只有新用户会获得积分
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, userInfo.getId());
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_WELCOME_AWARD, userInfo.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(loginReq.getInvitationCode())) {
|
|
|
|
return Constants.TOKEN_PREFIX
|
|
|
|
// 新用户,且存在邀请码
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
UserInfo userInfoDaoByInvitationCode = userInfoDao.findByInvitationCode(loginReq.getInvitationCode());
|
|
|
|
}
|
|
|
|
if(null != userInfoDaoByInvitationCode) {
|
|
|
|
|
|
|
|
userInfo.setInvitationUserId(userInfoDaoByInvitationCode.getId());
|
|
|
|
|
|
|
|
userInfo.setInvitationCode(userInfoDaoByInvitationCode.getInvitationCode());
|
|
|
|
|
|
|
|
userInfoDao.save(userInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 邀请码有效,且新用户,则给邀请人积分
|
|
|
|
/**
|
|
|
|
userPointLogService.addByTaskNew(TaskPointIdConstants.NEW_USER_INVITE, userInfoDaoByInvitationCode.getId());
|
|
|
|
* 绑定邀请人
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param userInfo 用户
|
|
|
|
|
|
|
|
* @param invitationCode 邀请码
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
|
|
public void bindInvitationCode(UserInfo userInfo, String invitationCode) {
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(invitationCode)) {
|
|
|
|
|
|
|
|
UserInfo userInfoDaoByInvitationCode = userInfoDao.findByInvitationCode(invitationCode);
|
|
|
|
|
|
|
|
if (null != userInfoDaoByInvitationCode) {
|
|
|
|
|
|
|
|
// 设置邀请人
|
|
|
|
|
|
|
|
userInfo.setInvitationUserId(userInfoDaoByInvitationCode.getId());
|
|
|
|
|
|
|
|
this.update(userInfo);
|
|
|
|
|
|
|
|
// 邀请人与被邀请人同时获取积分
|
|
|
|
|
|
|
|
userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.NEW_USER_INVITE, userInfoDaoByInvitationCode.getId());
|
|
|
|
|
|
|
|
userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.NEW_USER_INVITE, userInfo.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<UserPointLog> list = userPointLogDao.findUserPointLogsByUserIdAndTaskPointId(userInfoDaoByInvitationCode.getId(), TaskPointIdConstants.NEW_USER_INVITE);
|
|
|
|
List<UserPointLog> list = userPointLogDao.findUserPointLogsByUserIdAndTaskPointId(userInfoDaoByInvitationCode.getId(), TaskPointIdConstants.NEW_USER_INVITE);
|
|
|
|
if (list.size() == 3) {
|
|
|
|
if (list.size() == 3) {
|
|
|
@ -292,12 +306,8 @@ public class UserInfoService {
|
|
|
|
} else if (list.size() == 20) {
|
|
|
|
} else if (list.size() == 20) {
|
|
|
|
userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_20, userInfoDaoByInvitationCode.getId());
|
|
|
|
userPointLogService.addByTaskDailyAndUserId(TaskPointIdConstants.INVITE_USER_20, userInfoDaoByInvitationCode.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Constants.TOKEN_PREFIX
|
|
|
|
}
|
|
|
|
+ jwtUtil.createJWT(userInfo.getId(), userInfo.getNickName(), Constants.TOKEN_ROLE_APP_USER, userInfo.getAvatar());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String loginOrRegister(UserInfo loginUserInfo) {
|
|
|
|
public String loginOrRegister(UserInfo loginUserInfo) {
|
|
|
|