Explorar el Código

Merge branch 'package' of GameCenter/game-center into dev

zhimo hace 1 año
padre
commit
9408e9cafc

+ 3 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/utils/Page.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.nutz.dao.pager.Pager;
 
+import java.io.Serializable;
 import java.util.Collections;
 import java.util.List;
 
@@ -16,7 +17,8 @@ import java.util.List;
 @NoArgsConstructor
 @AllArgsConstructor
 @Builder
-public class Page<T> {
+public class Page<T> implements Serializable {
+
 
     /**
      * 查询数据列表

+ 4 - 1
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/util/PageUtil.java

@@ -5,6 +5,7 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.io.Serializable;
 import java.util.Collections;
 import java.util.List;
 
@@ -15,7 +16,9 @@ import java.util.List;
 @NoArgsConstructor
 @AllArgsConstructor
 @Builder
-public class PageUtil<T> {
+public class PageUtil<T> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
 
     /**
      * 查询数据列表

+ 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) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 <CP推送消息代码提交 ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <CP推送消息调试修改, 客服系统新增自动回复 ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 2 - 3
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/CPSendMsgTaskServiceImpl.java

@@ -21,7 +21,6 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
-import java.time.ZoneId;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -86,8 +85,8 @@ public class CPSendMsgTaskServiceImpl extends ServiceImpl<CpSendMsgTaskMapper, C
         //任务状态
         cpSendMsgTask.setStatus(CpSendMsgTaskStatusEnum.WAIT_SEND.getValue());
         cpSendMsgTask.setCreateBy(dto.getCreateBy());
-        cpSendMsgTask.setCreateTime(LocalDateTime.now(ZoneId.of("UTC")));
-        cpSendMsgTask.setUpdateTime(LocalDateTime.now(ZoneId.of("UTC")));
+        cpSendMsgTask.setCreateTime(LocalDateTime.now());
+        cpSendMsgTask.setUpdateTime(LocalDateTime.now());
         return cpSendMsgTask;
     }
 }

+ 0 - 148
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/CpCallServiceImpl.java

@@ -1,148 +0,0 @@
-package com.zanxiang.game.module.manage.service.impl;
-
-import com.zanxiang.game.module.manage.pojo.dto.CpSendMsgResultDTO;
-import com.zanxiang.module.util.JsonUtil;
-import com.zanxiang.module.util.exception.BaseException;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.web.client.RestTemplate;
-
-import java.nio.charset.StandardCharsets;
-import java.security.MessageDigest;
-import java.util.*;
-
-/**
- * @author : lingfeng
- * @time : 2024-02-22
- * @description : CP接口交互 demo类, 测试完成要删除
- */
-public class CpCallServiceImpl {
-
-    /**
-     * MD5加密
-     */
-    private static final String SIGN_MD5 = "MD5";
-
-//    public static void main(String[] args) throws Exception {
-//
-//        String text = "尊敬的尊享玩家“角色名”:\n" +
-//                "叮,尊享管家小诗正在微信上等待与您的见面,根据您的游戏角色成长,小诗特意为您定制一份战力快速升级的攻略和几个尊享限定礼包,助您快速提升~\n" +
-//                "您要尽快通过游戏内“联系客服”按钮与我联系,时间有限,请您尽快与我联系哦。\n" +
-//                "联系时请您带上此页面截图,同时请您保密勿将此内容分享给其他玩家,可能会导致尊享限定礼包被冒领哦!";
-////        test();
-//        CpSendMsgResultDTO result = cpSendMsgApi("testMsgId2", "668", Collections.singletonList("821112073166082222"), text);
-//        System.out.println("11111111" + JsonUtil.toString(result));
-//    }
-
-    public static CpSendMsgResultDTO cpSendMsgApi(String msgId, String serverId, List<String> roleIdList, String text) throws Exception {
-        long time = System.currentTimeMillis() / 1000;
-        Map<String, Object> param = new HashMap<>(8);
-        param.put("msgId", msgId);
-        param.put("strRan", msgId);
-        param.put("time", time);
-        param.put("sign", MD5("key=" + "355b7f07125c1ef71cfd10166e0b90aa" + "&msgId=" + msgId + "&strRan=" + msgId + "&time=" + time));
-        param.put("pushType", 1);
-        param.put("serverid", serverId);
-        param.put("roleIds", roleIdList);
-        //图片地址弄一张最小的, CP方不会用, 有默认底图
-        List<String> imgList = Collections.singletonList("https://manage.84game.cn/image/WechatIMG56.jpeg");
-        Map<String, Object> msgContent = new HashMap<>(2);
-        msgContent.put("text", text);
-        msgContent.put("imgs", JsonUtil.toString(imgList));
-        param.put("msgContent", msgContent);
-        //请求头
-        HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_JSON);
-        headers.set(HttpHeaders.ACCEPT_CHARSET, "UTF-8");
-        HttpEntity<String> request = new HttpEntity<>(JsonUtil.toString(param), headers);
-        String result;
-        try {
-            RestTemplate restTemplate = new RestTemplate();
-            result = restTemplate.postForObject("https://ht.lttx.t5yx.cn/extapi?action=BgzszhSendTip",
-                    request, String.class);
-        } catch (Exception e) {
-            System.out.println(e.getMessage());
-            throw new BaseException("消息发送失败");
-        }
-        System.out.println("返回结果" + result);
-        CpSendMsgResultDTO cpSendMsgResultDTO = JsonUtil.toObj(result, CpSendMsgResultDTO.class);
-        return cpSendMsgResultDTO;
-    }
-
-    public static void test() throws Exception {
-        String key = "355b7f07125c1ef71cfd10166e0b90aa";
-        RestTemplate restTemplate = new RestTemplate();
-
-        String url = "https://ht.lttx.t5yx.cn/extapi?action=BgzszhSendTip";
-
-        Map<String, Object> param = new HashMap<>();
-
-        String msgId = "testMsgId2";
-        param.put("msgId", msgId);
-
-        String strRan = "strRan1";
-        param.put("strRan", strRan);
-
-        Long time = 1709002794L;
-        param.put("time", time);
-
-        String signStr = "key=355b7f07125c1ef71cfd10166e0b90aa&msgId=" + msgId + "&strRan=" + strRan + "&time=" + time;
-
-        System.out.println("加密字符串 : " + signStr);
-
-
-        param.put("sign", CpCallServiceImpl.MD5(signStr));
-
-//        param.put("serverid", 226);
-        param.put("serverid", 668);
-        List<String> roleIds = new ArrayList<>();
-//        roleIds.add("798136461189027272");
-        roleIds.add("821112073166082222");
-        param.put("roleIds", roleIds);
-
-        param.put("pushType", 1);
-
-        String text = "尊敬的尊享玩家“角色名”:\n" +
-                "叮,尊享管家小诗正在微信上等待与您的见面,根据您的游戏角色成长,小诗特意为您定制一份战力快速升级的攻略和几个尊享限定礼包,助您快速提升~\n" +
-                "您要尽快通过游戏内“联系客服”按钮与我联系,时间有限,请您尽快与我联系哦。\n" +
-                "联系时请您带上此页面截图,同时请您保密勿将此内容分享给其他玩家,可能会导致尊享限定礼包被冒领哦!";
-        Map<String, Object> msgContent = new HashMap<>();
-        msgContent.put("text", text);
-
-        List<String> imgs = new ArrayList<>();
-        //图片地址弄一张最小的, CP方不会用, 有默认底图
-        imgs.add("https://manage.84game.cn/image/WechatIMG56.jpeg");
-        msgContent.put("imgs", JsonUtil.toString(imgs));
-
-        param.put("msgContent", msgContent);
-
-        System.out.println("接口参数 param :" + JsonUtil.toString(param));
-
-        HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_JSON);
-        headers.set(HttpHeaders.ACCEPT_CHARSET, "UTF-8");
-
-        HttpEntity<String> request = new HttpEntity<>(JsonUtil.toString(param), headers);
-
-        String result = restTemplate.postForObject(url, request, String.class);
-
-        System.out.println("返回结果" + result);
-    }
-
-    /**
-     * MD5加密
-     *
-     * @param data 待处理数据
-     * @return MD5结果
-     */
-    public static String MD5(String data) throws Exception {
-        java.security.MessageDigest md = MessageDigest.getInstance(SIGN_MD5);
-        byte[] array = md.digest(data.getBytes(StandardCharsets.UTF_8));
-        StringBuilder sb = new StringBuilder();
-        for (byte item : array) {
-            sb.append(Integer.toHexString((item & 0xFF) | 0x100), 1, 3);
-        }
-        return sb.toString();
-    }
-}

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

