Przeglądaj źródła

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

zhimo 1 rok temu
rodzic
commit
8151cc90d1

+ 56 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/enums/GameActionSetEnum.java

@@ -0,0 +1,56 @@
+package com.zanxiang.game.module.manage.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Objects;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-07-05
+ * @description : 游戏数据源
+ */
+@Getter
+@AllArgsConstructor
+public enum GameActionSetEnum {
+
+    /**
+     * 小游戏
+     */
+    WECHAT_MINI_GAME("WECHAT_MINI_GAME", 1),
+
+    /**
+     * 公众号
+     */
+    WECHAT("WECHAT", 2),
+
+    /**
+     * 小程序
+     */
+    WECHAT_MINI_PROGRAM("WECHAT_MINI_PROGRAM", 3);
+
+    /**
+     * 数据源类型
+     */
+    private String value;
+
+    /**
+     * 游戏应用类型
+     */
+    private int type;
+
+    /**
+     * 获取游戏动作设置
+     *
+     * @param type 类型
+     * @return {@link String}
+     */
+    public static String getGameActionSet(int type) {
+        for (GameActionSetEnum gameActionSetEnum : GameActionSetEnum.values()) {
+            if (Objects.equals(gameActionSetEnum.getType(), type)) {
+                return gameActionSetEnum.getValue();
+            }
+        }
+        return null;
+    }
+}

+ 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;
 
     /**

+ 11 - 4
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAppletServiceImpl.java

@@ -10,6 +10,7 @@ import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetRpc;
 import com.zanxiang.game.module.base.pojo.enums.DeleteEnum;
 import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
 import com.zanxiang.game.module.base.pojo.enums.StatusEnum;
+import com.zanxiang.game.module.manage.enums.GameActionSetEnum;
 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;
@@ -62,7 +63,8 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
                 .eq(GameApplet::getGameId, game.getId())
         );
         if (gameApplet == null) {
-            this.createActionSet(game.getCategory(), game.getIsPut(), gameAppletConfigDTO.getAppId(), game.getName());
+            this.createActionSet(game.getCategory(), game.getIsPut(), gameAppletConfigDTO.getAppId(),
+                    game.getName(), gameAppletConfigDTO.getType());
             gameApplet = GameApplet.builder()
                     .gameId(game.getId())
                     .appId(gameAppletConfigDTO.getAppId())
@@ -107,12 +109,17 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
                     JsonUtil.toString(gameDTO), JsonUtil.toString(gameAppletDTO));
             return Boolean.FALSE;
         }
-        return this.createActionSet(gameDTO.getCategory(), gameDTO.getIsPut(), gameAppletDTO.getAppId(), gameDTO.getName());
+        return this.createActionSet(gameDTO.getCategory(), gameDTO.getIsPut(), gameAppletDTO.getAppId(),
+                gameDTO.getName(), gameAppletDTO.getType());
     }
 
-    private Boolean createActionSet(Long gameCategory, Boolean isPut, String appId, String gameName) {
+    private Boolean createActionSet(Long gameCategory, Boolean isPut, String appId, String gameName, Integer type) {
         CreateUserActionSetRpcDTO actionSetRpcDTO = CreateUserActionSetRpcDTO.builder()
-                .appId(appId).name(gameName + "数据源").build();
+                .appId(appId)
+                .type(GameActionSetEnum.getGameActionSet(type))
+                .name(gameName + "数据源")
+                .wechatAppId(appId)
+                .build();
         //小游戏和H5的类型才需要创建数据源
         List<Long> categoryList = Arrays.asList(GameCategoryEnum.CATEGORY_WX_APPLET.getId(), GameCategoryEnum.CATEGORY_H5.getId());
         //投放的游戏才需要设置数据源

+ 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;