Selaa lähdekoodia

feat : 接口修改提交

bilingfeng 2 vuotta sitten
vanhempi
commit
b2ef60880c

+ 44 - 0
game-module/game-common/src/main/java/com/zanxiang/common/enums/CategoryTypeEnum.java

@@ -0,0 +1,44 @@
+package com.zanxiang.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author : lingfeng
+ * @time : 2022-07-13
+ * @description : 游戏应用类型
+ */
+@Getter
+@AllArgsConstructor
+public enum CategoryTypeEnum {
+
+    /**
+     * 微信小游戏
+     */
+    CATEGORY_TYPE_WX(1L, "微信小游戏"),
+
+    /**
+     * 抖音小游戏
+     */
+    CATEGORY_TYPE_DY(2L, "抖音小游戏"),
+
+    /**
+     * h5游戏
+     */
+    CATEGORY_TYPE_H5(3L, "h5游戏"),
+
+    /**
+     * app游戏
+     */
+    CATEGORY_TYPE_APP(4L, "app游戏");
+
+    /**
+     * 设备类型
+     */
+    private Long categoryType;
+
+    /**
+     * 描述
+     */
+    private String name;
+}

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

@@ -53,7 +53,7 @@ public class GameCategoryController {
         return ResultVo.ok(gameCategoryService.addOrUpdate(param));
     }
 
