|
@@ -1,8 +1,10 @@
|
|
|
package com.zanxiang.game.module.sdk.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.zanxiang.game.module.base.pojo.enums.GameCategoryEnum;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.OsEnum;
|
|
|
import com.zanxiang.game.module.base.pojo.enums.PayDeviceEnum;
|
|
|
+import com.zanxiang.game.module.mybatis.entity.Game;
|
|
|
import com.zanxiang.game.module.mybatis.entity.Order;
|
|
|
import com.zanxiang.game.module.mybatis.entity.OrderPayParam;
|
|
|
import com.zanxiang.game.module.mybatis.entity.User;
|
|
@@ -16,7 +18,9 @@ import com.zanxiang.game.module.sdk.pojo.dto.ProductPayParamDTO;
|
|
|
import com.zanxiang.game.module.sdk.pojo.param.ProductPayParam;
|
|
|
import com.zanxiang.game.module.sdk.pojo.param.UserData;
|
|
|
import com.zanxiang.game.module.sdk.pojo.vo.PayParamVO;
|
|
|
+import com.zanxiang.game.module.sdk.pojo.vo.SessionCheckVO;
|
|
|
import com.zanxiang.game.module.sdk.service.*;
|
|
|
+import com.zanxiang.game.module.sdk.service.api.WxApiService;
|
|
|
import com.zanxiang.game.module.sdk.service.pay.PayBaseService;
|
|
|
import com.zanxiang.game.module.sdk.util.RedisUtil;
|
|
|
import com.zanxiang.game.module.sdk.util.SpringUtils;
|
|
@@ -66,6 +70,12 @@ public class OrderPayServiceImpl implements IOrderPayService {
|
|
|
@Autowired
|
|
|
private RedisUtil<String> redisUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGameService gameService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WxApiService wxApiService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IDistributedLockComponent distributedLockComponent;
|
|
|
|
|
@@ -246,4 +256,24 @@ public class OrderPayServiceImpl implements IOrderPayService {
|
|
|
}
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public SessionCheckVO sessionCheck(UserData userData) {
|
|
|
+ User user = userService.getById(userData.getUserId());
|
|
|
+ Game game = gameService.getById(userData.getGameId());
|
|
|
+ //默认结果
|
|
|
+ boolean result = Boolean.FALSE;
|
|
|
+ //限制微信小游戏
|
|
|
+ if (Objects.equals(game.getCategory(), GameCategoryEnum.CATEGORY_WX_APPLET.getId())) {
|
|
|
+ //限制安卓端或者PC端
|
|
|
+ if (Objects.equals(userData.getDeviceSystem(), OsEnum.SYSTEM_ANDROID.getOs())
|
|
|
+ || Objects.equals(userData.getDeviceSystem(), OsEnum.SYSTEM_WINDOW.getOs())) {
|
|
|
+ result = wxApiService.checkSessionKey(userData.getGameId(), user.getOpenId(), user.getSessionKey());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return SessionCheckVO.builder()
|
|
|
+ .reLogin(result)
|
|
|
+ .msg(result ? "点击右上角\"·●·\"形状的三个点,在弹出的页面下拉找到“重新进入小程序”" : null)
|
|
|
+ .build();
|
|
|
+ }
|
|
|
}
|