|
@@ -11,6 +11,7 @@ import com.zanxiang.game.module.manage.service.IPushMsgStrategyService;
|
|
import com.zanxiang.game.module.mybatis.entity.PushMsgSendResult;
|
|
import com.zanxiang.game.module.mybatis.entity.PushMsgSendResult;
|
|
import com.zanxiang.game.module.mybatis.entity.PushMsgStrategy;
|
|
import com.zanxiang.game.module.mybatis.entity.PushMsgStrategy;
|
|
import com.zanxiang.module.redis.service.IDistributedLockComponent;
|
|
import com.zanxiang.module.redis.service.IDistributedLockComponent;
|
|
|
|
+import com.zanxiang.module.util.JsonUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -20,6 +21,7 @@ import java.time.Duration;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
|
|
+import java.util.Objects;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -62,15 +64,24 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
|
|
@Async
|
|
@Async
|
|
@Override
|
|
@Override
|
|
public void pushMsgByLevelUpdate(PushMsgParam param) {
|
|
public void pushMsgByLevelUpdate(PushMsgParam param) {
|
|
|
|
+ if (Objects.equals(param.getRoleId(), "834271457244980635")) {
|
|
|
|
+ log.error("接收到消息 , param : {}", JsonUtil.toString(param));
|
|
|
|
+ }
|
|
//等级变更, 过滤战力变化, 1小时执行一次
|
|
//等级变更, 过滤战力变化, 1小时执行一次
|
|
String lock = RedisKeyConstant.GAME_USER_ROLE_UP_LOCK + param.getUserId() + "_" + param.getGameId() + "_"
|
|
String lock = RedisKeyConstant.GAME_USER_ROLE_UP_LOCK + param.getUserId() + "_" + param.getGameId() + "_"
|
|
+ param.getServerId() + "_" + param.getRoleId();
|
|
+ param.getServerId() + "_" + param.getRoleId();
|
|
if (!distributedLockComponent.doLock(lock, 0L, 10L, TimeUnit.MINUTES)) {
|
|
if (!distributedLockComponent.doLock(lock, 0L, 10L, TimeUnit.MINUTES)) {
|
|
|
|
+ if (Objects.equals(param.getRoleId(), "834271457244980635")) {
|
|
|
|
+ log.error("接收到消息, 触发锁不执行 , param : {}", JsonUtil.toString(param));
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
//全局策略控制是否限制
|
|
//全局策略控制是否限制
|
|
if (this.defaultStrategyCheck(param)) {
|
|
if (this.defaultStrategyCheck(param)) {
|
|
|
|
+ if (Objects.equals(param.getRoleId(), "834271457244980635")) {
|
|
|
|
+ log.error("接收到消息, 全局策略判断 , param : {}", JsonUtil.toString(param));
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
//查询等级策略
|
|
//查询等级策略
|
|
@@ -82,6 +93,7 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
|
|
.orderByDesc(PushMsgStrategy::getCreateTime)
|
|
.orderByDesc(PushMsgStrategy::getCreateTime)
|
|
.last("limit 1"));
|
|
.last("limit 1"));
|
|
if (pushMsgStrategy == null) {
|
|
if (pushMsgStrategy == null) {
|
|
|
|
+ log.error("等级策略匹配为空, 不执行策略");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
pushMsgStrategyService.strategyPushMsgRun(pushMsgStrategy, param);
|
|
pushMsgStrategyService.strategyPushMsgRun(pushMsgStrategy, param);
|