|
@@ -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();
|
|
|
+ }
|
|
|
}
|