|
@@ -11,7 +11,6 @@ import com.zanxiang.game.module.manage.service.IPushMsgStrategyService;
|
|
|
import com.zanxiang.game.module.mybatis.entity.PushMsgSendResult;
|
|
|
import com.zanxiang.game.module.mybatis.entity.PushMsgStrategy;
|
|
|
import com.zanxiang.module.redis.service.IDistributedLockComponent;
|
|
|
-import com.zanxiang.module.util.JsonUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -44,10 +43,8 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
|
|
|
@Async
|
|
|
@Override
|
|
|
public void pushMsgByRecharge(PushMsgParam param) {
|
|
|
- log.error("消息推送, 接收到充值消息, param : {}", JsonUtil.toString(param));
|
|
|
//全局策略控制是否限制
|
|
|
if (this.defaultStrategyCheck(param)) {
|
|
|
- log.error("充值消息, 全局策略判断不执行, param : {}", JsonUtil.toString(param));
|
|
|
return;
|
|
|
}
|
|
|
//查询充值策略
|
|
@@ -57,7 +54,6 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
|
|
|
.orderByDesc(PushMsgStrategy::getCreateTime)
|
|
|
.last("limit 1"));
|
|
|
if (pushMsgStrategy == null) {
|
|
|
- log.error("充值消息, 查询策略为空, param : {}", JsonUtil.toString(param));
|
|
|
return;
|
|
|
}
|
|
|
pushMsgStrategyService.strategyPushMsgRun(pushMsgStrategy, param);
|
|
@@ -66,18 +62,15 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
|
|
|
@Async
|
|
|
@Override
|
|
|
public void pushMsgByLevelUpdate(PushMsgParam param) {
|
|
|
- log.error("消息推送,, 接收到等级更新消息, param : {}", JsonUtil.toString(param));
|
|
|
//等级变更, 过滤战力变化, 1小时执行一次
|
|
|
String lock = RedisKeyConstant.GAME_USER_ROLE_UP_LOCK + param.getUserId() + "_" + param.getGameId() + "_"
|
|
|
+ param.getServerId() + "_" + param.getRoleId();
|
|
|
if (!distributedLockComponent.doLock(lock, 0L, 10L, TimeUnit.MINUTES)) {
|
|
|
- log.error("消息推送, 等级变化碰撞线程锁, 消息不执行 param : {}", JsonUtil.toString(param));
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
//全局策略控制是否限制
|
|
|
if (this.defaultStrategyCheck(param)) {
|
|
|
- log.error("等级更新消息, 全局策略判断不执行, param : {}", JsonUtil.toString(param));
|
|
|
return;
|
|
|
}
|
|
|
//查询等级策略
|
|
@@ -89,7 +82,6 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
|
|
|
.orderByDesc(PushMsgStrategy::getCreateTime)
|
|
|
.last("limit 1"));
|
|
|
if (pushMsgStrategy == null) {
|
|
|
- log.error("等级更新消息, 查询策略为空, param : {}", JsonUtil.toString(param));
|
|
|
return;
|
|
|
}
|
|
|
pushMsgStrategyService.strategyPushMsgRun(pushMsgStrategy, param);
|
|
@@ -106,6 +98,9 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
|
|
|
.eq(PushMsgStrategy::getGameId, param.getGameId())
|
|
|
.orderByDesc(PushMsgStrategy::getCreateTime)
|
|
|
.last("limit 1"));
|
|
|
+ if (defaultStrategy == null) {
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
//判断今日推送次数是否已限制
|
|
|
if (defaultStrategy.getSendCountMax() != null && pushMsgSendResultService.count(new LambdaQueryWrapper<PushMsgSendResult>()
|
|
|
.eq(PushMsgSendResult::getGameId, param.getGameId())
|