소스 검색

Merge remote-tracking branch 'origin/package' into package

zhangxianyu 6 달 전
부모
커밋
23574a80c1

+ 9 - 8
game-gs-data/game-gs-data-serve/src/main/java/com/zanxiang/game/gs/data/serve/controller/GameParentController.java

@@ -1,6 +1,7 @@
 package com.zanxiang.game.gs.data.serve.controller;
 
 import com.mybatisflex.core.row.Row;
+import com.zanxiang.erp.security.annotation.PreAuthorize;
 import com.zanxiang.game.gs.data.serve.pojo.dto.*;
 import com.zanxiang.game.gs.data.serve.pojo.vo.*;
 import com.zanxiang.game.gs.data.serve.service.IAdsGsServerDayParentService;
@@ -32,56 +33,56 @@ public class GameParentController {
     private IAdsServerRankingParentService serverRankingParentService;
 
     @ApiOperation(value = "大R每日充值比")
-//    @PreAuthorize(permissionKey = "gameGs:bigR:list")
+    @PreAuthorize(permissionKey = "gameGs:bigR:list")
     @PostMapping("/bigR/listOfPage")
     public ResultVO<PageVO<BigRVO, Row>> bigRListOfPage(@Validated @RequestBody BigRDTO dto) {
         return ResultVO.ok(adsRoleAmountDataParentService.bigRListOfPage(dto));
     }
 
     @ApiOperation(value = "GS角色付费留存")
-//    @PreAuthorize(permissionKey = "gameGs:rolePay:list")
+    @PreAuthorize(permissionKey = "gameGs:rolePay:list")
     @PostMapping("/role/pay/retained/listOfPage")
     public ResultVO<PageVO<RolePayVO, Row>> rolePay(@Validated @RequestBody RolePayDTO dto) {
         return ResultVO.ok(adsRoleAmountRateParentService.rolePayOfPage(dto));
     }
 
     @ApiOperation(value = "GS角色付费留存总计")
-//    @PreAuthorize(permissionKey = "gameGs:rolePay:total")
+    @PreAuthorize(permissionKey = "gameGs:rolePay:total")
     @PostMapping("/role/pay/retained/total")
     public ResultVO<RolePayVO> rolePayTotal(@Validated @RequestBody RolePayDTO dto) {
         return ResultVO.ok(adsRoleAmountRateParentService.rolePayTotal(dto));
     }
 
     @ApiOperation(value = "GS区服付费留存")
-//    @PreAuthorize(permissionKey = "gameGs:serverPay:list")
+    @PreAuthorize(permissionKey = "gameGs:serverPay:list")
     @PostMapping("/server/pay/retained/listOfPage")
     public ResultVO<PageVO<ServerPayVO, Row>> serverPay(@Validated @RequestBody ServerPayDTO dto) {
         return ResultVO.ok(gsServerDayParentService.serverPay(dto));
     }
 
     @ApiOperation(value = "GS区服付费留存总计")
-//    @PreAuthorize(permissionKey = "gameGs:serverPay:total")
+    @PreAuthorize(permissionKey = "gameGs:serverPay:total")
     @PostMapping("/server/pay/retained/total")
     public ResultVO<ServerPayVO> serverPayTotal(@Validated @RequestBody ServerPayDTO dto) {
         return ResultVO.ok(gsServerDayParentService.serverPayTotal(dto));
     }
 
     @ApiOperation(value = "角色流失监控")
-//    @PreAuthorize(permissionKey = "gameGs:roleRemoveGame:monitor")
+    @PreAuthorize(permissionKey = "gameGs:roleRemoveGame:monitor")
     @PostMapping("/role/remove/game/monitor")
     public ResultVO<PageVO<RoleRemoveGameMonitorVO, Row>> roleRemoveGameMonitor(@Validated @RequestBody RoleRemoveGameMonitorDTO dto) {
         return ResultVO.ok(adsRoleAmountDataParentService.roleRemoveGameMonitor(dto));
     }
 
     @ApiOperation(value = "游戏角色管理")
-//    @PreAuthorize(permissionKey = "gameGs:role:manage")
+    @PreAuthorize(permissionKey = "gameGs:role:manage")
     @PostMapping("/role/manage")
     public ResultVO<PageVO<RoleManageVO, Row>> roleManage(@Validated @RequestBody RoleManageDTO dto) {
         return ResultVO.ok(adsRoleAmountDataParentService.roleManage(dto));
     }
 
     @ApiOperation(value = "游戏区服管理")
-//    @PreAuthorize(permissionKey = "gameGs:serve:manage")
+    @PreAuthorize(permissionKey = "gameGs:serve:manage")
     @PostMapping("/serve/manage")
     public ResultVO<PageVO<ServeManageVO, Row>> serveManage(@Validated @RequestBody ServeManageDTO dto) {
         return ResultVO.ok(serverRankingParentService.serveManage(dto));

+ 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服务启动成功 < (梦回发送玩家弹窗消息, 新增二维码和获客链接字段・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 12 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/CpSendMsgLogServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zanxiang.game.module.manage.service.impl;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -199,10 +200,19 @@ public class CpSendMsgLogServiceImpl extends ServiceImpl<CpSendMsgLogMapper, CpS
         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));
+        //攻守CP方前端存在BUG, 这个图片地址不会展示, 但是必须给过去, 否则弹窗无法弹出
+        if (Objects.equals(gameSupper.getId(), 2L)) {
+            msgContent.put("imgs", JsonUtil.toString(Collections.singletonList("https://manage.84game.cn/image/WechatIMG56.jpeg")));
+        }
+        //增加自定义客服图片和获客链接参数 -梦回CP方已接入
+        if (Strings.isNotBlank(gameSupper.getCpSendMsgConfig())) {
+            JSONObject msgConfig = JSONObject.parse(gameSupper.getCpSendMsgConfig());
+            msgContent.put("qrCode", msgConfig.getString("qrCode"));
+            msgContent.put("superLink", msgConfig.getString("superLink"));
+        }
+        //添加消息参数内容
         param.put("msgContent", msgContent);
         //请求头
         HttpHeaders headers = new HttpHeaders();

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

@@ -50,6 +50,11 @@ public class GameSupper implements Serializable {
      */
     private String cpSendMsgKey;
 
+    /**
+     * CP发送消息配置
+     */
+    private String cpSendMsgConfig;
+
     /**
      * CP服务端交互密钥
      */

+ 45 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/UserEvent.java

@@ -0,0 +1,45 @@
+package com.zanxiang.game.module.mybatis.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.io.Serializable;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-09-27
+ * @description : APP过事件
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+@Builder
+@TableName("t_user_event")
+public class UserEvent implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 游戏id
+     */
+    private Long gameId;
+
+    /**
+     * 用户名
+     */
+    private String username;
+
+    /**
+     * 绑定手机号码
+     */
+    private String mobile;
+}

+ 12 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/mapper/UserEventMapper.java

@@ -0,0 +1,12 @@
+package com.zanxiang.game.module.mybatis.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zanxiang.game.module.mybatis.entity.UserEvent;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-09-27
+ * @description :  ${description}
+ */
+public interface UserEventMapper extends BaseMapper<UserEvent> {
+}

+ 1 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java

@@ -23,7 +23,7 @@ public class SDKApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(SDKApplication.class, args);
-        System.out.println("赞象SDK服务启动成功 <修正蜀山cpOrderId前端不正确问题> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <新游戏梦回解决订单中CP订单id不正确的问题> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 12 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IUserEventService.java

@@ -0,0 +1,12 @@
+package com.zanxiang.game.module.sdk.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zanxiang.game.module.mybatis.entity.UserEvent;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-09-27
+ * @description : APP过事件
+ */
+public interface IUserEventService extends IService<UserEvent> {
+}

+ 19 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/CallBackServiceImpl.java

@@ -77,6 +77,9 @@ public class CallBackServiceImpl implements ICallBackService {
     @Autowired
     private IDistributedLockComponent distributedLockComponent;
 
+    @Autowired
+    private IUserEventService userEventService;
+
     @Override
     public Map<String, Object> callBackJudge(CallBackControlParam param, UserData userData) {
         log.error("事件回传判断请求, param : {},  userData : {}", JsonUtil.toString(param), JsonUtil.toString(userData));
@@ -88,7 +91,7 @@ public class CallBackServiceImpl implements ICallBackService {
         CallBackTypeEnum callBackTypeEnum = param.getCallBackTypeEnum();
         Game game = gameService.getById(userData.getGameId());
         //判断游戏状态, 对接上包过程中, 全量回传
-        if (Objects.equals(game.getStatus(), 2)) {
+        if (this.isUserEvent(game, userData.getUserId())) {
             resultMap.put("callBack", Boolean.TRUE);
             if (Objects.equals(callBackTypeEnum, CallBackTypeEnum.CALL_BACK_PAY_ORDER)) {
                 PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
@@ -132,6 +135,21 @@ public class CallBackServiceImpl implements ICallBackService {
         return resultMap;
     }
 
+    private boolean isUserEvent(Game game, Long userId) {
+        if (Objects.equals(game.getStatus(), 2)) {
+            return true;
+        }
+        //查询玩家
+        User user = userService.getById(userId);
+        //判断是否测试过事件用户
+        return userEventService.count(new LambdaQueryWrapper<UserEvent>()
+                .eq(UserEvent::getGameId, game.getId())
+                .and(qw -> qw.eq(UserEvent::getUsername, user.getUsername())
+                        .or().eq(UserEvent::getMobile, user.getMobile())
+                )
+        ) > 0;
+    }
+
     private void checkCallBack(Long userId, Agent agent, CallBackTypeEnum callBackTypeEnum, Map<String, Object> resultMap,
                                CallBackControlParam param) {
         switch (callBackTypeEnum) {

+ 16 - 3
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/OrderServiceImpl.java

@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Objects;
 
 /**
  * 平台订单逻辑开发
@@ -52,6 +53,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Autowired
     private ICallBackService callBackService;
 
+    @Autowired
+    private IGameSupperService gameSupperService;
+
     @Override
     @Transactional(rollbackFor = {Exception.class, RuntimeException.class})
     public Boolean createOrder(ProductPayParam payParam, User user, UserData userData) {
@@ -118,13 +122,22 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 .createTime(LocalDateTime.now())
                 .updateTime(LocalDateTime.now())
                 .build();
-        //蜀山天下, sdk前端存在bug, cp订单id参数修正
-        if (game.getId() == 29 && !order.getCpOrderId().contains("NZW")) {
-            //ext中记录了正确的cp订单id, 修正订单数据
+        //sdk前端存在bug, 可能将系统订单id作为CP订单id传上来的情况, 怀疑前端缓存问题导致, 这里参数修正
+        GameSupper gameSupper = gameSupperService.getById(game.getSuperGameId());
+        if (gameSupper == null) {
+            return order;
+        }
+        //蜀山天下CP订单id修正, 蜀山天下订单前缀固定为: NZW
+        if (Objects.equals(gameSupper.getId(), 8L) && !order.getCpOrderId().contains("NZW")) {
             if (Strings.isNotBlank(order.getExt()) && order.getExt().contains("NZW")) {
                 order.setCpOrderId(order.getExt());
             }
         }
+        //梦回白玉京CP订单id修正, ext字段中传的订单id
+        if (Objects.equals(gameSupper.getId(), 11L) && Strings.isNotBlank(order.getExt())
+                && !Objects.equals(order.getCpOrderId(), order.getExt())) {
+            order.setCpOrderId(order.getExt());
+        }
         return order;
     }
 

+ 18 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/UserEventServiceImpl.java

@@ -0,0 +1,18 @@
+package com.zanxiang.game.module.sdk.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zanxiang.game.module.mybatis.entity.UserEvent;
+import com.zanxiang.game.module.mybatis.mapper.UserEventMapper;
+import com.zanxiang.game.module.sdk.service.IUserEventService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-09-27
+ * @description : APP过事件
+ */
+@Slf4j
+@Service
+public class UserEventServiceImpl extends ServiceImpl<UserEventMapper, UserEvent> implements IUserEventService {
+}