|
@ -92,7 +92,7 @@ public class UserService { |
|
|
return user; |
|
|
return user; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public MatrixUser loginByToken(String appCode, String token) { |
|
|
public MatrixUser loginByToken(String appCode, String token, String inviteCode) { |
|
|
Assert.isTrue(StringUtils.hasText(appCode), "非法请求"); |
|
|
Assert.isTrue(StringUtils.hasText(appCode), "非法请求"); |
|
|
Assert.isTrue(StringUtils.hasText(token), "非法请求"); |
|
|
Assert.isTrue(StringUtils.hasText(token), "非法请求"); |
|
|
MatrixApp app = appMapper.queryByCode(appCode); |
|
|
MatrixApp app = appMapper.queryByCode(appCode); |
|
@ -101,10 +101,15 @@ public class UserService { |
|
|
UmengConfigBo configBo = gson.fromJson(app.getUmeng(), UmengConfigBo.class); |
|
|
UmengConfigBo configBo = gson.fromJson(app.getUmeng(), UmengConfigBo.class); |
|
|
String mobile = uMengService.getMobile(token, configBo); |
|
|
String mobile = uMengService.getMobile(token, configBo); |
|
|
MatrixUser user = userMapper.selectByAppIdAndMobile(app.getId(), mobile); |
|
|
MatrixUser user = userMapper.selectByAppIdAndMobile(app.getId(), mobile); |
|
|
|
|
|
MatrixUser upUser = null; |
|
|
|
|
|
if (StringUtils.hasText(inviteCode)) { |
|
|
|
|
|
upUser = userMapper.selectByInviteCode(inviteCode); |
|
|
|
|
|
} |
|
|
if (user == null) { |
|
|
if (user == null) { |
|
|
user = new MatrixUser(); |
|
|
user = new MatrixUser(); |
|
|
user.setAppId(app.getId()); |
|
|
user.setAppId(app.getId()); |
|
|
user.setMobile(mobile); |
|
|
user.setMobile(mobile); |
|
|
|
|
|
user.setUpUid(upUser == null ? null : upUser.getId()); |
|
|
user.setInviteCode(RandomStringUtils.randomAlphabetic(12)); |
|
|
user.setInviteCode(RandomStringUtils.randomAlphabetic(12)); |
|
|
userMapper.insert(user); |
|
|
userMapper.insert(user); |
|
|
} |
|
|
} |
|
|