|
@@ -17,6 +17,7 @@ import com.zanxiang.game.module.sdk.pojo.vo.GameInitVO;
|
|
|
import com.zanxiang.game.module.sdk.service.IGameAppletService;
|
|
|
import com.zanxiang.game.module.sdk.service.IGameExtService;
|
|
|
import com.zanxiang.game.module.sdk.service.IGameService;
|
|
|
+import com.zanxiang.game.module.sdk.service.api.WxApiService;
|
|
|
import com.zanxiang.game.module.sdk.service.pay.MiPayService;
|
|
|
import com.zanxiang.game.module.sdk.util.SignUtil;
|
|
|
import com.zanxiang.module.util.JsonUtil;
|
|
@@ -58,6 +59,29 @@ public class GameAppletServiceImpl extends ServiceImpl<GameAppletMapper, GameApp
|
|
|
@Autowired
|
|
|
private MiPayService miPayService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WxApiService wxApiService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGameAppletService gameAppletService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, String> getAppletToken(String gameAppId) {
|
|
|
+ GameExt gameExt = gameExtService.getByGameAppId(gameAppId);
|
|
|
+ if (gameExt == null) {
|
|
|
+ throw new BaseException("参数错误, 游戏配置信息不存在");
|
|
|
+ }
|
|
|
+ GameAppletDTO gameAppletDTO = gameAppletService.getByGameId(gameExt.getGameId());
|
|
|
+ if (gameAppletDTO == null) {
|
|
|
+ throw new BaseException("参数错误, 微信小游戏配置信息不存在");
|
|
|
+ }
|
|
|
+ String accessToken = wxApiService.getAccessToken(gameAppletDTO.getAppId(), gameAppletDTO.getAppSecret());
|
|
|
+ Map<String, String> resultMap = new HashMap<>(2);
|
|
|
+ resultMap.put("appId", gameAppletDTO.getAppId());
|
|
|
+ resultMap.put("accessToken", accessToken);
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public String appletMsgCheck(String appId, String signature, String timestamp, String nonce, String echoStr) throws Exception {
|
|
|
log.error("appId : {}, signature : {}, timestamp : {}, nonce : {}, echoStr : {}", appId, signature, timestamp, nonce, echoStr);
|