@@ -92,6 +92,7 @@ public class CpSendMsgLogServiceImpl extends ServiceImpl<CpSendMsgLogMapper, CpS
                 .successCount(0L)
                 .failCount(0L)
                 .createTime(LocalDateTime.now())
+                .updateTime(LocalDateTime.now())
                 .build();
     }
 

+ 6 - 7
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/KfAppletMsgServiceImpl.java

@@ -137,7 +137,7 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
             kfRoomMsgService.save(kfRoomMsg);
             return;
         }
-        //客服休息时间, 发送自动回复
+        //发送自动回复
         this.systemReplyHandle(gameApplet.getGameId(), kfAppletMsgDTO.getFromUserName(), kfRoom);
         //消息报警监测
         this.monitorWordHandle(gameApplet, kfAppletMsgDTO);
@@ -188,12 +188,11 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
         LocalTime nowTime = LocalTime.now();
         LocalTime startTime = LocalTime.parse(kfSystemReply.getStartTime());
         LocalTime endTime = LocalTime.parse(kfSystemReply.getEndTime());
-        if (nowTime.isAfter(startTime) && nowTime.isBefore(endTime)) {
-            return;
-        }
-        //休息时间, 发送指定消息
+        //判断要发送的消息内容
+        String content = nowTime.isAfter(startTime) && nowTime.isBefore(endTime) ? kfSystemReply.getWorkSysReply() : kfSystemReply.getSysReply();
+        //发送消息
         Map<String, Object> textMap = new HashMap<>(1);
-        textMap.put("content", kfSystemReply.getSysReply());
+        textMap.put("content", content);
         Map<String, Object> msgParamMap = new HashMap<>(3);
         msgParamMap.put("touser", openId);
         msgParamMap.put("msgtype", KfRoomMsgTypeEnum.KF_MSG_TYPE_TEXT.getValue());
@@ -201,7 +200,7 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
         kfWxApiService.sendCustomMessageApi(gameId, msgParamMap);
         //保存消息
         Map<String, Object> kfRoomMsgMap = new HashMap<>(1);
-        kfRoomMsgMap.put("text", kfSystemReply.getSysReply());
+        kfRoomMsgMap.put("text", content);
         kfRoomMsgService.save(this.transform(openId, gameId, kfRoom, KfRoomMsgTypeEnum.KF_MSG_TYPE_TEXT, JsonUtil.toString(kfRoomMsgMap)));
     }
 

+ 6 - 1
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/KfSystemReply.java

@@ -32,10 +32,15 @@ public class KfSystemReply {
     private String appId;
 
     /**
-     * 回复
+     * 下班回复
      */
     private String sysReply;
 
+    /**
+     * 上班回复
+     */
+    private String workSysReply;
+
     /**
      * 开始时间
      */