瀏覽代碼

feat : 生产测试01

bilingfeng 10 月之前
父節點
當前提交
6f2edc8fee

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -23,7 +23,7 @@ public class ManageApplication {
 
 
     public static void main(String[] args) {
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 < (消息推送策略, 06・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 < (生产测试01・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 1 - 15
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/rpc/impl/PushMsgRpcImpl.java

@@ -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.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;
@@ -21,7 +20,6 @@ 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;
 
 
 /**
 /**
@@ -64,24 +62,15 @@ 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小时执行一次
         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;
             }
             }
             //查询等级策略
             //查询等级策略
@@ -93,9 +82,6 @@ public class PushMsgRpcImpl implements IPushMsgRpc {
                     .orderByDesc(PushMsgStrategy::getCreateTime)
                     .orderByDesc(PushMsgStrategy::getCreateTime)
                     .last("limit 1"));
                     .last("limit 1"));
             if (pushMsgStrategy == null) {
             if (pushMsgStrategy == null) {
-                if (Objects.equals(param.getRoleId(), "834271457244980635")) {
-                    log.error("等级策略匹配为空, 不执行策略, param : {}", JsonUtil.toString(param));
-                }
                 return;
                 return;
             }
             }
             pushMsgStrategyService.strategyPushMsgRun(pushMsgStrategy, param);
             pushMsgStrategyService.strategyPushMsgRun(pushMsgStrategy, param);

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/PushMsgSendLogServiceImpl.java

@@ -58,7 +58,7 @@ public class PushMsgSendLogServiceImpl extends ServiceImpl<PushMsgSendLogMapper,
         //保存发送记录
         //保存发送记录
         PushMsgSendLog pushMsgSendLog = this.transform(msgId, gameId, strategyId, text, gameUserRoleList.size());
         PushMsgSendLog pushMsgSendLog = this.transform(msgId, gameId, strategyId, text, gameUserRoleList.size());
         super.save(pushMsgSendLog);
         super.save(pushMsgSendLog);
-        log.error("消息推送成功保存日志, gameId : {}, strategyId : {}, text : {}, gameUserRoleList : {}",
+        log.error("消息推保存日志, gameId : {}, strategyId : {}, text : {}, gameUserRoleList : {}",
                 gameId, strategyId, text, JsonUtil.toString(gameUserRoleList));
                 gameId, strategyId, text, JsonUtil.toString(gameUserRoleList));
         //角色信息按区服分组
         //角色信息按区服分组
         Map<String, List<GameUserRole>> serverIdRoleMap = gameUserRoleList.stream()
         Map<String, List<GameUserRole>> serverIdRoleMap = gameUserRoleList.stream()

+ 10 - 9
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/PushMsgStrategyServiceImpl.java

@@ -51,14 +51,6 @@ public class PushMsgStrategyServiceImpl extends ServiceImpl<PushMsgStrategyMappe
 
 
     @Override
     @Override
     public void strategyPushMsgRun(PushMsgStrategy pushMsgStrategy, PushMsgParam param) {
     public void strategyPushMsgRun(PushMsgStrategy pushMsgStrategy, PushMsgParam param) {
-        log.error("消息推送执行策略, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
-        //查询玩家
-        UserDTO userDTO = userService.getById(param.getUserId());
-        //不存在等级策略, 或者玩家为空
-        if (userDTO == null) {
-            log.error("消息推送玩家信息为空, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
-            return;
-        }
         //策略开启测试, 查询是否在测试名单中, 不在测试名单中, 直接结束, 不执行
         //策略开启测试, 查询是否在测试名单中, 不在测试名单中, 直接结束, 不执行
         if (Objects.equals(pushMsgStrategy.getRoleTestSwitch(), Boolean.TRUE)
         if (Objects.equals(pushMsgStrategy.getRoleTestSwitch(), Boolean.TRUE)
                 && pushMsgTestRoleService.count(new LambdaQueryWrapper<PushMsgTestRole>()
                 && pushMsgTestRoleService.count(new LambdaQueryWrapper<PushMsgTestRole>()
@@ -66,7 +58,14 @@ public class PushMsgStrategyServiceImpl extends ServiceImpl<PushMsgStrategyMappe
                 .eq(PushMsgTestRole::getServerId, param.getServerId())
                 .eq(PushMsgTestRole::getServerId, param.getServerId())
                 .eq(PushMsgTestRole::getRoleId, param.getRoleId())
                 .eq(PushMsgTestRole::getRoleId, param.getRoleId())
         ) <= 0) {
         ) <= 0) {
-            log.error("消息推送开启测试无测试人员, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
+            return;
+        }
+        log.error("消息推送执行策略, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
+        //查询玩家
+        UserDTO userDTO = userService.getById(param.getUserId());
+        //不存在等级策略, 或者玩家为空
+        if (userDTO == null) {
+            log.error("消息推送玩家信息为空, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
             return;
             return;
         }
         }
         //判断是否满足策略执行条件
         //判断是否满足策略执行条件
@@ -81,11 +80,13 @@ public class PushMsgStrategyServiceImpl extends ServiceImpl<PushMsgStrategyMappe
                 .eq(GameUserRole::getRoleId, param.getRoleId()));
                 .eq(GameUserRole::getRoleId, param.getRoleId()));
         //查询策略执行文本
         //查询策略执行文本
         String strategyText = pushMsgTextStrategy.getStrategyText(gameUserRole);
         String strategyText = pushMsgTextStrategy.getStrategyText(gameUserRole);
+        log.error("消息推送查询到文本, param : {}, strategyText : {}", JsonUtil.toString(param), strategyText);
         if (Strings.isBlank(strategyText)) {
         if (Strings.isBlank(strategyText)) {
             log.error("消息推送文本内容为空, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
             log.error("消息推送文本内容为空, pushMsgStrategyId : {}, param : {}", pushMsgStrategy.getId(), JsonUtil.toString(param));
             return;
             return;
         }
         }
         //执行发送
         //执行发送
+        log.error("执行消息推送, param : {}", JsonUtil.toString(param));
         pushMsgSendLogService.pushMsg(param.getGameId(), pushMsgStrategy.getId(), strategyText, Collections.singletonList(gameUserRole));
         pushMsgSendLogService.pushMsg(param.getGameId(), pushMsgStrategy.getId(), strategyText, Collections.singletonList(gameUserRole));
     }
     }