|
@@ -56,8 +56,7 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
Integer dataType = param.getDataType();
|
|
|
//选择服务器
|
|
|
if (Objects.equals(dataType, DataTypeEnum.TYPE_SELECT_SERVER.getDateType())) {
|
|
|
- User user = userService.getById(userData.getUserId());
|
|
|
- return userLoginLogService.createUserLoginLog(user, LoginTypeEnum.LOGIN_IN.getLoginType(), userData.getDeviceType());
|
|
|
+ return userLoginLogService.createRoleLoginLog(userData, param.getRoleId(), param.getRoleName(), LoginTypeEnum.LOGIN_IN.getLoginType());
|
|
|
}
|
|
|
//创建角色
|
|
|
if (Objects.equals(dataType, DataTypeEnum.TYPE_CREATE_ROLE.getDateType())) {
|
|
@@ -92,10 +91,10 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
- private Boolean createRoleUpdate(GameUserRoleUpdateParam param, UserData userData) {
|
|
|
+ private void createRoleUpdate(GameUserRoleUpdateParam param, UserData userData) {
|
|
|
//上锁
|
|
|
if (!distributedLockComponent.doLock(RedisKeyConstant.ROLE_UPDATE_KEY + "_" + userData.getUserId(), 0L, 1L, TimeUnit.MINUTES)) {
|
|
|
- return Boolean.FALSE;
|
|
|
+ return;
|
|
|
}
|
|
|
//查询玩家信息
|
|
|
GameUser gameUser = gameUserService.getOne(new LambdaQueryWrapper<GameUser>().eq(GameUser::getGameId, userData.getGameId())
|
|
@@ -105,7 +104,9 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
.eq(GameUserRole::getGameId, userData.getGameId())
|
|
|
.eq(GameUserRole::getRoleId, param.getRoleId()));
|
|
|
if (userRole != null) {
|
|
|
- return Boolean.TRUE;
|
|
|
+ //释放锁
|
|
|
+ distributedLockComponent.unlock(RedisKeyConstant.ROLE_UPDATE_KEY + "_" + userData.getUserId());
|
|
|
+ return;
|
|
|
}
|
|
|
userRole = GameUserRole.builder()
|
|
|
.userId(userData.getUserId())
|
|
@@ -136,7 +137,5 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
|
.eq(User::getId, gameUser.getUserId()));
|
|
|
//释放锁
|
|
|
distributedLockComponent.unlock(RedisKeyConstant.ROLE_UPDATE_KEY + "_" + userData.getUserId());
|
|
|
- //返回
|
|
|
- return Boolean.TRUE;
|
|
|
}
|
|
|
}
|