Browse Source

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

wcc 1 năm trước cách đây
mục cha
commit
c8a149d7a1
25 tập tin đã thay đổi với 289 bổ sung251 xóa
  1. 1 1
      game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/enums/HttpStatusEnum.java
  2. 19 1
      game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/enums/PayDeviceEnum.java
  3. 1 1
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java
  4. 12 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/GameController.java
  5. 2 2
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/GameAppletConfigDTO.java
  6. 17 97
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/GameDTO.java
  7. 8 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameAppletService.java
  8. 43 15
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAppletServiceImpl.java
  9. 1 1
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameApplet.java
  10. 5 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameExt.java
  11. 14 5
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/controller/InitController.java
  12. 10 4
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/controller/PayController.java
  13. 5 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/dto/ProductPayParamDTO.java
  14. 0 32
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/vo/GameAppletVO.java
  15. 12 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/vo/GameInitVO.java
  16. 12 3
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IGameAppletService.java
  17. 2 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IOrderPayService.java
  18. 3 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IOrderService.java
  19. 29 5
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameAppletServiceImpl.java
  20. 9 10
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/LoginServiceImpl.java
  21. 57 43
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/OrderPayServiceImpl.java
  22. 8 21
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/OrderServiceImpl.java
  23. 1 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/pay/AliPayService.java
  24. 1 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/pay/PayBaseService.java
  25. 17 7
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/pay/WxPayService.java

+ 1 - 1
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/enums/HttpStatusEnum.java

@@ -35,7 +35,7 @@ public enum HttpStatusEnum {
     /**
      * 请先登录
      */
-    USER_NO_LOGIN(40400, "请登录"),
+    USER_NO_LOGIN(40400, "登录信息已失效, 重新登录"),
 
     /**
      * 用户名为空

+ 19 - 1
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/enums/PayDeviceEnum.java

@@ -4,6 +4,8 @@ import lombok.AllArgsConstructor;
 import lombok.Getter;
 import org.apache.logging.log4j.util.Strings;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -44,7 +46,12 @@ public enum PayDeviceEnum {
     /**
      * 客服支付
      */
-    CUSTOM_PAY(6L, "CUSTOM_PAY", "客服支付");
+    CUSTOM_PAY(6L, "CUSTOM_PAY", "客服支付"),
+
+    /**
+     * 公众号支付
+     */
+    MP_PAY(7L, "MP_PAY", "公众号支付");
 
     /**
      * 支付方式id
@@ -78,4 +85,15 @@ public enum PayDeviceEnum {
         }
         return Strings.EMPTY;
     }
+
+    /**
+     * 获取特殊的支付类型(预下单在获取支付参数)
+     *
+     * @return {@link List}<{@link Long}>
+     */
+    public static List<Long> getByPayWayIdList() {
+        return Arrays.asList(PayDeviceEnum.APPLET_PAY.getPayDeviceId(),
+                PayDeviceEnum.CUSTOM_PAY.getPayDeviceId(),
+                PayDeviceEnum.MP_PAY.getPayDeviceId());
+    }
 }

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

@@ -21,7 +21,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功003 ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功0043 ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 12 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/GameController.java

@@ -5,6 +5,7 @@ import com.zanxiang.erp.security.annotation.PreAuthorize;
 import com.zanxiang.game.module.manage.pojo.params.GameAddParam;
 import com.zanxiang.game.module.manage.pojo.params.GameListParam;
 import com.zanxiang.game.module.manage.pojo.vo.GameListVO;
+import com.zanxiang.game.module.manage.service.IGameAppletService;
 import com.zanxiang.game.module.manage.service.IGameService;
 import com.zanxiang.module.util.pojo.ResultVO;
 import io.swagger.annotations.Api;
