Przeglądaj źródła

游戏策略配置发送钉钉消息(测试)

Letianhua 1 rok temu
rodzic
commit
eb23b3da16

+ 28 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/GameMonitorAlarmController.java

@@ -0,0 +1,28 @@
+package com.zanxiang.game.data.serve.controller;
+
+import com.zanxiang.game.data.serve.service.IGameMonitorAlarmService;
+import com.zanxiang.module.util.pojo.ResultVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: 游戏监控告警控制器
+ * @date 2023/12/13 16:20
+ */
+@RestController
+@RequestMapping("/monitor/alarm")
+public class GameMonitorAlarmController {
+
+    @Autowired
+    private IGameMonitorAlarmService gameMonitorAlarmService;
+
+    @PutMapping("/sendMsg")
+    public ResultVO<Boolean> sendDingMsgToUser() {
+        return ResultVO.ok(gameMonitorAlarmService.sendMsgToUser());
+    }
+
+}

+ 13 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IGameMonitorAlarmService.java

@@ -0,0 +1,13 @@
+package com.zanxiang.game.data.serve.service;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: TODO
+ * @date 2023/12/13 16:24
+ */
+public interface IGameMonitorAlarmService {
+
+    boolean sendMsgToUser();
+
+}

+ 37 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameMonitorAlarmServiceImpl.java

@@ -0,0 +1,37 @@
+package com.zanxiang.game.data.serve.service.impl;
+
+import com.zanxiang.erp.base.ErpServer;
+import com.zanxiang.erp.base.rpc.IDingTalkMsgRpc;
+import com.zanxiang.game.data.serve.service.IGameMonitorAlarmService;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.nutz.dao.Dao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: TODO
+ * @date 2023/12/13 16:24
+ */
+@Service
+public class GameMonitorAlarmServiceImpl implements IGameMonitorAlarmService {
+
+    @Autowired
+    private Dao dao;
+
+    @DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
+    private IDingTalkMsgRpc dingTalkMsgRpc;
+
+    public boolean sendMsgToUser() {
+        LocalDateTime now = LocalDateTime.now();
+        String msg = "这是一条测试钉钉消息,发送时间:" + now;
+        dingTalkMsgRpc.sendByUserId(401L, msg);
+
+        return true;
+    }
+
+
+}