|
|
@@ -17,6 +17,7 @@ import com.zanxiang.game.module.sdk.constant.RedisKeyConstant;
|
|
|
import com.zanxiang.game.module.sdk.enums.ExpireTimeEnum;
|
|
|
import com.zanxiang.game.module.sdk.enums.LoginTypeEnum;
|
|
|
import com.zanxiang.game.module.sdk.enums.TokenCheckEnum;
|
|
|
+import com.zanxiang.game.module.sdk.pojo.dto.GameAppletDTO;
|
|
|
import com.zanxiang.game.module.sdk.pojo.dto.UserTokenDTO;
|
|
|
import com.zanxiang.game.module.sdk.pojo.param.UserData;
|
|
|
import com.zanxiang.game.module.sdk.pojo.vo.CpTokenCheckVO;
|
|
|
@@ -71,6 +72,9 @@ public class UserTokenServiceImpl extends ServiceImpl<UserTokenMapper, UserToken
|
|
|
@Autowired
|
|
|
private IIpBanService ipBanService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGameAppletService gameAppletService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IUserService userService;
|
|
|
|
|
|
@@ -104,10 +108,22 @@ public class UserTokenServiceImpl extends ServiceImpl<UserTokenMapper, UserToken
|
|
|
log.error("token验证失败 , str : {}, mySign : {}, sign : {}", tuple2.getT1(), tuple2.getT2(), sign);
|
|
|
return ResultVO.fail(TokenCheckEnum.CHECK_FAIL.getMsg());
|
|
|
}
|
|
|
+ GameAppletDTO gameAppletDTO = null;
|
|
|
+ String wxAccessToken = null;
|
|
|
+ try {
|
|
|
+ gameAppletDTO = gameAppletService.getByGameId(user.getGameId());
|
|
|
+ if (gameAppletDTO != null) {
|
|
|
+ wxAccessToken = wxApiService.getAccessToken(gameAppletDTO.getAppId(), gameAppletDTO.getAppSecret());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("获取小程序token失败,gameAppletDTO:{}", JsonUtil.toString(gameAppletDTO));
|
|
|
+ }
|
|
|
//构造返回
|
|
|
return ResultVO.ok(CpTokenCheckVO.builder()
|
|
|
.userId(userId)
|
|
|
.appId(gameExtService.getByGameId(user.getGameId()).getAppId())
|
|
|
+ .wxAppId(gameAppletDTO == null ? null : gameAppletDTO.getAppId())
|
|
|
+ .wxAccessToken(wxAccessToken)
|
|
|
.build());
|
|
|
}
|
|
|
|