refactor(ff-game): 重构 KM 游戏平台接口请求
- 移除了 Constants 类中与 KM 相关的冗余常量定义 - 更新了 GamesKMServiceImpl 类中的 URL 构造方式,使用平台服务获取登录 URL - 优化了代码结构,提高了可维护性和可扩展性main-meitian
parent
ad40fc712d
commit
e2375788b4
|
@ -178,65 +178,6 @@ public class Constants {
|
||||||
*/
|
*/
|
||||||
public static final String PASS_PREFIX = "FF_";
|
public static final String PASS_PREFIX = "FF_";
|
||||||
|
|
||||||
/**
|
|
||||||
* jili 接口请求前缀
|
|
||||||
*/
|
|
||||||
public static final String JILI_API_BASE_URL = "jili.api.base.url";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ng 接口请求前缀
|
|
||||||
*/
|
|
||||||
public static final String NG_API_BASE_URL = "ng.api.base.url";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fc-api基本url
|
|
||||||
*/
|
|
||||||
public static final String FC_API_BASE_URL = "fc.api.base.url";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 吉利测试地址
|
|
||||||
*/
|
|
||||||
public static final String JILI_GAME_DOME = "jili.game.dome";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xk 接口请求前缀
|
|
||||||
*/
|
|
||||||
public static final String XK_API_BASE_URL = "xk.api.base.url";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pgx-api基本url
|
|
||||||
*/
|
|
||||||
public static final String PGX_API_BASE_URL = "gpx.api.base.url";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* dg-api基本url
|
|
||||||
*/
|
|
||||||
public static final String DG_API_BASE_URL = "dg.api.base.url";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ae api基本url
|
|
||||||
*/
|
|
||||||
public static final String AE_API_BASE_URL = "ae.api.base.url";
|
|
||||||
/**
|
|
||||||
* sa-api基本url
|
|
||||||
*/
|
|
||||||
public static final String SA_API_BASE_URL = "sa.api.base.url";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 美天平台
|
|
||||||
*/
|
|
||||||
public static final String MEITIAN_API_BASE_URL = "meitian.api.base.url";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* km-api基本url
|
|
||||||
*/
|
|
||||||
public static final String KM_API_BASE_URL_LOGIN = "km.api.base.url";
|
|
||||||
/**
|
|
||||||
* km-api基本登录url
|
|
||||||
*/
|
|
||||||
public static final String KM_API_BASE_LOGIN_URL = "km.api.base.login.url";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务
|
* 服务
|
||||||
|
|
|
@ -2,9 +2,7 @@ package com.ff.game.api.km.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.alibaba.druid.support.json.JSONUtils;
|
|
||||||
import com.ff.base.constant.CacheConstants;
|
import com.ff.base.constant.CacheConstants;
|
||||||
import com.ff.base.constant.ConfigConstants;
|
|
||||||
import com.ff.base.constant.Constants;
|
import com.ff.base.constant.Constants;
|
||||||
import com.ff.base.core.redis.RedisCache;
|
import com.ff.base.core.redis.RedisCache;
|
||||||
import com.ff.base.enums.*;
|
import com.ff.base.enums.*;
|
||||||
|
@ -15,14 +13,9 @@ import com.ff.base.utils.DateUtils;
|
||||||
import com.ff.base.utils.JsonUtil;
|
import com.ff.base.utils.JsonUtil;
|
||||||
import com.ff.base.utils.StringUtils;
|
import com.ff.base.utils.StringUtils;
|
||||||
import com.ff.base.utils.ip.IpUtils;
|
import com.ff.base.utils.ip.IpUtils;
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
import com.ff.base.utils.uuid.IdUtils;
|
||||||
import com.ff.config.KeyConfig;
|
import com.ff.config.KeyConfig;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.dg.dto.DGBetRecordResponseDTO;
|
|
||||||
import com.ff.game.api.dg.dto.DGResponse;
|
|
||||||
import com.ff.game.api.dg.dto.DGUserListResponseDTO;
|
|
||||||
import com.ff.game.api.jili.dto.JILIGamesDataDTO;
|
|
||||||
import com.ff.game.api.km.client.KMClient;
|
import com.ff.game.api.km.client.KMClient;
|
||||||
import com.ff.game.api.km.dto.*;
|
import com.ff.game.api.km.dto.*;
|
||||||
import com.ff.game.api.request.*;
|
import com.ff.game.api.request.*;
|
||||||
|
@ -57,6 +50,8 @@ import java.util.stream.Collectors;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class GamesKMServiceImpl implements IGamesService {
|
public class GamesKMServiceImpl implements IGamesService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPlatformService platformService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ISysConfigService configService;
|
private ISysConfigService configService;
|
||||||
|
@ -235,10 +230,10 @@ public class GamesKMServiceImpl implements IGamesService {
|
||||||
kmUserToken = redisCache.getCacheObject(CacheConstants.KM_USER_TOKEN + gamesLogin.getAccount());
|
kmUserToken = redisCache.getCacheObject(CacheConstants.KM_USER_TOKEN + gamesLogin.getAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String loginUrl = platformService.get(GamePlatforms.KM.getCode()).getUrlInfo().getLoginUrl();
|
||||||
|
//String selectConfigByKey = configService.selectConfigByKey(Constants.KM_API_BASE_LOGIN_URL);
|
||||||
|
|
||||||
String selectConfigByKey = configService.selectConfigByKey(Constants.KM_API_BASE_LOGIN_URL);
|
return loginUrl + "/gamelauncher?gpcode=" + gamesLogin.getGameType()
|
||||||
|
|
||||||
return selectConfigByKey + "/gamelauncher?gpcode=" + gamesLogin.getGameType()
|
|
||||||
+ "&gcode=" + gamesLogin.getGameId()
|
+ "&gcode=" + gamesLogin.getGameId()
|
||||||
+ "&token=" + kmUserToken
|
+ "&token=" + kmUserToken
|
||||||
+ "&lang=" + gamesLogin.getLang();
|
+ "&lang=" + gamesLogin.getLang();
|
||||||
|
@ -618,9 +613,10 @@ public class GamesKMServiceImpl implements IGamesService {
|
||||||
log.info("GamesKMServiceImpl [gameDemoLogin] 请求参数 {}", gameDemoLoginRequestDTO);
|
log.info("GamesKMServiceImpl [gameDemoLogin] 请求参数 {}", gameDemoLoginRequestDTO);
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
params.put("lang", gameDemoLoginRequestDTO.getLang());
|
params.put("lang", gameDemoLoginRequestDTO.getLang());
|
||||||
String selectConfigByKey = configService.selectConfigByKey(Constants.KM_API_BASE_LOGIN_URL);
|
String loginUrl = platformService.get(GamePlatforms.KM.getCode()).getUrlInfo().getLoginUrl();
|
||||||
|
//String selectConfigByKey = configService.selectConfigByKey(Constants.KM_API_BASE_LOGIN_URL);
|
||||||
return GameDemoLoginResponseDTO.builder()
|
return GameDemoLoginResponseDTO.builder()
|
||||||
.url(selectConfigByKey + "/demolauncher?gpcode=" + gameDemoLoginRequestDTO.getGameType()
|
.url(loginUrl + "/demolauncher?gpcode=" + gameDemoLoginRequestDTO.getGameType()
|
||||||
+ "&gcode=" + gameDemoLoginRequestDTO.getGameId()
|
+ "&gcode=" + gameDemoLoginRequestDTO.getGameId()
|
||||||
+ "&lang=" + gameDemoLoginRequestDTO.getLang())
|
+ "&lang=" + gameDemoLoginRequestDTO.getLang())
|
||||||
.build();
|
.build();
|
||||||
|
@ -687,7 +683,8 @@ public class GamesKMServiceImpl implements IGamesService {
|
||||||
KMGameResponse.Game::getCode,
|
KMGameResponse.Game::getCode,
|
||||||
e -> e,
|
e -> e,
|
||||||
(existing, replacement) -> existing
|
(existing, replacement) -> existing
|
||||||
));;
|
));
|
||||||
|
;
|
||||||
KMGameResponse.Game gamesDataDTO = dataDTOMap.get(resultBean.getGCode());
|
KMGameResponse.Game gamesDataDTO = dataDTOMap.get(resultBean.getGCode());
|
||||||
|
|
||||||
//输赢状态
|
//输赢状态
|
||||||
|
|
Loading…
Reference in New Issue