Browse Source

feat : 虚拟游戏更改为可接待01

bilingfeng 10 tháng trước cách đây
mục cha
commit
c08089bc32

+ 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服务启动成功 < (虚拟游戏更改为可接待・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 < (虚拟游戏更改为可接待01・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

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

@@ -147,9 +147,15 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
         //虚拟游戏小程序, 单独逻辑
         if (Objects.equals(gameApplet.getType(), 3)) {
             //小程序自动回复
-            this.appletReplyHandle(gameApplet.getGameId(), kfAppletMsgDTO.getFromUserName(), kfRoom, gameApplet.getAppId());
-            //保存消息, 玩家转入接待状态
-            this.saveMsgAndChangeWait(kfRoom, kfRoomMsg, gameApplet, kfAppletMsgDTO, msgContent);
+            Boolean customerSwitch = this.appletReplyHandle(gameApplet.getGameId(), kfAppletMsgDTO.getFromUserName(),
+                    kfRoom, gameApplet.getAppId());
+            if (Objects.equals(Boolean.TRUE, customerSwitch)) {
+                //保存消息, 玩家转入接待状态
+                this.saveMsgAndChangeWait(kfRoom, kfRoomMsg, gameApplet, kfAppletMsgDTO, msgContent);
+            } else {
+                //保存房间消息
+                kfRoomMsgService.save(kfRoomMsg);
+            }
             //直接结束
             return;
         }
@@ -190,13 +196,13 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
         this.pushMessage(this.transform(kfRoom, gameApplet.getGameId(), kfAppletMsgDTO.getFromUserName(), kfRoomMsg, msgContent));
     }
 
-    private void appletReplyHandle(Long gameId, String openId, KfRoom kfRoom, String appId) {
+    private Boolean appletReplyHandle(Long gameId, String openId, KfRoom kfRoom, String appId) {
         //玩家信息
         KfSessionUser kfSessionUser = kfSessionUserService.getById(openId, gameId);
         //来源类型
         KfSessionFromEnum kfSessionFrom = KfSessionFromEnum.getKfSessionFrom(kfSessionUser.getSessionFrom());
         if (kfSessionFrom == null) {
-            return;
+            return Boolean.TRUE;
         }
         //查询玩家访问信息
         UserApplet userApplet = userAppletService.getOne(new LambdaQueryWrapper<UserApplet>()
@@ -206,7 +212,7 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
                 .last("limit 1"));
         //不存在访问信息, 不处理
         if (userApplet == null) {
-            return;
+            return Boolean.TRUE;
         }
         Map<String, String> channelMap = JsonUtil.toMap(userApplet.getChannel(), Map.class, String.class);
         String pageSign = channelMap.get(KfAppletReply.PAGE_SIGN);
@@ -218,7 +224,7 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
                 .orderByDesc(KfAppletReply::getCreateTime)
                 .last("limit 1"));
         if (kfAppletReply == null) {
-            return;
+            return Boolean.TRUE;
         }
         //存在文本消息发送
         if (Strings.isNotBlank(kfAppletReply.getReplyText())) {
@@ -239,6 +245,7 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
             }
             this.sysLinkMsgSend(gameId, openId, kfRoom, linkMap);
         }
+        return kfAppletReply.getCustomerSwitch();
     }
 
     private void sysLinkMsgSend(Long gameId, String openId, KfRoom kfRoom, Map<String, String> linkMap) {

+ 5 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/KfAppletReply.java

@@ -58,6 +58,11 @@ public class KfAppletReply implements Serializable {
      */
     private String replyLink;
 
+    /**
+     * 客服接待开关
+     */
+    private Boolean customerSwitch;
+
     /**
      * 创建时间
      */