Ver Fonte

fix : sdk游戏代码修改

bilingfeng há 1 ano atrás
pai
commit
d505b4a6f2

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

@@ -1,71 +0,0 @@
-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;
-import java.time.LocalDateTime;
-
-/**
- * @author : lingfeng
- * @time : 2022-07-12
- * @description : 游戏图片
- */
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@ToString
-@Builder
-@TableName("t_game_picture")
-public class GamePicture implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 主键
-     */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 游戏id
-     */
-    private Long gameId;
-
-    /**
-     * 游戏头像
-     */
-    private String avatarImg;
-
-    /**
-     * 小程序码图片
-     */
-    private String appletImg;
-
-    /**
-     * 分享标题
-     */
-    private String shareTitle;
-
-    /**
-     * 分享路径
-     */
-    private String sharePath;
-
-    /**
-     * 分享图片
-     */
-    private String shareImg;
-
-    /**
-     * 创建时间
-     */
-    private LocalDateTime createTime;
-
-    /**
-     * 更新时间
-     */
-    private LocalDateTime updateTime;
-}

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

@@ -131,6 +131,11 @@ public class User implements Serializable {
      */
     private String deviceSystem;
 
+    /**
+     * 渠道参数
+     */
+    private String channel;
+
     /**
      * 用户注册ip
      */

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

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

+ 15 - 3
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/dto/GameAppletDTO.java

@@ -1,7 +1,5 @@
 package com.zanxiang.game.module.sdk.pojo.dto;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.zanxiang.module.util.JsonUtil;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -23,7 +21,6 @@ public class GameAppletDTO {
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
     /**
@@ -66,6 +63,21 @@ public class GameAppletDTO {
      */
     private String msgConfig;
 
+    /**
+     * 分享标题
+     */
+    private String shareTitle;
+
+    /**
+     * 分享路径
+     */
+    private String sharePath;
+
+    /**
+     * 分享图片
+     */
+    private String shareImg;
+
     /**
      * 获取米大师支付配置Bean
      *

+ 0 - 21
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IGamePictureService.java

@@ -1,21 +0,0 @@
-package com.zanxiang.game.module.sdk.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zanxiang.game.module.mybatis.entity.GamePicture;
-import com.zanxiang.game.module.sdk.pojo.dto.GamePictureDTO;
-
-/**
- * @author : lingfeng
- * @time : 2022-07-12
- * @description : 游戏图片
- */
-public interface IGamePictureService extends IService<GamePicture> {
-
-    /**
-     * 通过游戏id
-     *
-     * @param gameId 游戏id
-     * @return {@link GamePictureDTO}
-     */
-    GamePictureDTO getByGameId(Long gameId);
-}

+ 0 - 33
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GamePictureServiceImpl.java

@@ -1,33 +0,0 @@
-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.mybatis.entity.GamePicture;
-import com.zanxiang.game.module.mybatis.mapper.GamePictureMapper;
-import com.zanxiang.game.module.sdk.pojo.dto.GamePictureDTO;
-import com.zanxiang.game.module.sdk.service.IGamePictureService;
-import com.zanxiang.module.util.bean.BeanUtil;
-import com.zanxiang.module.util.exception.BaseException;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-/**
- * @author : lingfeng
- * @time : 2022-07-12
- * @description : 游戏图片
- */
-@Slf4j
-@Service
-public class GamePictureServiceImpl extends ServiceImpl<GamePictureMapper, GamePicture> implements IGamePictureService {
-
-    @Override
-    public GamePictureDTO getByGameId(Long gameId) {
-        GamePicture gamePicture = super.getOne(new LambdaQueryWrapper<GamePicture>()
-                .eq(GamePicture::getGameId, gameId));
-        if (gamePicture == null) {
-            log.error("参数错误, 游戏图片信息不存在, gameId : {}", gameId);
-            throw new BaseException("参数错误, 游戏图片信息不存在");
-        }
-        return BeanUtil.copy(gamePicture, GamePictureDTO.class);
-    }
-}

+ 1 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/LoginServiceImpl.java

@@ -220,6 +220,7 @@ public class LoginServiceImpl implements IRegisterLoginService {
         user.setMobile(mobile);
         user.setOpenId(openId);
         user.setSessionKey(sessionKey);
+        user.setChannel(userData.getChannel());
         userService.save(user);
         gameUserService.createGameUser(user);
         callBackService.userCallBack(user, tuple2);

+ 7 - 7
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/UserShareServiceImpl.java

@@ -3,10 +3,10 @@ package com.zanxiang.game.module.sdk.service.impl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.game.module.mybatis.entity.UserShare;
 import com.zanxiang.game.module.mybatis.mapper.UserShareMapper;
-import com.zanxiang.game.module.sdk.pojo.dto.GamePictureDTO;
+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.GameShareVO;
-import com.zanxiang.game.module.sdk.service.IGamePictureService;
+import com.zanxiang.game.module.sdk.service.IGameAppletService;
 import com.zanxiang.game.module.sdk.service.IUserShareService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,18 +22,18 @@ import org.springframework.stereotype.Service;
 public class UserShareServiceImpl extends ServiceImpl<UserShareMapper, UserShare> implements IUserShareService {
 
     @Autowired
-    private IGamePictureService gamePictureService;
+    private IGameAppletService gameAppletService;
 
     @Override
     public GameShareVO getGameShare(UserData userData) {
-        GamePictureDTO gamePictureDTO = gamePictureService.getByGameId(userData.getGameId());
-        String path = gamePictureDTO.getSharePath();
+        GameAppletDTO gameAppletDTO = gameAppletService.getByGameId(userData.getGameId());
+        String path = gameAppletDTO.getSharePath();
         if (userData.getUserId() != null) {
             path = path + "?shareUserId=" + userData.getUserId();
         }
         return GameShareVO.builder()
-                .title(gamePictureDTO.getShareTitle())
-                .shareImg(gamePictureDTO.getShareImg())
+                .title(gameAppletDTO.getShareTitle())
+                .shareImg(gameAppletDTO.getShareImg())
                 .path(path)
                 .build();
     }