@@ -30,6 +31,9 @@ public class GameController {
     @Autowired
     private IGameService gameService;
 
+    @Autowired
+    private IGameAppletService gameAppletService;
+
     @ApiOperation(value = "新增游戏")
     @PostMapping(value = "/add/or/update")
     @PreAuthorize(permissionKey = "manage:game:add")
@@ -61,4 +65,12 @@ public class GameController {
     public ResultVO<Boolean> statusUpdate(@RequestParam Long id, @RequestParam Integer status) {
         return ResultVO.ok(gameService.statusUpdate(id, status));
     }
+
+    @ApiOperation(value = "创建游戏回传数据源")
+    @PutMapping(value = "/create/game/action/set")
+    @PreAuthorize(permissionKey = "manage:game:createGameActionSet")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
+    public ResultVO<Boolean> createActionSet(@RequestParam Long gameId) {
+        return ResultVO.ok(gameAppletService.createActionSet(gameId));
+    }
 }

+ 2 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/GameAppletConfigDTO.java

@@ -18,9 +18,9 @@ import lombok.NoArgsConstructor;
 public class GameAppletConfigDTO {
 
     /**
-     * 类型,1 : 小程序, 2 : 公众号
+     * 类型,1 : 小游戏, 2 : 公众号
      */
-    @ApiModelProperty(notes = "类型,1 : 小程序, 2 : 公众号 (必填)")
+    @ApiModelProperty(notes = "类型,1 : 小游戏, 2 : 公众号 (必填)")
     private Integer type;
 
     /**

+ 17 - 97
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/dto/GameDTO.java

@@ -27,120 +27,45 @@ public class GameDTO {
      */
     private String name;
 
-    /**
-     * appkey
-     */
-    private String appKey;
-
-    /**
-     * 游戏标签
-     */
-    private Long tags;
-
     /**
      * 游戏类型
      */
     private Long category;
 
     /**
-     * 游戏分类id, 多个
+     * H5游戏跳转地址
      */
-    private String classify;
+    private String h5GameUrl;
 
     /**
-     * 游戏分类父id, 多个
+     * H5游戏登录logo图片
      */
-    private String classifyParent;
+    private String h5LoginLogo;
 
     /**
-     * 网页游戏图标,200*200
+     * 游戏是否投放
      */
-    private String icon;
+    private Boolean isPut;
 
     /**
-     * CP回调路径
-     */
-    private String cpPaybackUrl;
-
-    /**
-     * 从属游戏
-     */
-    private Long parentId;
-
-    /**
-     * 包名
+     * 游戏标签
      */
-    private String packageName;
+    private String tags;
 
     /**
-     * 上线状态1 接入中, 2 可上线, 3 已下线
+     * 上线状态 1 : 未接入, 2 : 接入中, 3 : 上线, 4 : 下线
      */
     private Integer status;
 
     /**
-     * 1在线游戏 2 单机
-     */
-    private Boolean isOnline;
-
-    /**
-     * 1 不是SDK游戏  2 是SDK游戏
-     */
-    private Boolean isSdk;
-
-    /**
-     * 游戏宣传语
-     */
-    private String publicity;
-
-    /**
-     * 语言
-     */
-    private String language;
-
-    /**
-     * 游戏描述
-     */
-    private String description;
-
-    /**
-     * 游戏宣传图 JSON格式
-     */
-    private String image;
-
-    /**
-     * 苹果应用ID
-     */
-    private String appleId;
-
-    /**
-     * 是否需要实名认证,1:关闭实名认证,2:强制实名认证  3:开启实名认证
-     */
-    private Integer needAuth;
-
-    /**
-     * 扩展 JSON格式
-     */
-    private String extInfo;
-
-    /**
-     * 上线时间
-     */
-    private LocalDateTime onlineTime;
-
-    /**
-     * 1 删除  0 正常
-     */
-    private Integer isDelete;
-
-    /**
-     * 删除时间
+     * 分成比例
      */
-    private LocalDateTime deleteTime;
+    private Double shareScale;
 
     /**
-     * 分成比例
+     * 父游戏id
      */
-    private Double shareScale;
+    private Long parentId;
 
     /**
      * 关联H5游戏id
@@ -153,19 +78,14 @@ public class GameDTO {
     private Long guideGameId;
 
     /**
-     * 游戏地址
+     * 游戏备注
      */
-    private String gameUrl;
+    private String remark;
 
     /**
-     * 游戏版本
-     */
-    private String version;
-
-    /**
-     * 下载次数
+     * 1 删除  0 正常
      */
-    private Long downloadCount;
+    private Integer isDelete;
 
     /**
      * 创建时间

+ 8 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameAppletService.java

@@ -22,6 +22,14 @@ public interface IGameAppletService extends IService<GameApplet> {
      */
     boolean addOrUpdate(Game game, GameAppletConfigDTO gameAppletConfigDTO);
 
+    /**
+     * 创建数据源
+     *
+     * @param gameId 游戏id
+     * @return {@link Boolean}
+     */
+    Boolean createActionSet(Long gameId);
+
     /**
      * 通过游戏id
      *

+ 43 - 15
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAppletServiceImpl.java

@@ -12,7 +12,9 @@ import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
 import com.zanxiang.game.module.base.pojo.enums.StatusEnum;
 import com.zanxiang.game.module.manage.pojo.dto.GameAppletConfigDTO;
 import com.zanxiang.game.module.manage.pojo.dto.GameAppletDTO;
+import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
 import com.zanxiang.game.module.manage.service.IGameAppletService;
+import com.zanxiang.game.module.manage.service.IGameService;
 import com.zanxiang.game.module.mybatis.entity.Game;
 import com.zanxiang.game.module.mybatis.entity.GameApplet;
 import com.zanxiang.game.module.mybatis.mapper.GameAppletMapper;
@@ -21,6 +23,7 @@ import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.module.util.URIUtil;
 import com.zanxiang.module.util.bean.BeanUtil;
 import com.zanxiang.module.util.exception.BaseException;
+import com.zanxiang.module.util.pojo.ResultVO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.apache.logging.log4j.util.Strings;
@@ -32,10 +35,7 @@ import java.io.PrintWriter;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.time.LocalDateTime;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * @author : lingfeng
@@ -52,6 +52,9 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
     @Autowired
     private IOssService ossService;
 
+    @Autowired
+    private IGameService gameService;
+
     @Override
     public boolean addOrUpdate(Game game, GameAppletConfigDTO gameAppletConfigDTO) {
         GameApplet gameApplet = super.getOne(new LambdaQueryWrapper<GameApplet>()
@@ -59,17 +62,7 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
                 .eq(GameApplet::getGameId, game.getId())
         );
         if (gameApplet == null) {
-            CreateUserActionSetRpcDTO actionSetRpcDTO = CreateUserActionSetRpcDTO.builder()
-                    .appId(gameAppletConfigDTO.getAppId())
-                    .build();
-            //小游戏需要创建数据源
-            if (Objects.equals(GameCategoryEnum.CATEGORY_WX_APPLET.getId(), game.getCategory())) {
-//                userActionSetRpc.create(actionSetRpcDTO);
-            }
-            //H5游戏要判断是否主游戏, 主游戏才投, 需要创建公众号数据源
-            if (game.getParentId() == null && Objects.equals(GameCategoryEnum.CATEGORY_H5.getId(), game.getCategory())) {
-//                userActionSetRpc.create(actionSetRpcDTO);
-            }
+            this.createActionSet(game.getCategory(), game.getIsPut(), gameAppletConfigDTO.getAppId(), game.getName());
             gameApplet = GameApplet.builder()
                     .gameId(game.getId())
                     .appId(gameAppletConfigDTO.getAppId())
@@ -105,6 +98,41 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
         return super.saveOrUpdate(gameApplet);
     }
 
+    @Override
+    public Boolean createActionSet(Long gameId) {
+        GameDTO gameDTO = gameService.getById(gameId);
+        GameAppletDTO gameAppletDTO = this.getByGameId(gameId);
+        if (gameDTO == null || gameAppletDTO == null) {
+            log.error("创建数据源失败, 游戏信息数据不全 gameDTO : {}, gameAppletDTO : {}",
+                    JsonUtil.toString(gameDTO), JsonUtil.toString(gameAppletDTO));
+            return Boolean.FALSE;
+        }
+        return this.createActionSet(gameDTO.getCategory(), gameDTO.getIsPut(), gameAppletDTO.getAppId(), gameDTO.getName());
+    }
+
+    private Boolean createActionSet(Long gameCategory, Boolean isPut, String appId, String gameName) {
+        CreateUserActionSetRpcDTO actionSetRpcDTO = CreateUserActionSetRpcDTO.builder()
+                .appId(appId).type("WEB").name(gameName + "Web数据源").build();
+        //小游戏和H5的类型才需要创建数据源
+        List<Long> categoryList = Arrays.asList(GameCategoryEnum.CATEGORY_WX_APPLET.getId(), GameCategoryEnum.CATEGORY_H5.getId());
+        //投放的游戏才需要设置数据源
+        if (!categoryList.contains(gameCategory) || !Objects.equals(isPut, Boolean.TRUE)) {
+            return Boolean.FALSE;
+        }
+        //调用回传服务创建数据源
+        ResultVO<Boolean> booleanResultVO = null;
+        try {
+            log.error("数据源创建提交参数, actionSetRpcDTO : {}", JsonUtil.toString(actionSetRpcDTO));
+            booleanResultVO = userActionSetRpc.create(actionSetRpcDTO);
+        } catch (Exception e) {
+            log.error("调用回传服务创建数据源异常, gameCategory : {}, appId : {}, actionSetRpcDTO : {}, e : {}",
+                    gameCategory, appId, JsonUtil.toString(actionSetRpcDTO), e.getMessage());
+        }
+        log.error("创建数据源结果 actionSetRpcDTO : {}, booleanResultVO : {}",
+                JsonUtil.toString(actionSetRpcDTO), JsonUtil.toString(booleanResultVO));
+        return booleanResultVO == null ? Boolean.FALSE : booleanResultVO.getData();
+    }
+
     @Override
     public GameAppletDTO getByGameId(Long gameId) {
         GameApplet gameApplet = super.getOne(new LambdaQueryWrapper<GameApplet>()

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

@@ -56,7 +56,7 @@ public class GameApplet implements Serializable {
     private String appSecret;
 
     /**
-     * 类型,1 : 小程序, 2 : 公众号
+     * 类型,1 : 小游戏, 2 : 公众号
      */
     private Integer type;
 

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

@@ -69,6 +69,11 @@ public class GameExt implements Serializable {
      */
     private Boolean adCallBackSwitch;
 
+    /**
+     * 小游戏壳包控制开关
+     */
+    private Boolean appletShellSwitch;
+
     /**
      * 客服手机
      */

+ 14 - 5
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/controller/InitController.java

@@ -2,7 +2,7 @@ package com.zanxiang.game.module.sdk.controller;
 
 import com.zanxiang.game.module.sdk.annotation.UnSignCheck;
 import com.zanxiang.game.module.sdk.pojo.param.UserData;
-import com.zanxiang.game.module.sdk.pojo.vo.GameAppletVO;
+import com.zanxiang.game.module.sdk.pojo.vo.GameInitVO;
 import com.zanxiang.game.module.sdk.service.IGameAppletService;
 import com.zanxiang.module.util.pojo.ResultVO;
 import io.swagger.annotations.Api;
@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiResponses;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -28,10 +29,18 @@ public class InitController {
     private IGameAppletService gameAppletService;
 
     @UnSignCheck
-    @ApiOperation(value = "微信小游戏sdk初始化")
+    @ApiOperation(value = "(H5和微信小游戏)SDK参数初始化")
     @PostMapping("/applet")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameAppletVO.class)})
-    public ResultVO<GameAppletVO> gameAppletInit(UserData userData) {
-        return ResultVO.ok(gameAppletService.gameAppletInit(userData));
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameInitVO.class)})
+    public ResultVO<GameInitVO> h5AndAppletInit(UserData userData) {
+        return ResultVO.ok(gameAppletService.h5AndAppletInit(userData));
+    }
+
+    @UnSignCheck
+    @ApiOperation(value = "微信小游戏壳包控制开关")
+    @PostMapping("/shell/switch")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
+    public ResultVO<Boolean> appletShellSwitch(@RequestParam String appId) {
+        return ResultVO.ok(gameAppletService.appletShellSwitch(appId));
     }
 }

