|
@@ -69,29 +69,34 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
|
|
|
log.error("消息推送,, 接收到等级更新消息, param : {}", JsonUtil.toString(param));
|
|
|
//等级变更, 过滤战力变化, 1小时执行一次
|
|
|
String lock = RedisKeyConstant.GAME_USER_ROLE_UP_LOCK + param.getUserId() + "_" + param.getGameId() + "_"
|
|
|
- + param.getServerId() + "_" + param.getRoleId() + "_" + param.getRoleLevel();
|
|
|
- if (!distributedLockComponent.doLock(lock, 0L, 1L, TimeUnit.HOURS)) {
|
|
|
+ + param.getServerId() + "_" + param.getRoleId();
|
|
|
+ if (!distributedLockComponent.doLock(lock, 0L, 10L, TimeUnit.MINUTES)) {
|
|
|
log.error("消息推送, 等级变化碰撞线程锁, 消息不执行 param : {}", JsonUtil.toString(param));
|
|
|
return;
|
|
|
}
|
|
|
- //全局策略控制是否限制
|
|
|
- if (this.defaultStrategyCheck(param)) {
|
|
|
- log.error("等级更新消息, 全局策略判断不执行, param : {}", JsonUtil.toString(param));
|
|
|
- return;
|
|
|
- }
|
|
|
- //查询等级策略
|
|
|
- PushMsgStrategy pushMsgStrategy = pushMsgStrategyService.getOne(new LambdaQueryWrapper<PushMsgStrategy>()
|
|
|
- .eq(PushMsgStrategy::getStrategyType, PushMsgStrategyTypeEnum.PUSH_MSG_STRATEGY_LEVEL.getValue())
|
|
|
- .eq(PushMsgStrategy::getGameId, param.getGameId())
|
|
|
- .le(PushMsgStrategy::getRoleLevelMin, param.getRoleLevel())
|
|
|
- .ge(PushMsgStrategy::getRoleLevelMax, param.getRoleLevel())
|
|
|
- .orderByDesc(PushMsgStrategy::getCreateTime)
|
|
|
- .last("limit 1"));
|
|
|
- if (pushMsgStrategy == null) {
|
|
|
- log.error("等级更新消息, 查询策略为空, param : {}", JsonUtil.toString(param));
|
|
|
- return;
|
|
|
+ try {
|
|
|
+ //全局策略控制是否限制
|
|
|
+ if (this.defaultStrategyCheck(param)) {
|
|
|
+ log.error("等级更新消息, 全局策略判断不执行, param : {}", JsonUtil.toString(param));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //查询等级策略
|
|
|
+ PushMsgStrategy pushMsgStrategy = pushMsgStrategyService.getOne(new LambdaQueryWrapper<PushMsgStrategy>()
|
|
|
+ .eq(PushMsgStrategy::getStrategyType, PushMsgStrategyTypeEnum.PUSH_MSG_STRATEGY_LEVEL.getValue())
|
|
|
+ .eq(PushMsgStrategy::getGameId, param.getGameId())
|
|
|
+ .le(PushMsgStrategy::getRoleLevelMin, param.getRoleLevel())
|
|
|
+ .ge(PushMsgStrategy::getRoleLevelMax, param.getRoleLevel())
|
|
|
+ .orderByDesc(PushMsgStrategy::getCreateTime)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (pushMsgStrategy == null) {
|
|
|
+ log.error("等级更新消息, 查询策略为空, param : {}", JsonUtil.toString(param));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ pushMsgStrategyService.strategyPushMsgRun(pushMsgStrategy, param);
|
|
|
+ } catch (Exception ignored) {
|
|
|
+ } finally {
|
|
|
+ distributedLockComponent.unlock(lock);
|
|
|
}
|
|
|
- pushMsgStrategyService.strategyPushMsgRun(pushMsgStrategy, param);
|
|
|
}
|
|
|
|
|
|
private boolean defaultStrategyCheck(PushMsgParam param) {
|