|
@ -11,10 +11,7 @@ import awesome.group.game.dao.mapper.MatrixUserMapper; |
|
|
import awesome.group.game.service.SmsService; |
|
|
import awesome.group.game.service.SmsService; |
|
|
import awesome.group.game.service.UMengService; |
|
|
import awesome.group.game.service.UMengService; |
|
|
import awesome.group.game.service.bo.MatrixAdvRecordSimple; |
|
|
import awesome.group.game.service.bo.MatrixAdvRecordSimple; |
|
|
import awesome.group.game.service.bo.citrus.CashRecord; |
|
|
import awesome.group.game.service.bo.citrus.*; |
|
|
import awesome.group.game.service.bo.citrus.LoginReq; |
|
|
|
|
|
import awesome.group.game.service.bo.citrus.TeamBo; |
|
|
|
|
|
import awesome.group.game.service.bo.citrus.UserBo; |
|
|
|
|
|
import awesome.group.game.service.bo.matrix.AppNormalConfig; |
|
|
import awesome.group.game.service.bo.matrix.AppNormalConfig; |
|
|
import awesome.group.game.service.bo.matrix.UmengConfigBo; |
|
|
import awesome.group.game.service.bo.matrix.UmengConfigBo; |
|
|
import awesome.group.game.service.common.exception.PaganiException; |
|
|
import awesome.group.game.service.common.exception.PaganiException; |
|
@ -62,6 +59,9 @@ public class UserService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private MatrixAdvRecordMapper advRecordMapper; |
|
|
private MatrixAdvRecordMapper advRecordMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WeiXinService weiXinService; |
|
|
|
|
|
|
|
|
public static final int STATUS_WAITING = 0;//等审核
|
|
|
public static final int STATUS_WAITING = 0;//等审核
|
|
|
|
|
|
|
|
|
public static final int STATUS_AUDIT_PASS = 1;//已审核通过
|
|
|
public static final int STATUS_AUDIT_PASS = 1;//已审核通过
|
|
@ -130,6 +130,36 @@ public class UserService { |
|
|
return user; |
|
|
return user; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public MatrixUser loginByWechat(String appCode, String accessToken, String openId, String inviteCode) { |
|
|
|
|
|
Assert.isTrue(StringUtils.hasText(appCode), "非法请求"); |
|
|
|
|
|
Assert.isTrue(StringUtils.hasText(accessToken), "非法请求"); |
|
|
|
|
|
Assert.isTrue(StringUtils.hasText(openId), "非法请求"); |
|
|
|
|
|
MatrixApp app = appMapper.queryByCode(appCode); |
|
|
|
|
|
Assert.isTrue(app != null, "非法请求"); |
|
|
|
|
|
WxUserInfo info = weiXinService.getWxUserInfo(accessToken, openId); |
|
|
|
|
|
MatrixUser user = userMapper.selectByAppIdAndOpenId(app.getId(), info.openid); |
|
|
|
|
|
if (user != null && user.getStatus() == Constants.USER_BANNED) { |
|
|
|
|
|
throw new PaganiException(PaganiExceptionCode.GENERAL_ERROR, "账号异常,无法登录"); |
|
|
|
|
|
} |
|
|
|
|
|
MatrixUser upUser = null; |
|
|
|
|
|
if (StringUtils.hasText(inviteCode)) { |
|
|
|
|
|
upUser = userMapper.selectByInviteCode(inviteCode); |
|
|
|
|
|
} |
|
|
|
|
|
if (user == null) { |
|
|
|
|
|
user = new MatrixUser(); |
|
|
|
|
|
user.setAppId(app.getId()); |
|
|
|
|
|
user.setWxOpenId(info.openid); |
|
|
|
|
|
user.setNickname(info.nickname); |
|
|
|
|
|
user.setAvatar(info.headimgurl); |
|
|
|
|
|
user.setUpUid(upUser == null ? null : upUser.getId()); |
|
|
|
|
|
user.setInviteCode(RandomStringUtils.randomAlphabetic(12)); |
|
|
|
|
|
userMapper.insert(user); |
|
|
|
|
|
} else { |
|
|
|
|
|
userMapper.updateWx(info.openid, info.nickname, info.headimgurl, user.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
return user; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public UserBo getUser(Integer uid) { |
|
|
public UserBo getUser(Integer uid) { |
|
|
MatrixUser u = userMapper.selectById(uid); |
|
|
MatrixUser u = userMapper.selectById(uid); |
|
|
MatrixApp app = new MatrixApp(); |
|
|
MatrixApp app = new MatrixApp(); |
|
|