-    @ApiOperation(value = "cp新增或者更新")
+    @ApiOperation(value = "游戏标签分类删除")
     @DeleteMapping(value = "/delete/by/id")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
     public ResultVo<Boolean> deleteById(@RequestParam Long id) {

+ 37 - 7
game-module/game-manage/src/main/java/com/zanxiang/manage/domain/dto/GameDTO.java

@@ -43,9 +43,14 @@ public class GameDTO {
     private Long category;
 
     /**
-     * 游戏类别
+     * 游戏分类id, 多个
      */
-    private Integer classify;
+    private String classify;
+
+    /**
+     * 游戏分类父id, 多个
+     */
+    private String classifyParent;
 
     /**
      * 网页游戏图标,200*200
@@ -70,7 +75,7 @@ public class GameDTO {
     /**
      * 上线状态1 接入中, 2 可上线, 3 已下线
      */
-    private Boolean status;
+    private Integer status;
 
     /**
      * 1在线游戏 2 单机
@@ -108,9 +113,9 @@ public class GameDTO {
     private String appleId;
 
     /**
-     * 是否需要强制实名认证,1为 关闭实名认证,2为 强制实名认证  3  开启实名认证
+     * 是否需要实名认证,1:关闭实名认证,2:强制实名认证  3:开启实名认证
      */
-    private Byte isAuth;
+    private Integer needAuth;
 
     /**
      * 扩展 JSON格式
@@ -133,9 +138,34 @@ public class GameDTO {
     private LocalDateTime deleteTime;
 
     /**
-     * 渠道
+     * 分成比例
+     */
+    private Double shareScale;
+
+    /**
+     * 关联H5游戏id
+     */
+    private Long h5GameId;
+
+    /**
+     * 导量游戏id
+     */
+    private Long guideGameId;
+
+    /**
+     * 游戏地址
+     */
+    private String gameUrl;
+
+    /**
+     * 游戏版本
+     */
+    private String version;
+
+    /**
+     * 下载次数
      */
-    private Long channel;
+    private Long downloadCount;
 
     /**
      * 创建时间

+ 26 - 0
game-module/game-manage/src/main/java/com/zanxiang/manage/domain/params/GamePictureParam.java

@@ -97,4 +97,30 @@ public class GamePictureParam {
      */
     @ApiModelProperty(notes = "分享图")
     private String shareImg;
+
+    /**
+     * h5游戏图片
+     */
+    @ApiModelProperty(notes = "h5游戏图片")
+    private String gamePictureImg;
+
+    /**
+     * h5游戏登录背景图
+     */
+    @ApiModelProperty(notes = "h5游戏登录背景图")
+    private String loginBackGroundImg;
+
+    /**
+     * 是否需要实名认证,1:关闭实名认证,2:强制实名认证  3:开启实名认证
+     */
+    @ApiModelProperty(notes = "是否需要实名认证,1:关闭实名认证,2:强制实名认证  3:开启实名认证")
+    private Integer needAuth;
+
+    /**
+     * h5游戏下载次数
+     */
+    @ApiModelProperty(notes = "h5游戏下载次数")
+    private Long downloadCount;
+
+
 }

+ 24 - 0
game-module/game-manage/src/main/java/com/zanxiang/manage/domain/vo/GamePictureVO.java

@@ -94,4 +94,28 @@ public class GamePictureVO {
      */
     @ApiModelProperty(notes = "分享图")
     private String shareImg;
+
+    /**
+     * h5游戏图片
+     */
+    @ApiModelProperty(notes = "h5游戏图片")
+    private String gamePictureImg;
+
+    /**
+     * h5游戏登录背景图
+     */
+    @ApiModelProperty(notes = "h5游戏登录背景图")
+    private String loginBackGroundImg;
+
+    /**
+     * 是否需要实名认证,1:关闭实名认证,2:强制实名认证  3:开启实名认证
+     */
+    @ApiModelProperty(notes = "是否需要实名认证,1:关闭实名认证,2:强制实名认证  3:开启实名认证")
+    private Integer needAuth;
+
+    /**
+     * h5游戏下载次数
+     */
+    @ApiModelProperty(notes = "h5游戏下载次数")
+    private Long downloadCount;
 }

+ 73 - 1
game-module/game-manage/src/main/java/com/zanxiang/manage/service/Impl/GamePictureServiceImpl.java

@@ -1,17 +1,25 @@
 package com.zanxiang.manage.service.Impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zanxiang.common.enums.CategoryTypeEnum;
 import com.zanxiang.common.utils.bean.BeanUtils;
+import com.zanxiang.manage.domain.dto.GameDTO;
 import com.zanxiang.manage.domain.params.GamePictureParam;
 import com.zanxiang.manage.domain.vo.GamePictureVO;
 import com.zanxiang.manage.service.GamePictureService;
+import com.zanxiang.manage.service.GameService;
+import com.zanxiang.mybatis.entity.Game;
 import com.zanxiang.mybatis.entity.GamePicture;
 import com.zanxiang.mybatis.mapper.GamePictureMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
+import java.util.Objects;
 
 /**
  * @author : lingfeng
@@ -22,6 +30,9 @@ import java.time.LocalDateTime;
 @Service
 public class GamePictureServiceImpl extends ServiceImpl<GamePictureMapper, GamePicture> implements GamePictureService {
 
+    @Autowired
+    private GameService gameService;
+
     /**
      * 根据游戏id查询
      *
@@ -34,7 +45,11 @@ public class GamePictureServiceImpl extends ServiceImpl<GamePictureMapper, GameP
         if (gamePicture == null) {
             gamePicture = GamePicture.builder().gameId(gameId).build();
         }
-        return BeanUtils.copy(gamePicture, GamePictureVO.class);
+        GamePictureVO gamePictureVO = BeanUtils.copy(gamePicture, GamePictureVO.class);
+        GameDTO gameDTO = gameService.getById(gameId);
+        gamePictureVO.setNeedAuth(gameDTO.getNeedAuth());
+        gamePictureVO.setDownloadCount(gameDTO.getDownloadCount());
+        return gamePictureVO;
     }
 
     /**
@@ -45,6 +60,63 @@ public class GamePictureServiceImpl extends ServiceImpl<GamePictureMapper, GameP
      */
     @Override
     public Boolean addOrUpdate(GamePictureParam param) {
+        GameDTO gameDTO = gameService.getById(param.getGameId());
+        //微信小游戏更新
+        if (Objects.equals(gameDTO.getCategory(), CategoryTypeEnum.CATEGORY_TYPE_WX.getCategoryType())) {
+            return this.appletGameAddOrUpdate(param);
+        }
+        //h5游戏更新
+        if (Objects.equals(gameDTO.getCategory(), CategoryTypeEnum.CATEGORY_TYPE_H5.getCategoryType())) {
+            return this.h5GameAddOrUpdate(param);
+        }
+        return Boolean.FALSE;
+    }
+
+    /**
+     * 微信小游戏图片添加或更新
+     *
+     * @param param : 游戏图片参数
+     * @return : 返回更新结果
+     */
+    @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
+    public Boolean h5GameAddOrUpdate(GamePictureParam param) {
+        Long gameId = param.getGameId();
+        GamePicture gamePicture = super.getOne(new LambdaQueryWrapper<GamePicture>().eq(GamePicture::getGameId, gameId));
+        if (gamePicture == null) {
+            gamePicture = GamePicture.builder()
+                    .gameId(gameId)
+                    .avatarImg(param.getAvatarImg())
+                    .gamePictureImg(param.getGamePictureImg())
+                    .loginBackGroundImg(param.getLoginBackGroundImg())
+                    .createTime(LocalDateTime.now())
+                    .updateTime(LocalDateTime.now())
+                    .build();
+        } else {
+            gamePicture.setAvatarImg(param.getAvatarImg());
+            gamePicture.setGamePictureImg(param.getGamePictureImg());
+            gamePicture.setLoginBackGroundImg(param.getLoginBackGroundImg());
+            gamePicture.setUpdateTime(LocalDateTime.now());
+        }
+        //游戏图片信息更新
+        super.saveOrUpdate(gamePicture);
+        //游戏信息更新
+        if (param.getNeedAuth() != null || param.getDownloadCount() != null) {
+            gameService.update(new LambdaUpdateWrapper<Game>()
+                    .set(Game::getNeedAuth, param.getNeedAuth())
+                    .set(Game::getDownloadCount, param.getDownloadCount())
+                    .set(Game::getUpdateTime, LocalDateTime.now())
+                    .eq(Game::getId, gameId));
+        }
+        return Boolean.TRUE;
+    }
+
+    /**
+     * 微信小游戏图片添加或更新
+     *
+     * @param param : 游戏图片参数
+     * @return : 返回更新结果
+     */
+    private Boolean appletGameAddOrUpdate(GamePictureParam param) {
         Long gameId = param.getGameId();
         GamePicture gamePicture = super.getOne(new LambdaQueryWrapper<GamePicture>().eq(GamePicture::getGameId, gameId));
         if (gamePicture == null) {

+ 7 - 2
game-module/game-mybatis/src/main/java/com/zanxiang/mybatis/entity/Game.java

@@ -123,9 +123,9 @@ public class Game {
     private String appleId;
 
     /**
-     * 是否需要强制实名认证,1为 关闭实名认证,2为 强制实名认证  3  开启实名认证
+     * 是否需要实名认证,1:关闭实名认证,2:强制实名认证  3:开启实名认证
      */
-    private Byte isAuth;
+    private Integer needAuth;
 
     /**
      * 扩展 JSON格式
@@ -173,6 +173,11 @@ public class Game {
      */
     private String version;
 
+    /**
+     * 下载次数
+     */
+    private Long downloadCount;
+
     /**
      * 创建时间
      */

+ 10 - 0
game-module/game-mybatis/src/main/java/com/zanxiang/mybatis/entity/GamePicture.java

@@ -91,6 +91,16 @@ public class GamePicture {
      */
     private String shareImg;
 
+    /**
+     * h5游戏图片
+     */
+    private String gamePictureImg;
+
+    /**
+     * h5游戏登录背景图
+     */
+    private String loginBackGroundImg;
+
     /**
      * 创建时间
      */

+ 2 - 4
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/GameStrategyService.java

@@ -2,9 +2,6 @@ package com.zanxiang.sdk.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zanxiang.mybatis.entity.GameStrategy;
-import com.zanxiang.sdk.domain.bo.PlatformOrderBO;
-import com.zanxiang.sdk.domain.params.PreOrderParam;
-import com.zanxiang.sdk.domain.params.UserData;
 
 /**
  * 游戏策略 服务类接口
@@ -13,5 +10,6 @@ import com.zanxiang.sdk.domain.params.UserData;
  * @date 2022-07-01 11:38
  */
 public interface GameStrategyService extends IService<GameStrategy> {
-    Boolean paySwitch(UserData user, PlatformOrderBO orderBo);
+
+//    Boolean paySwitch(UserData user, PlatformOrderBO orderBo);
 }