|
@@ -85,20 +85,32 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean appletToH5(Long userId, String mobile) {
|
|
|
+ public Boolean appletToH5(Long userId, String mobile, Integer type) {
|
|
|
|
|
|
User user = super.getById(userId);
|
|
|
if (user == null) {
|
|
|
throw new BaseException("参数错误, 用户信息不存在");
|
|
|
}
|
|
|
+ GameDTO gameDTO;
|
|
|
|
|
|
- GameDTO h5GameDTO = gameService.getById(gameService.getById(user.getGameId()).getH5GameId());
|
|
|
- if (h5GameDTO == null) {
|
|
|
- throw new BaseException("参数错误, 关联H5游戏信息不存在");
|
|
|
+ if (type == 1) {
|
|
|
+ gameDTO = gameService.getById(gameService.getById(user.getGameId()).getH5GameId());
|
|
|
+ } else if (type == 2) {
|
|
|
+
|
|
|
+ gameDTO = gameService.getById(gameService.getById(user.getGameId()).getAndroidGameId());
|
|
|
+ } else if (type == 3) {
|
|
|
+
|
|
|
+ gameDTO = gameService.getById(gameService.getById(user.getGameId()).getIosGameId());
|
|
|
+ } else {
|
|
|
+ throw new BaseException("参数错误, 导量类型不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (gameDTO == null) {
|
|
|
+ throw new BaseException("参数错误, 关联导量游戏信息不存在");
|
|
|
}
|
|
|
|
|
|
int count = super.count(new LambdaQueryWrapper<User>()
|
|
|
- .eq(User::getGameId, h5GameDTO.getId())
|
|
|
+ .eq(User::getGameId, gameDTO.getId())
|
|
|
.eq(User::getMobile, mobile));
|
|
|
if (count > 0) {
|
|
|
throw new BaseException("参数错误, 该手机号已被该游戏其他玩家信息绑定");
|
|
@@ -106,7 +118,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
|
|
|
User h5User = BeanUtil.copy(user, User.class);
|
|
|
h5User.setId(null);
|
|
|
- h5User.setGameId(h5GameDTO.getId());
|
|
|
+ h5User.setGameId(gameDTO.getId());
|
|
|
h5User.setMobile(mobile);
|
|
|
h5User.setRelationUserId(user.getId());
|
|
|
h5User.setRelationCreateTime(LocalDateTime.now());
|