Kaynağa Gözat

fix : 接口修改

bilingfeng 1 yıl önce
ebeveyn
işleme
80501d97c8

+ 12 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/vo/GameAppletVO.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 GameAppletVO {
 
     /**
@@ -17,4 +23,10 @@ public class GameAppletVO {
     @ApiModelProperty(notes = "微信小游戏appId")
     private String appId;
 
+    /**
+     * 是否投放
+     */
+    @ApiModelProperty(notes = "是否投放")
+    private Boolean isPut;
+
 }

+ 9 - 4
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameAppletServiceImpl.java

@@ -3,6 +3,7 @@ package com.zanxiang.game.module.sdk.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 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.Order;
 import com.zanxiang.game.module.mybatis.mapper.GameAppletMapper;
@@ -57,6 +58,9 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
     @Autowired
     private IPayApplicationService payApplicationService;
 
+    @Autowired
+    private IGameService gameService;
+
     @Value("${payConfig.wxPay.customH5Url}")
     private String customH5Url;
 
@@ -183,9 +187,10 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
     public GameAppletVO gameAppletInit(UserData userData) {
         GameApplet gameApplet = super.getOne(new LambdaQueryWrapper<GameApplet>()
                 .eq(GameApplet::getGameId, userData.getGameId()));
-        if (gameApplet == null) {
-            throw new BaseException("参数错误, 游戏小程序信息不存在");
-        }
-        return BeanUtil.copy(gameApplet, GameAppletVO.class);
+        Game game = gameService.getById(userData.getGameId());
+        return GameAppletVO.builder()
+                .appId(gameApplet == null ? null : gameApplet.getAppId())
+                .isPut(game.getParentId() == null)
+                .build();
     }
 }