+ 10 - 4
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/controller/PayController.java

@@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -35,7 +34,7 @@ import java.util.Map;
 @Slf4j
 public class PayController {
 
-    @Resource
+    @Autowired
     private IOrderPayService orderPayService;
 
     @Autowired
@@ -44,8 +43,15 @@ public class PayController {
     @UnSignCheck
     @ApiOperation(value = "获取客服支付参数")
     @GetMapping(value = "/param/applet")
-    public ResultVO<PayParamVO> getPayParam(@RequestParam String code, @RequestParam String orderId, HttpServletRequest request) {
-        return ResultVO.ok(orderPayService.getPayParam(code, orderId, request));
+    public ResultVO<PayParamVO> getCustomPayParam(@RequestParam String code, @RequestParam String orderId, HttpServletRequest request) {
+        return ResultVO.ok(orderPayService.getPayParam(code, null, orderId, request));
+    }
+
+    @ApiOperation(value = "获取公众号支付参数")
+    @GetMapping(value = "/param/mp")
+    public ResultVO<PayParamVO> getMpPayParam(@RequestParam String openId, @RequestParam String orderId,
+                                              @ValidLogin UserData userData, HttpServletRequest request) {
+        return ResultVO.ok(orderPayService.getPayParam(null, openId, orderId, request));
     }
 
     @ApiOperation(value = "获取小游戏支付方式")

+ 5 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/dto/ProductPayParamDTO.java

@@ -72,6 +72,11 @@ public class ProductPayParamDTO {
      */
     private String code;
 
+    /**
+     * 公众号支付的openId
+     */
+    private String openId;
+
     /**
      * 支付类型详情(android / ios/ window)
      */

+ 0 - 32
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/vo/GameAppletVO.java

@@ -1,32 +0,0 @@
-package com.zanxiang.game.module.sdk.pojo.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * @author : lingfeng
- * @time : 2023-01-03
- * @description : 微信小游戏初始化
- */
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-public class GameAppletVO {
-
-    /**
-     * 应用appId
-     */
-    @ApiModelProperty(notes = "应用appId")
-    private String appId;
-
-    /**
-     * 是否投放
-     */
-    @ApiModelProperty(notes = "是否投放")
-    private Boolean isPut;
-
-}

+ 12 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/vo/GameInitVO.java

@@ -1,7 +1,10 @@
 package com.zanxiang.game.module.sdk.pojo.vo;
 
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 /**
  * @author : lingfeng
@@ -9,6 +12,9 @@ import lombok.Data;
  * @description : 游戏初始化
  */
 @Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
 public class GameInitVO {
 
     /**
@@ -23,6 +29,12 @@ public class GameInitVO {
     @ApiModelProperty(notes = "游戏应用(小游戏/公众号)appId")
     private String appId;
 
+    /**
+     * 前端appKey
+     */
+    @ApiModelProperty(notes = "前端appKey")
+    private String appKey;
+
     /**
      * H5游戏是否使用应用授权登录
      */

+ 12 - 3
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IGameAppletService.java

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.zanxiang.game.module.mybatis.entity.GameApplet;
 import com.zanxiang.game.module.sdk.pojo.dto.GameAppletDTO;
 import com.zanxiang.game.module.sdk.pojo.param.UserData;
-import com.zanxiang.game.module.sdk.pojo.vo.GameAppletVO;
+import com.zanxiang.game.module.sdk.pojo.vo.GameInitVO;
 
 /**
  * @author : lingfeng
@@ -33,6 +33,7 @@ public interface IGameAppletService extends IService<GameApplet> {
      * @param signature 签名
      * @param timestamp 时间戳
      * @param nonce     现时标志
+     * @param postData  post数据
      * @return {@link String}
      * @throws Exception 异常
      */
@@ -58,7 +59,15 @@ public interface IGameAppletService extends IService<GameApplet> {
      * 微信小游戏初始化获取信息
      *
      * @param userData : 用户信息
-     * @return {@link GameAppletVO}
+     * @return {@link GameInitVO}
      */
-    GameAppletVO gameAppletInit(UserData userData);
+    GameInitVO h5AndAppletInit(UserData userData);
+
+    /**
+     * 小游戏壳包控制开关
+     *
+     * @param appId 应用程序id
+     * @return boolean
+     */
+    boolean appletShellSwitch(String appId);
 }

+ 2 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IOrderPayService.java

@@ -21,9 +21,10 @@ public interface IOrderPayService {
      * @param code    代码
      * @param orderId 订单id
      * @param request 请求
+     * @param openId  用户公众号唯一标识
      * @return {@link PayParamVO}
      */
-    PayParamVO getPayParam(String code, String orderId, HttpServletRequest request);
+    PayParamVO getPayParam(String code, String openId, String orderId, HttpServletRequest request);
 
     /**
      * 获取小游戏支付方式

+ 3 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IOrderService.java

@@ -2,6 +2,7 @@ package com.zanxiang.game.module.sdk.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zanxiang.game.module.mybatis.entity.Order;
+import com.zanxiang.game.module.mybatis.entity.User;
 import com.zanxiang.game.module.sdk.pojo.dto.PlatformOrderDTO;
 import com.zanxiang.game.module.sdk.pojo.param.ProductPayParam;
 import com.zanxiang.game.module.sdk.pojo.param.UserData;
@@ -20,9 +21,10 @@ public interface IOrderService extends IService<Order> {
      *
      * @param payParam 支付参数
      * @param userData 用户数据
+     * @param user     用户
      * @return {@link Boolean}
      */
-    Boolean createOrder(ProductPayParam payParam, UserData userData);
+    Boolean createOrder(ProductPayParam payParam, User user, UserData userData);
 
     /**
      * 单一订单详情获取

+ 29 - 5
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameAppletServiceImpl.java

@@ -5,12 +5,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.game.module.base.pojo.enums.HttpStatusEnum;
 import com.zanxiang.game.module.mybatis.entity.Game;
 import com.zanxiang.game.module.mybatis.entity.GameApplet;
+import com.zanxiang.game.module.mybatis.entity.GameExt;
 import com.zanxiang.game.module.mybatis.entity.Order;
 import com.zanxiang.game.module.mybatis.mapper.GameAppletMapper;
 import com.zanxiang.game.module.sdk.enums.OrderStateEnum;
 import com.zanxiang.game.module.sdk.pojo.dto.*;
 import com.zanxiang.game.module.sdk.pojo.param.UserData;
-import com.zanxiang.game.module.sdk.pojo.vo.GameAppletVO;
+import com.zanxiang.game.module.sdk.pojo.vo.GameInitVO;
 import com.zanxiang.game.module.sdk.service.*;
 import com.zanxiang.game.module.sdk.service.api.WxApiService;
 import com.zanxiang.game.module.sdk.util.SignUtil;
@@ -61,6 +62,9 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
     @Autowired
     private IGameService gameService;
 
+    @Autowired
+    private IGameExtService gameExtService;
+
     @Value("${payConfig.wxPay.customH5Url}")
     private String customH5Url;
 
@@ -184,13 +188,33 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
     }
 
     @Override
-    public GameAppletVO gameAppletInit(UserData userData) {
+    public GameInitVO h5AndAppletInit(UserData userData) {
+        //游戏
+        Game game = gameService.getById(userData.getGameId());
+        if (game == null) {
+            throw new BaseException("参数错误, 游戏信息不存在");
+        }
+        //游戏应用信息
         GameApplet gameApplet = super.getOne(new LambdaQueryWrapper<GameApplet>()
                 .eq(GameApplet::getGameId, userData.getGameId()));
-        Game game = gameService.getById(userData.getGameId());
-        return GameAppletVO.builder()
+        GameExt gameExt = gameExtService.getByGameId(userData.getGameId());
+        //构造初始化信息
+        return GameInitVO.builder()
                 .appId(gameApplet == null ? null : gameApplet.getAppId())
-                .isPut(game.getParentId() == null)
+                .appKey(gameExt == null ? null : gameExt.getAppKey())
+                .gameName(game.getName())
+                .isPut(game.getIsPut())
+                .h5GameUrl(game.getH5GameUrl())
+                .h5LoginLogo(game.getH5LoginLogo())
                 .build();
     }
+
+    @Override
+    public boolean appletShellSwitch(String appId) {
+        GameExt gameExt = gameExtService.getByGameAppId(appId);
+        if (gameExt == null || gameExt.getAppletShellSwitch() == null) {
+            return false;
+        }
+        return gameExt.getAppletShellSwitch();
+    }
 }

+ 9 - 10
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/LoginServiceImpl.java

@@ -107,18 +107,17 @@ public class LoginServiceImpl implements IRegisterLoginService {
                 .eq(User::getGameId, userData.getGameId()).eq(User::getOpenId, openId));
         //已注册
         if (user != null) {
+            //账号停用, 返回登录失败
+            if (Objects.equals(BanStatusEnum.BAN_STATUS.getStatus(), user.getStatus())) {
+                return ResultVO.fail(HttpStatusEnum.ACCOUNT_HALT.getMsg());
+            }
             //更新用户sessionKey
             if (Strings.isNotBlank(sessionKey)) {
                 userService.update(new LambdaUpdateWrapper<User>()
-                        .set(User::getSessionKey, sessionKey)
-                        .eq(User::getId, user.getId()));
+                        .set(User::getSessionKey, sessionKey).eq(User::getId, user.getId()));
             }
             //渠道更新和回传判断
             agentService.userAgentUpdate(user, userData.getChannel());
-            //判断账号是否停用
-            if (Objects.equals(BanStatusEnum.BAN_STATUS.getStatus(), user.getStatus())) {
-                return ResultVO.fail(HttpStatusEnum.ACCOUNT_HALT.getMsg());
-            }
             //返回登录信息
             return ResultVO.ok(this.createUserLoginVO(user, userData));
         }
@@ -153,8 +152,6 @@ public class LoginServiceImpl implements IRegisterLoginService {
                 user = userService.getOne(new LambdaQueryWrapper<User>()
                         .eq(User::getGameId, userData.getGameId()).eq(User::getUsername, username));
             }
-            //渠道更新和回传判断
-            agentService.userAgentUpdate(user, userData.getChannel());
             //用户信息不存在
             if (user == null) {
                 return ResultVO.fail(HttpStatusEnum.USERNAME_OR_PASSWORD_ERR.getMsg());
@@ -167,6 +164,8 @@ public class LoginServiceImpl implements IRegisterLoginService {
             if (!Objects.equals(RegisterUtil.cmfPassword(password), user.getPassword())) {
                 return ResultVO.fail(HttpStatusEnum.USERNAME_OR_PASSWORD_ERR.getMsg());
             }
+            //渠道更新和回传判断
+            agentService.userAgentUpdate(user, userData.getChannel());
             //返回登录信息
             return ResultVO.ok(this.createUserLoginVO(user, userData));
         }
@@ -201,12 +200,12 @@ public class LoginServiceImpl implements IRegisterLoginService {
                 .eq(User::getGameId, userData.getGameId()).eq(User::getMobile, mobile));
         //用户信息存在
         if (user != null) {
-            //渠道更新和回传判断
-            agentService.userAgentUpdate(user, userData.getChannel());
             //判断账号是否停用
             if (Objects.equals(BanStatusEnum.BAN_STATUS.getStatus(), user.getStatus())) {
                 return ResultVO.fail(HttpStatusEnum.ACCOUNT_HALT.getMsg());
             }
+            //渠道更新和回传判断
+            agentService.userAgentUpdate(user, userData.getChannel());
             //返回登录信息
             return ResultVO.ok(this.createUserLoginVO(user, userData));
         }

+ 57 - 43
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/OrderPayServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zanxiang.game.module.base.pojo.enums.PayDeviceEnum;
 import com.zanxiang.game.module.mybatis.entity.Order;
 import com.zanxiang.game.module.mybatis.entity.OrderPayParam;
+import com.zanxiang.game.module.mybatis.entity.User;
 import com.zanxiang.game.module.sdk.enums.DeviceTypeEnum;
 import com.zanxiang.game.module.sdk.enums.OrderStateEnum;
 import com.zanxiang.game.module.sdk.enums.PayTypeEnum;
@@ -17,6 +18,7 @@ import com.zanxiang.game.module.sdk.service.*;
 import com.zanxiang.game.module.sdk.service.pay.PayBaseService;
 import com.zanxiang.game.module.sdk.util.SpringUtils;
 import com.zanxiang.module.util.JsonUtil;
+import com.zanxiang.module.util.bean.BeanUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import com.zanxiang.module.web.util.IpUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -53,6 +55,12 @@ public class OrderPayServiceImpl implements IOrderPayService {
     @Autowired
     private IPayApplicationService payApplicationService;
 
+    @Autowired
+    private IUserService userService;
+
+    @Value("${payConfig.wxPay.customH5Url}")
+    private String customH5Url;
+
     /**
      * 服务器域名
      */
@@ -60,56 +68,59 @@ public class OrderPayServiceImpl implements IOrderPayService {
     private String serverUrl;
 
     @Override
-    public PayParamVO getPayParam(String code, String orderId, HttpServletRequest request) {
-        Order order = orderService.getOne(new LambdaQueryWrapper<Order>()
-                .eq(Order::getOrderId, orderId));
-        log.error("获取订单支付参数, code : {}, orderId : {}", code, orderId);
-        if (order == null) {
-            throw new BaseException("参数错误, 订单信息不存在");
-        }
-        if (Objects.equals(order.getStatus(), OrderStateEnum.CANCEL_PAY.getCode())) {
-            throw new BaseException("订单已关闭, 请回到游戏重新下单");
-        }
-        if (Objects.equals(order.getStatus(), OrderStateEnum.SUCCESS_PAY.getCode())) {
-            throw new BaseException("订单已支付, 请勿重复支付");
-        }
+    public PayParamVO getPayParam(String code, String openId, String orderId, HttpServletRequest request) {
+        log.error("获取订单支付参数, code : {}, openId : {}, orderId : {}", code, openId, orderId);
+        Order order = this.orderFindAndCheck(orderId);
         OrderPayParam orderPayParam = orderPayParamService.getOne(new LambdaQueryWrapper<OrderPayParam>()
                 .eq(OrderPayParam::getOrderId, order.getOrderId()));
         if (orderPayParam != null) {
-            return PayParamVO.builder()
-                    .orderId(orderPayParam.getOrderId())
-                    .appId(orderPayParam.getAppId())
-                    .payParam(orderPayParam.getPayParam())
-                    .build();
+            return BeanUtil.copy(orderPayParam, PayParamVO.class);
         }
         //创建支付参数
-        ProductPayParamDTO bo = ProductPayParamDTO.builder()
-                .gameId(order.getGameId())
-                .userId(order.getUserId())
-                .payDevice(order.getPayDeviceId())
-                .deviceSystem(order.getDeviceSystem())
-                .spbillCreateIp(IpUtil.getRealIp(request))
-                .outTradeNo(order.getOrderId())
-                .payWay(order.getPayWayId())
-                .code(code)
-                .build();
+        ProductPayParamDTO productPayParamDTO = this.transform(order, code, openId, IpUtil.getRealIp(request));
         //调起支付
-        PayTypeEnum payTypeEnum = PayTypeEnum.getByPayType(bo.getPayWay().intValue());
+        PayTypeEnum payTypeEnum = PayTypeEnum.getByPayType(productPayParamDTO.getPayWay().intValue());
         PayBaseService service = SpringUtils.getBean(payTypeEnum.getClazz());
-        service.payCreate(bo);
+        service.payCreate(productPayParamDTO);
         //重新查询
         orderPayParam = orderPayParamService.getOne(new LambdaQueryWrapper<OrderPayParam>()
                 .eq(OrderPayParam::getOrderId, order.getOrderId()));
         if (orderPayParam == null) {
+            log.error("支付参数获取失败, orderId : {}", orderId);
             throw new BaseException("支付参数获取失败");
         }
-        return PayParamVO.builder()
-                .orderId(orderPayParam.getOrderId())
-                .appId(orderPayParam.getAppId())
-                .payParam(orderPayParam.getPayParam())
+        //返回支付参数
+        return BeanUtil.copy(orderPayParam, PayParamVO.class);
+    }
+
+    private ProductPayParamDTO transform(Order order, String code, String openId, String ip) {
+        return ProductPayParamDTO.builder()
+                .gameId(order.getGameId())
+                .userId(order.getUserId())
+                .payDevice(order.getPayDeviceId())
+                .deviceSystem(order.getDeviceSystem())
+                .spbillCreateIp(ip)
+                .outTradeNo(order.getOrderId())
+                .payWay(order.getPayWayId())
+                .code(code)
+                .openId(openId)
                 .build();
     }
 
+    private Order orderFindAndCheck(String orderId) {
+        Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderId, orderId));
+        if (order == null) {
+            throw new BaseException("参数错误, 订单信息不存在");
+        }
+        if (Objects.equals(order.getStatus(), OrderStateEnum.CANCEL_PAY.getCode())) {
+            throw new BaseException("订单已关闭, 请回到游戏重新下单");
+        }
+        if (Objects.equals(order.getStatus(), OrderStateEnum.SUCCESS_PAY.getCode())) {
+            throw new BaseException("订单已支付, 请勿重复支付");
+        }
+        return order;
+    }
+
     @Override
     public Long getAppletPayDevice(UserData userData) {
         log.error("获取支付类型参数, 请求信息 userData : {}", JsonUtil.toString(userData));
@@ -147,26 +158,29 @@ public class OrderPayServiceImpl implements IOrderPayService {
 
     @Override
     public Map<String, Object> payCreate(ProductPayParam product, UserData userData) {
+        //用户信息
+        User user = userService.getById(userData.getUserId());
+        if (user == null) {
+            throw new BaseException("参数错误, 用户信息不存在");
+        }
         //创建订单
-        orderService.createOrder(product, userData);
+        orderService.createOrder(product, user, userData);
         //判断游戏类型
-        if (Objects.equals(PayDeviceEnum.APPLET_PAY.getPayDeviceId(), product.getPayDevice())
-                || Objects.equals(PayDeviceEnum.CUSTOM_PAY.getPayDeviceId(), product.getPayDevice())) {
+        if (PayDeviceEnum.getByPayWayIdList().contains(product.getPayDevice())) {
             //查询支付配置
             GamePayWayDTO gamePayWayDTO = gamePayWayService.getGamePayWay(userData.getGameId(), product.getPayWay(), product.getPayDevice());
             //查询支付应用信息
             PayApplicationDTO payApplicationDTO = payApplicationService.getPayApplicationByPayBoxId(gamePayWayDTO.getPayBoxId());
             //构造参数信息
-            Map<String, Object> paramMap = new HashMap<>(4);
+            Map<String, Object> paramMap = new HashMap<>(8);
             paramMap.put("appId", payApplicationDTO.getAppId());
             paramMap.put("path", payApplicationDTO.getPath());
             paramMap.put("orderId", product.getOrderId());
             paramMap.put("amount", product.getAmount());
-            if (this.serverUrl.contains("84game")) {
-                paramMap.put("serverUrl", this.serverUrl + "/sdk");
-            } else {
-                paramMap.put("serverUrl", this.serverUrl + "/api/sdk");
-            }
+            paramMap.put("payH5Url", this.customH5Url);
+            paramMap.put("openId", user.getOpenId());
+            paramMap.put("description", "购买" + product.getAmount() + "元档充值");
+            paramMap.put("serverUrl", this.serverUrl.contains("84game") ? this.serverUrl + "/sdk" : this.serverUrl + "/api/sdk");
             log.error("下单参数返回, paramMap : {}", JsonUtil.toString(paramMap));
             return paramMap;
         }

+ 8 - 21
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/OrderServiceImpl.java

@@ -9,6 +9,7 @@ import com.zanxiang.game.module.sdk.pojo.dto.PlatformOrderDTO;
 import com.zanxiang.game.module.sdk.pojo.param.ProductPayParam;
 import com.zanxiang.game.module.sdk.pojo.param.UserData;
 import com.zanxiang.game.module.sdk.service.*;
+import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.module.util.bean.BeanUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import lombok.extern.slf4j.Slf4j;
@@ -33,9 +34,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Autowired
     private IGameService gameService;
 
-    @Autowired
-    private IUserService userService;
-
     @Autowired
     private IGameUserService gameUserService;
 
@@ -50,34 +48,23 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 
     @Override
     @Transactional(rollbackFor = {Exception.class, RuntimeException.class})
-    public Boolean createOrder(ProductPayParam payParam, UserData userData) {
-        //用户id
-        Long userId = userData.getUserId();
+    public Boolean createOrder(ProductPayParam payParam, User user, UserData userData) {
         //游戏id
         Long gameId = userData.getGameId();
         //游戏信息
-        Game game = gameService.getById(userData.getGameId());
-        if (game == null) {
-            throw new BaseException("参数错误, 游戏信息不存在");
-        }
-        //用户信息
-        User user = userService.getById(userId);
-        if (user == null) {
-            throw new BaseException("参数错误, 用户信息不存在");
-        }
+        Game game = gameService.getById(gameId);
         //玩家信息
         GameUser gameUser = gameUserService.getOne(new LambdaQueryWrapper<GameUser>()
                 .eq(GameUser::getUserId, userData.getUserId()));
-        if (gameUser == null) {
-            throw new BaseException("参数错误, 玩家信息不存在");
-        }
         //角色信息
         GameUserRole gameUserRole = gameUserRoleService.getOne(new LambdaQueryWrapper<GameUserRole>()
-                .eq(GameUserRole::getGameId, userData.getGameId())
+                .eq(GameUserRole::getGameId, gameId)
                 .eq(GameUserRole::getUserId, userData.getUserId())
                 .eq(GameUserRole::getRoleId, payParam.getRoleId()));
-        if (gameUserRole == null) {
-            throw new BaseException("参数错误, 角色信息不存在");
+        if (game == null || gameUser == null || gameUserRole == null) {
+            log.error("游戏用户信息不全, game : {}, gameUser : {}, gameUserRole : {}", JsonUtil.toString(game),
+                    JsonUtil.toString(gameUser), JsonUtil.toString(gameUserRole));
+            throw new BaseException("参数错误, 游戏用户信息不全");
         }
         //游戏支付配置信息
         GamePayWayDTO gamePayWayDTO = gamePayWayService.getGamePayWay(gameId, payParam.getPayWay(), payParam.getPayDevice());

+ 1 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/pay/AliPayService.java

@@ -126,6 +126,7 @@ public class AliPayService extends PayBaseService {
         orderService.update(new LambdaUpdateWrapper<Order>()
                 .set(Order::getMerchantNo, payMerchant.getMerchantNo())
                 .eq(Order::getOrderId, product.getOutTradeNo()));
+        log.error("返回支付参数 resultMap : {}", JsonUtil.toString(resultMap));
         //返回结果
         return resultMap;
     }

+ 1 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/pay/PayBaseService.java

@@ -85,7 +85,7 @@ public abstract class PayBaseService {
             this.attach = attachBO;
             return this.create(product, gamePayWayDTO);
         } catch (Exception e) {
-            log.info("订单支付参数生成异常, ProductPayParamBO : {} , e: {}", JsonUtil.toString(product), e);
+            log.error("订单支付参数生成异常, ProductPayParamBO : {} , e: {}", JsonUtil.toString(product), e.getMessage());
             throw new BaseException("订单支付参数生成异常");
         }
     }

+ 17 - 7
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/pay/WxPayService.java

@@ -118,6 +118,7 @@ public class WxPayService extends PayBaseService {
                 break;
             case 4:
             case 6:
+            case 7:
                 //小程序
                 resultMap = this.miniAppPay(product);
                 break;
@@ -132,6 +133,7 @@ public class WxPayService extends PayBaseService {
                 .set(Order::getStatus, OrderStateEnum.WAIT_PAY.getCode())
                 .eq(Order::getOrderId, product.getOutTradeNo()));
         //返回支付参数
+        log.error("返回支付参数 resultMap : {}", JsonUtil.toString(resultMap));
         return resultMap;
     }
 
@@ -239,11 +241,19 @@ public class WxPayService extends PayBaseService {
 
     private Map<String, Object> miniAppPay(ProductPayParamDTO product) {
         try {
-            //获取用户openId
-            String openId = wxApiService.getOpenIdByType(product.getCode(), config.getAppId(), config.getAppSecret(),
-                    config.getAppletType()).get("openid");
+            //用户openId
+            String openId = product.getOpenId();
+            //传了code, 自己获取openId
+            if (Strings.isBlank(openId) && Strings.isNotBlank(product.getCode())) {
+                openId = wxApiService.getOpenIdByType(product.getCode(), config.getAppId(), config.getAppSecret(),
+                        config.getAppletType()).get("openid");
+            }
             //下单
             Map<String, String> successMap = this.unifiedOrder(product, WX_PAY_JSAPI, openId);
+
+
+            log.error("-------------- 1111 --------------> ");
+
             // 支付参数
             String prepayId = successMap.get("prepay_id");
             // 随机字符串
@@ -260,7 +270,8 @@ public class WxPayService extends PayBaseService {
             // 再次签名sign,这个签名用于小程序端调用支付方法
             String sign = WxPayUtil.generateSignature(map, config.getApiKey());
             //组装支付参数
-            Map<String, Object> payParamMap = new HashMap<>(5);
+            Map<String, Object> payParamMap = new HashMap<>(6);
+            payParamMap.put("appId", config.getAppId());
             payParamMap.put("paySign", sign);
             payParamMap.put("signType", config.getSignType());
             payParamMap.put("timeStamp", createTime);
@@ -363,9 +374,8 @@ public class WxPayService extends PayBaseService {
         PayMerchantDTO payMerchantDTO;
         //支付应用信息
         PayApplicationDTO payApplicationDTO;
-        //小程序支付和客服支付, 关联了盒子
-        if (Objects.equals(PayDeviceEnum.APPLET_PAY.getPayDeviceId(), gamePayWayDTO.getPayDeviceId())
-                || Objects.equals(PayDeviceEnum.CUSTOM_PAY.getPayDeviceId(), gamePayWayDTO.getPayDeviceId())) {
+        //小程序支付, 客服支付, 公众号支付, 关联了盒子
+        if (PayDeviceEnum.getByPayWayIdList().contains(gamePayWayDTO.getPayDeviceId())) {
             payMerchantDTO = payBoxService.getMerchantByBoxId(gamePayWayDTO.getPayBoxId());
             payApplicationDTO = payApplicationService.getPayApplicationByPayBoxId(gamePayWayDTO.getPayBoxId());
         } else {