|
@@ -33,32 +33,36 @@ public class RoleOperateServiceImpl extends ServiceImpl<RoleOperateMapper, RoleO
|
|
|
|
|
|
@Override
|
|
|
public void systemRoleOperate(GameUserRole gameUserRole) {
|
|
|
- //查询玩家信息
|
|
|
- User user = userService.getById(gameUserRole.getUserId());
|
|
|
- //解析玩家渠道信息
|
|
|
- Map<String, String> channelMap = agentService.channelTransform(user.getChannel());
|
|
|
- if (!channelMap.containsKey("corpId") || !channelMap.containsKey("corpUserId")
|
|
|
- || !channelMap.containsKey("externalUserId")) {
|
|
|
- log.error("创角事件 : 非企微链路, 不做操作! gameId : {}, roleId : {}", gameUserRole.getGameId(), gameUserRole.getRoleId());
|
|
|
- return;
|
|
|
+ try {
|
|
|
+ //查询玩家信息
|
|
|
+ User user = userService.getById(gameUserRole.getUserId());
|
|
|
+ //解析玩家渠道信息
|
|
|
+ Map<String, String> channelMap = agentService.channelTransform(user.getChannel());
|
|
|
+ if (!channelMap.containsKey("corpId") || !channelMap.containsKey("corpUserId")
|
|
|
+ || !channelMap.containsKey("externalUserId")) {
|
|
|
+ log.error("创角非企微链路, 不做操作! gameId : {}, roleId : {}", gameUserRole.getGameId(), gameUserRole.getRoleId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //查询操作记录
|
|
|
+ RoleOperate roleOperate = super.getOne(new LambdaQueryWrapper<RoleOperate>()
|
|
|
+ .eq(RoleOperate::getGameId, gameUserRole.getGameId())
|
|
|
+ .eq(RoleOperate::getServerId, gameUserRole.getServerId())
|
|
|
+ .eq(RoleOperate::getUserId, gameUserRole.getUserId())
|
|
|
+ .eq(RoleOperate::getRoleId, gameUserRole.getRoleId()));
|
|
|
+ if (roleOperate == null) {
|
|
|
+ roleOperate = this.transform(gameUserRole, channelMap);
|
|
|
+ } else {
|
|
|
+ roleOperate.setCorpId(channelMap.get("corpId"));
|
|
|
+ roleOperate.setExternalUserId(channelMap.get("externalUserId"));
|
|
|
+ roleOperate.setAddCorpUserId(channelMap.get("corpUserId"));
|
|
|
+ roleOperate.setIsAddCorpWechat(1);
|
|
|
+ roleOperate.setUpdateBy(RoleOperate.SYSTEM_OPERATE);
|
|
|
+ roleOperate.setUpdateTime(LocalDateTime.now());
|
|
|
+ }
|
|
|
+ super.saveOrUpdate(roleOperate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("创角添加记录异常! gameId : {}, roleId : {}", gameUserRole.getGameId(), gameUserRole.getRoleId());
|
|
|
}
|
|
|
- //查询操作记录
|
|
|
- RoleOperate roleOperate = super.getOne(new LambdaQueryWrapper<RoleOperate>()
|
|
|
- .eq(RoleOperate::getGameId, gameUserRole.getGameId())
|
|
|
- .eq(RoleOperate::getServerId, gameUserRole.getServerId())
|
|
|
- .eq(RoleOperate::getUserId, gameUserRole.getUserId())
|
|
|
- .eq(RoleOperate::getRoleId, gameUserRole.getRoleId()));
|
|
|
- if (roleOperate == null) {
|
|
|
- roleOperate = this.transform(gameUserRole, channelMap);
|
|
|
- } else {
|
|
|
- roleOperate.setCorpId(channelMap.get("corpId"));
|
|
|
- roleOperate.setExternalUserId(channelMap.get("externalUserId"));
|
|
|
- roleOperate.setAddCorpUserId(channelMap.get("corpUserId"));
|
|
|
- roleOperate.setIsAddCorpWechat(1);
|
|
|
- roleOperate.setUpdateBy(RoleOperate.SYSTEM_OPERATE);
|
|
|
- roleOperate.setUpdateTime(LocalDateTime.now());
|
|
|
- }
|
|
|
- super.saveOrUpdate(roleOperate);
|
|
|
}
|
|
|
|
|
|
private RoleOperate transform(GameUserRole gameUserRole, Map<String, String> channelMap) {
|