Compare commits
7 Commits
e020b73282
...
3ce8dba98f
Author | SHA1 | Date |
---|---|---|
|
3ce8dba98f | |
|
ebbf2e14a2 | |
|
22b613ece0 | |
|
e2375788b4 | |
|
ad40fc712d | |
|
f1aa9d26e7 | |
|
b7ff4ada0e |
|
@ -100,6 +100,8 @@ public class CacheConstants {
|
|||
public static final String MeiTian_GAMES = "meitian_games:";
|
||||
|
||||
|
||||
public static final String Platform = "platform:";
|
||||
|
||||
/**
|
||||
* km用户令牌
|
||||
*/
|
||||
|
|
|
@ -178,65 +178,6 @@ public class Constants {
|
|||
*/
|
||||
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";
|
||||
|
||||
|
||||
/**
|
||||
* 服务
|
||||
|
|
|
@ -11,7 +11,7 @@ public enum GamePlatforms {
|
|||
FC("FC", "FC"),
|
||||
SA("SA", "SA"),
|
||||
DG("DG", "DG"),
|
||||
MeiTian("MeiTian","美天棋牌"),
|
||||
MT("MT", "美天棋牌"),
|
||||
AE("AE", "AE"),
|
||||
KM("KM", "KM"),
|
||||
PGT("PGT", "PGT"),
|
||||
|
@ -20,16 +20,14 @@ public enum GamePlatforms {
|
|||
private final String code;
|
||||
private final String info;
|
||||
|
||||
GamePlatforms(String code, String info)
|
||||
{
|
||||
GamePlatforms(String code, String info) {
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
|
||||
public static List<String> getCodes()
|
||||
{
|
||||
List<String> result=new ArrayList<>();
|
||||
public static List<String> getCodes() {
|
||||
List<String> result = new ArrayList<>();
|
||||
GamePlatforms[] values = GamePlatforms.values();
|
||||
for (GamePlatforms value : values) {
|
||||
result.add(value.getCode());
|
||||
|
@ -37,13 +35,11 @@ public enum GamePlatforms {
|
|||
return result;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ public enum PlatformType {
|
|||
VIDEO(6, "视讯"),
|
||||
LOTTERY(7, "彩票"),
|
||||
SPORTS(8, "体育"),
|
||||
HUNTING(9, "捕猎");
|
||||
HUNTING(9, "捕猎"),
|
||||
BaiRen(10, "百人场");
|
||||
|
||||
private final int code;
|
||||
private final String name;
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.ff.base.handler;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* mybatis json字段转换
|
||||
*
|
||||
* @author cengy
|
||||
*/
|
||||
public class JsonHandler<T> extends BaseTypeHandler<T> {
|
||||
private final Class<T> type;
|
||||
|
||||
|
||||
public JsonHandler(Class<T> type) {
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException("Type argument cannot be null");
|
||||
}
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException {
|
||||
ps.setString(i, JSON.toJSONString(parameter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
String json = rs.getString(columnName);
|
||||
if (json != null) {
|
||||
return JSON.parseObject(json, type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
String json = rs.getString(columnIndex);
|
||||
if (json != null) {
|
||||
return JSON.parseObject(json, type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
String json = cs.getString(columnIndex);
|
||||
if (json != null) {
|
||||
return JSON.parseObject(json, type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.ff.base.handler;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* mybatis json字段转换
|
||||
*
|
||||
* @author cengy
|
||||
*/
|
||||
public class JsonListHandler<T> extends BaseTypeHandler<List<T>> {
|
||||
private final Class<T> type;
|
||||
|
||||
public JsonListHandler(Class<T> type) {
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException("Type argument cannot be null");
|
||||
}
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, List<T> parameter, JdbcType jdbcType) throws SQLException {
|
||||
// Convert the List<Item> to JSON string
|
||||
String json = JSON.toJSONString(parameter);
|
||||
ps.setString(i, json);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
|
||||
String json = rs.getString(columnName);
|
||||
if (json == null) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parseArray(json, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
String json = rs.getString(columnIndex);
|
||||
if (json == null) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parseArray(json, type);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
String json = cs.getString(columnIndex);
|
||||
if (json == null) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parseArray(json, type);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ import com.ff.base.constant.Constants;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
|
@ -15,27 +14,23 @@ import java.security.NoSuchAlgorithmException;
|
|||
*
|
||||
* @author ff
|
||||
*/
|
||||
public class Md5Utils
|
||||
{
|
||||
public class Md5Utils {
|
||||
private static final Logger log = LoggerFactory.getLogger(Md5Utils.class);
|
||||
|
||||
private static byte[] md5(String s)
|
||||
{
|
||||
private static byte[] md5(String s) {
|
||||
MessageDigest algorithm;
|
||||
try
|
||||
{
|
||||
try {
|
||||
algorithm = MessageDigest.getInstance("MD5");
|
||||
algorithm.reset();
|
||||
algorithm.update(s.getBytes("UTF-8"));
|
||||
byte[] messageDigest = algorithm.digest();
|
||||
return messageDigest;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("MD5 Error...", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String md5New(String input) {
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
|
@ -63,30 +58,24 @@ public class Md5Utils
|
|||
return null;
|
||||
}
|
||||
String result = "";
|
||||
try{
|
||||
try {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
BASE64Encoder base64en = new BASE64Encoder();
|
||||
result = base64en.encode(md5.digest(str.getBytes(StandardCharsets.UTF_8)));
|
||||
}catch (Exception e){
|
||||
log.error("encoderByMd5...{0}", str, e);
|
||||
result = Base64.encode(md5.digest(str.getBytes(StandardCharsets.UTF_8)));
|
||||
} catch (Exception e) {
|
||||
log.error("encoderByMd5...{}", str, e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static final String toHex(byte hash[])
|
||||
{
|
||||
if (hash == null)
|
||||
{
|
||||
private static final String toHex(byte hash[]) {
|
||||
if (hash == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuffer buf = new StringBuffer(hash.length * 2);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < hash.length; i++)
|
||||
{
|
||||
if ((hash[i] & 0xff) < 0x10)
|
||||
{
|
||||
for (i = 0; i < hash.length; i++) {
|
||||
if ((hash[i] & 0xff) < 0x10) {
|
||||
buf.append("0");
|
||||
}
|
||||
buf.append(Long.toString(hash[i] & 0xff, 16));
|
||||
|
@ -94,15 +83,11 @@ public class Md5Utils
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String hash(String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new String(toHex(md5(Constants.PASS_PREFIX +s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("not supported charset...{}", e);
|
||||
public static String hash(String s) {
|
||||
try {
|
||||
return new String(toHex(md5(Constants.PASS_PREFIX + s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
log.error("not supported charset...", e);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -9,12 +9,14 @@ import com.ff.base.constant.Constants;
|
|||
import com.ff.base.core.controller.BaseController;
|
||||
import com.ff.base.core.domain.AjaxResult;
|
||||
import com.ff.base.core.page.TableDataInfo;
|
||||
import com.ff.base.enums.*;
|
||||
import com.ff.base.enums.ErrorCode;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.base.enums.TransferType;
|
||||
import com.ff.base.exception.base.ApiException;
|
||||
import com.ff.base.exception.base.BaseException;
|
||||
import com.ff.base.system.domain.TenantSecretKey;
|
||||
import com.ff.base.utils.StringUtils;
|
||||
import com.ff.base.utils.bean.BeanUtils;
|
||||
import com.ff.base.system.domain.TenantSecretKey;
|
||||
import com.ff.common.dto.GameBalanceExchange;
|
||||
import com.ff.common.service.ITenantGameQuotaFlowService;
|
||||
import com.ff.common.service.ITenantGameQuotaService;
|
||||
|
@ -23,18 +25,16 @@ import com.ff.game.api.IGamesService;
|
|||
import com.ff.game.api.request.*;
|
||||
import com.ff.game.domain.*;
|
||||
import com.ff.game.dto.GameBettingDetailsDTO;
|
||||
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||
import com.ff.game.dto.GameSecretKeyLangDTO;
|
||||
import com.ff.game.service.*;
|
||||
import com.ff.member.domain.Member;
|
||||
import com.ff.member.service.IMemberService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -45,10 +45,12 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* api控制器
|
||||
|
@ -74,16 +76,9 @@ public class ApiGameController extends BaseController {
|
|||
@Resource
|
||||
private KeyConfig keyConfig;
|
||||
|
||||
@Resource
|
||||
private IGameSecretKeyService gameSecretKeyService;
|
||||
|
||||
@Resource
|
||||
private IMemberService memberService;
|
||||
|
||||
@Resource
|
||||
private IGamePlatformService gamePlatformService;
|
||||
|
||||
|
||||
@Resource
|
||||
private ITenantGameQuotaService tenantGameQuotaService;
|
||||
|
||||
|
@ -98,17 +93,12 @@ public class ApiGameController extends BaseController {
|
|||
@Resource
|
||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
||||
|
||||
@Resource
|
||||
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
||||
|
||||
|
||||
@Resource
|
||||
private IGameSecretKeyLangService gameSecretKeyLangService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("threadPoolTaskExecutor")
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
|
||||
@Resource
|
||||
private IPlatformService platformService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
|
@ -118,11 +108,20 @@ public class ApiGameController extends BaseController {
|
|||
@PostMapping("/list")
|
||||
public AjaxResult list() {
|
||||
List<GameResponse> gameResponses = gameService.selectGameResponseList();
|
||||
for (GameResponse gameRespons : gameResponses) {
|
||||
for (GameResponse gameResponse : gameResponses) {
|
||||
Platform platform = platformService.get(gameResponse.getPlatformCode());
|
||||
if (null == platform) {
|
||||
continue;
|
||||
}
|
||||
// List<GameSecretKeyCurrencyDTO> gameSecretKeyCurrencies =
|
||||
// gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(
|
||||
// GameSecretKeyCurrencyDTO.builder().platformCode(gameResponse.getPlatformCode())
|
||||
// .build()
|
||||
// );
|
||||
// List<String> currencyCode = gameSecretKeyCurrencies.stream().map(GameSecretKeyCurrencyDTO::getSystemCurrency).collect(Collectors.toList());
|
||||
|
||||
List<GameSecretKeyCurrencyDTO> gameSecretKeyCurrencies = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder().platformCode(gameRespons.getPlatformCode()).build());
|
||||
List<String> currencyCode = gameSecretKeyCurrencies.stream().map(GameSecretKeyCurrencyDTO::getSystemCurrency).collect(Collectors.toList());
|
||||
gameRespons.setCurrencyCode(currencyCode);
|
||||
List<String> currencyCode = new ArrayList<>(platform.getCurrencyInfo().keySet());
|
||||
gameResponse.setCurrencyCode(currencyCode);
|
||||
}
|
||||
return AjaxResult.success(gameResponses);
|
||||
}
|
||||
|
@ -131,50 +130,67 @@ public class ApiGameController extends BaseController {
|
|||
/**
|
||||
* 登录
|
||||
*
|
||||
* @param memberCreateApiRequest 成员创建api请求
|
||||
* @param loginRequest 登入游戏
|
||||
* @return {@link AjaxResult }
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@Validated @RequestBody GameLoginRequest memberCreateApiRequest) {
|
||||
public AjaxResult login(@Validated @RequestBody GameLoginRequest loginRequest) {
|
||||
|
||||
Game game = gameService.selectGameById(memberCreateApiRequest.getGameId());
|
||||
Game game = gameService.selectGameById(loginRequest.getGameId());
|
||||
ApiException.notNull(game, ErrorCode.GAME_NOT_EXIST.getCode());
|
||||
|
||||
GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(game.getPlatformId());
|
||||
ApiException.notNull(gamePlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
Platform platform = platformService.get(game.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
IGamesService iGamesService = gamesService.get(platform.getPlatformCode() + Constants.SERVICE);
|
||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
String targetCurrency = platform.getCurrencyInfo().get(loginRequest.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(loginRequest.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(loginRequest.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
String targetLang = platform.getLangInfo().get(loginRequest.getLangCode());
|
||||
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
|
||||
// TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||
// GameSecretKeyCurrencyDTO secretKeyCurrencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(gamePlatform.getPlatformCode())
|
||||
// .systemCurrency(memberCreateApiRequest.getCurrencyCode()).build());
|
||||
// ApiException.notNull(secretKeyCurrencyDTO, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
// GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||
// .platformCode(gamePlatform.getPlatformCode())
|
||||
// .systemLangCode(memberCreateApiRequest.getLangCode())
|
||||
// .build());
|
||||
// ApiException.notNull(gameSecretKeyLangDTO, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
IGamesService iGamesService = gamesService.get(gamePlatform.getPlatformCode() + Constants.SERVICE);
|
||||
|
||||
|
||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||
GameSecretKeyCurrencyDTO secretKeyCurrencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(gamePlatform.getPlatformCode())
|
||||
.systemCurrency(memberCreateApiRequest.getCurrencyCode()).build());
|
||||
ApiException.notNull(secretKeyCurrencyDTO, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||
.platformCode(gamePlatform.getPlatformCode())
|
||||
.systemLangCode(memberCreateApiRequest.getLangCode())
|
||||
.build());
|
||||
ApiException.notNull(gameSecretKeyLangDTO, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
Member member = memberService.selectMemberByAccount(memberCreateApiRequest.getAccount(), memberCreateApiRequest.getCurrencyCode(), gamePlatform.getPlatformCode());
|
||||
Member member = memberService.selectMemberByAccount(loginRequest.getAccount(), loginRequest.getCurrencyCode(), platform.getPlatformCode());
|
||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
|
||||
GamesLogin gamesLogin = GamesLogin.builder()
|
||||
.agentId(secretKeyCurrencyDTO.getCode())
|
||||
.agentKey(secretKeyCurrencyDTO.getKey())
|
||||
.agentId(keyInfo.getCode())
|
||||
.agentKey(keyInfo.getKey())
|
||||
.account(member.getGameAccount())
|
||||
.gameType(game.getGameSourceType())
|
||||
.currency(secretKeyCurrencyDTO.getCurrency())
|
||||
.currency(/*secretKeyCurrencyDTO.getCurrency()*/targetCurrency)
|
||||
.gameId(game.getGameCode())
|
||||
.homeUrl(memberCreateApiRequest.getHomeUrl())
|
||||
.betLimit(memberCreateApiRequest.getBetLimit())
|
||||
.platform(memberCreateApiRequest.getPlatform())
|
||||
.disableFullScreen(memberCreateApiRequest.getDisableFullScreen())
|
||||
.lang(gameSecretKeyLangDTO.getLang())
|
||||
.homeUrl(loginRequest.getHomeUrl())
|
||||
.betLimit(loginRequest.getBetLimit())
|
||||
.platform(loginRequest.getPlatform())
|
||||
.disableFullScreen(loginRequest.getDisableFullScreen())
|
||||
.lang(/*gameSecretKeyLangDTO.getLang()*/ targetLang)
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build();
|
||||
|
||||
String login = iGamesService.loginWithoutRedirect(gamesLogin);
|
||||
|
@ -193,17 +209,33 @@ public class ApiGameController extends BaseController {
|
|||
@Transactional
|
||||
public AjaxResult exchangeBalance(@Validated @RequestBody GameExchangeBalanceRequest gameExchangeBalanceRequest) {
|
||||
|
||||
|
||||
IGamesService iGamesService = gamesService.get(gameExchangeBalanceRequest.getPlatformCode() + Constants.SERVICE);
|
||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
|
||||
.systemCurrency(gameExchangeBalanceRequest.getCurrencyCode()).build());
|
||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(gameExchangeBalanceRequest.getPlatformCode())
|
||||
// .systemCurrency(gameExchangeBalanceRequest.getCurrencyCode()).build());
|
||||
//
|
||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
Platform platform = platformService.get(gameExchangeBalanceRequest.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
String targetCurrency = platform.getCurrencyInfo().get(gameExchangeBalanceRequest.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(gameExchangeBalanceRequest.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(gameExchangeBalanceRequest.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
BigDecimal quota = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
|
||||
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
|
||||
|
@ -222,15 +254,17 @@ public class ApiGameController extends BaseController {
|
|||
|
||||
//操作第三方额度接口
|
||||
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
|
||||
.agentId(gameSecretKey.getCode())
|
||||
.agentKey(gameSecretKey.getKey())
|
||||
.agentId(keyInfo.getCode())
|
||||
.agentKey(keyInfo.getKey())
|
||||
.orderId(gameExchangeBalanceRequest.getOrderId())
|
||||
.account(member.getGameAccount())
|
||||
.currency(gameSecretKey.getCurrency())
|
||||
.currency(/*gameSecretKey.getCurrency()*/targetCurrency)
|
||||
.tenantKey(tenantSecretKey.getTenantKey())
|
||||
.quota(quota)
|
||||
.amount(gameExchangeBalanceRequest.getAmount())
|
||||
.transferType(gameExchangeBalanceRequest.getTransferType())
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build();
|
||||
Long exchangeTransferId = iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
|
||||
GameExchangeMoney gameExchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(exchangeTransferId);
|
||||
|
@ -276,12 +310,27 @@ public class ApiGameController extends BaseController {
|
|||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(gameCreateFreeSpinRequest.getPlatformCode())
|
||||
.systemCurrency(gameCreateFreeSpinRequest.getCurrencyCode()).build());
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
// TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(gameCreateFreeSpinRequest.getPlatformCode())
|
||||
// .systemCurrency(gameCreateFreeSpinRequest.getCurrencyCode()).build());
|
||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
Platform platform = platformService.get(gameCreateFreeSpinRequest.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
String targetCurrency = platform.getCurrencyInfo().get(gameCreateFreeSpinRequest.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(gameCreateFreeSpinRequest.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(gameCreateFreeSpinRequest.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
Member member = memberService.selectMemberByAccount(gameCreateFreeSpinRequest.getAccount(), gameCreateFreeSpinRequest.getCurrencyCode(), gameCreateFreeSpinRequest.getPlatformCode());
|
||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
|
@ -289,15 +338,17 @@ public class ApiGameController extends BaseController {
|
|||
|
||||
CreateFreeSpinRequestDTO createFreeSpinRequestDTO = CreateFreeSpinRequestDTO.builder()
|
||||
.account(member.getGameAccount())
|
||||
.currency(gameCreateFreeSpinRequest.getCurrencyCode())
|
||||
.agentId(gameSecretKey.getCode())
|
||||
.agentKey(gameSecretKey.getKey())
|
||||
.currency(/*gameCreateFreeSpinRequest.getCurrencyCode()*/targetCurrency)
|
||||
.agentId(keyInfo.getCode())
|
||||
.agentKey(keyInfo.getKey())
|
||||
.referenceId(gameCreateFreeSpinRequest.getReferenceId())
|
||||
.freeSpinValidity(gameCreateFreeSpinRequest.getFreeSpinValidity())
|
||||
.numberOfRounds(gameCreateFreeSpinRequest.getNumberOfRounds())
|
||||
.gameIds(gameCreateFreeSpinRequest.getGameIds())
|
||||
.betValue(gameCreateFreeSpinRequest.getBetValue())
|
||||
.startTime(gameCreateFreeSpinRequest.getStartTime())
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build();
|
||||
|
||||
|
||||
|
@ -350,32 +401,52 @@ public class ApiGameController extends BaseController {
|
|||
*/
|
||||
@PostMapping("/get/detail")
|
||||
public AjaxResult getDetail(@Validated @RequestBody GameGetDetailRequest gameGetDetailRequest) {
|
||||
Platform platform = platformService.get(gameGetDetailRequest.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
String targetCurrency = platform.getCurrencyInfo().get(gameGetDetailRequest.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(gameGetDetailRequest.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(gameGetDetailRequest.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
String targetLang = platform.getLangInfo().get(gameGetDetailRequest.getLangCode());
|
||||
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
|
||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(gameGetDetailRequest.getPlatformCode())
|
||||
// .systemCurrency(gameGetDetailRequest.getCurrencyCode()).build());
|
||||
|
||||
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(gameGetDetailRequest.getPlatformCode())
|
||||
.systemCurrency(gameGetDetailRequest.getCurrencyCode()).build());
|
||||
|
||||
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
IGamesService iGamesService = gamesService.get(gameGetDetailRequest.getPlatformCode() + Constants.SERVICE);
|
||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
GameSecretKeyLangDTO gameSecretKeyLang = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||
.platformCode(gameGetDetailRequest.getPlatformCode())
|
||||
.systemLangCode(gameGetDetailRequest.getLangCode())
|
||||
.build());
|
||||
ApiException.notNull(gameSecretKeyLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
// GameSecretKeyLangDTO gameSecretKeyLang = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||
// .platformCode(gameGetDetailRequest.getPlatformCode())
|
||||
// .systemLangCode(gameGetDetailRequest.getLangCode())
|
||||
// .build());
|
||||
// ApiException.notNull(gameSecretKeyLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
GetGameDetailResponseDTO gameDetail = iGamesService.getGameDetail(GetGameDetailRequestDTO.builder()
|
||||
.wagersId(gameGetDetailRequest.getWagersId())
|
||||
.lang(gameSecretKeyLang.getLang())
|
||||
.agentId(gameSecretKey.getCode())
|
||||
.agentKey(gameSecretKey.getKey())
|
||||
.lang(/*gameSecretKeyLang.getLang()*/targetLang)
|
||||
.agentId(keyInfo.getCode())
|
||||
.agentKey(keyInfo.getKey())
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build());
|
||||
return AjaxResult.success(gameDetail);
|
||||
}
|
||||
|
@ -388,44 +459,80 @@ public class ApiGameController extends BaseController {
|
|||
*/
|
||||
@PostMapping("/kick/member")
|
||||
public AjaxResult kickMember(@Validated @RequestBody GameKickMemeberRequest gameKickMemeberRequest) {
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(gameKickMemeberRequest.getPlatformCode())
|
||||
.systemCurrency(gameKickMemeberRequest.getCurrencyCode()).build());
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(gameKickMemeberRequest.getPlatformCode())
|
||||
// .systemCurrency(gameKickMemeberRequest.getCurrencyCode()).build());
|
||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
Platform platform = platformService.get(gameKickMemeberRequest.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
Member member = memberService.selectMemberByAccount(gameKickMemeberRequest.getAccount(), gameKickMemeberRequest.getCurrencyCode(), gameKickMemeberRequest.getPlatformCode());
|
||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
String targetCurrency = platform.getCurrencyInfo().get(gameKickMemeberRequest.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(gameKickMemeberRequest.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(gameKickMemeberRequest.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
IGamesService iGamesService = gamesService.get(gameKickMemeberRequest.getPlatformCode() + Constants.SERVICE);
|
||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
Member member = memberService.selectMemberByAccount(gameKickMemeberRequest.getAccount(), gameKickMemeberRequest.getCurrencyCode(), gameKickMemeberRequest.getPlatformCode());
|
||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
|
||||
return AjaxResult.success(iGamesService.kickMember(KickMemberRequestDTO.builder()
|
||||
.account(member.getGameAccount())
|
||||
.agentId(gameSecretKey.getCode())
|
||||
.currency(gameSecretKey.getCurrency())
|
||||
.agentKey(gameSecretKey.getKey())
|
||||
.agentId(keyInfo.getCode())
|
||||
.currency(targetCurrency)
|
||||
.agentKey(keyInfo.getKey())
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build()));
|
||||
}
|
||||
|
||||
@PostMapping("/kick/member/all")
|
||||
public AjaxResult kickMemberAll(@Validated @RequestBody GameKickMemeberAllRequest gameKickMemeberAllRequest) {
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(gameKickMemeberAllRequest.getPlatformCode())
|
||||
.systemCurrency(gameKickMemeberAllRequest.getCurrencyCode()).build());
|
||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(gameKickMemeberAllRequest.getPlatformCode())
|
||||
// .systemCurrency(gameKickMemeberAllRequest.getCurrencyCode()).build());
|
||||
//
|
||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
Platform platform = platformService.get(gameKickMemeberAllRequest.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
String targetCurrency = platform.getCurrencyInfo().get(gameKickMemeberAllRequest.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(gameKickMemeberAllRequest.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(gameKickMemeberAllRequest.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
IGamesService iGamesService = gamesService.get(gameKickMemeberAllRequest.getPlatformCode() + Constants.SERVICE);
|
||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
KickMemberAllDTO kickMemberAllDTO = KickMemberAllDTO.builder()
|
||||
.agentId(gameSecretKey.getCode())
|
||||
.agentKey(gameSecretKey.getKey())
|
||||
.currency(gameSecretKey.getCurrency())
|
||||
.agentId(keyInfo.getCode())
|
||||
.agentKey(keyInfo.getKey())
|
||||
.currency(/*gameSecretKey.getCurrency()*/targetCurrency)
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build();
|
||||
if (!ObjectUtils.isEmpty(gameKickMemeberAllRequest.getGameId())) {
|
||||
Game game = gameService.selectGameById(gameKickMemeberAllRequest.getGameId());
|
||||
|
@ -474,23 +581,42 @@ public class ApiGameController extends BaseController {
|
|||
/**
|
||||
* 取消自由旋转
|
||||
*
|
||||
* @param gameGetFreeSpinDashflowRequest 游戏获得免费旋转dashflow请求
|
||||
* @param request 游戏获得免费旋转dashflow请求
|
||||
* @return {@link TableDataInfo }
|
||||
*/
|
||||
@PostMapping("/cancel/free/spin")
|
||||
public AjaxResult cancelFreeSpin(@Validated @RequestBody GameCancelFreeSpinRequest gameGetFreeSpinDashflowRequest) {
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(gameGetFreeSpinDashflowRequest.getPlatformCode())
|
||||
.systemCurrency(gameGetFreeSpinDashflowRequest.getCurrencyCode()).build());
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
public AjaxResult cancelFreeSpin(@Validated @RequestBody GameCancelFreeSpinRequest request) {
|
||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(gameGetFreeSpinDashflowRequest.getPlatformCode())
|
||||
// .systemCurrency(gameGetFreeSpinDashflowRequest.getCurrencyCode()).build());
|
||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
IGamesService iGamesService = gamesService.get(gameGetFreeSpinDashflowRequest.getPlatformCode() + Constants.SERVICE);
|
||||
Platform platform = platformService.get(request.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
IGamesService iGamesService = gamesService.get(request.getPlatformCode() + Constants.SERVICE);
|
||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
Boolean cancelFreeSpin = iGamesService.cancelFreeSpin(CancelFreeSpinRequestDTO.builder()
|
||||
.agentId(gameSecretKey.getCode())
|
||||
.agentKey(gameSecretKey.getKey())
|
||||
.referenceId(gameGetFreeSpinDashflowRequest.getReferenceId())
|
||||
.agentId(keyInfo.getCode())
|
||||
.agentKey(keyInfo.getKey())
|
||||
.referenceId(request.getReferenceId())
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build());
|
||||
return AjaxResult.success(cancelFreeSpin);
|
||||
}
|
||||
|
@ -498,45 +624,79 @@ public class ApiGameController extends BaseController {
|
|||
/**
|
||||
* 信息全部
|
||||
*
|
||||
* @param gameExchangeBalanceAllRequest 成员信息所有api请求
|
||||
* @param request 成员信息所有api请求
|
||||
* @return {@link AjaxResult }
|
||||
*/
|
||||
@PostMapping("/exchange/balance/all")
|
||||
public AjaxResult exchangeBalanceAll(@Validated @RequestBody GameExchangeBalanceAllRequest gameExchangeBalanceAllRequest) {
|
||||
public AjaxResult exchangeBalanceAll(@Validated @RequestBody GameExchangeBalanceAllRequest request) {
|
||||
|
||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||
|
||||
|
||||
List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
||||
.systemCurrency(gameExchangeBalanceAllRequest.getCurrencyCode()).build());
|
||||
// List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
||||
// .systemCurrency(gameExchangeBalanceAllRequest.getCurrencyCode()).build());
|
||||
|
||||
|
||||
List<Key> keys = new ArrayList<>();
|
||||
for (GamePlatforms platformEnum : GamePlatforms.values()) {
|
||||
|
||||
Platform platform = platformService.get(platformEnum.getCode());
|
||||
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
|
||||
if (StringUtils.isEmpty(targetCurrency)) {
|
||||
continue;
|
||||
}
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null == keyInfo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Key key = new Key();
|
||||
key.setPlatformCode(platform.getPlatformCode());
|
||||
key.setCode(keyInfo.getCode());
|
||||
key.setKey(keyInfo.getKey());
|
||||
key.setCurrency(targetCurrency);
|
||||
key.setPlatform(platform);
|
||||
key.setKeyInfo(keyInfo);
|
||||
keys.add(key);
|
||||
}
|
||||
|
||||
// 创建线程池
|
||||
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
|
||||
CountDownLatch latch = new CountDownLatch(gameSecretKeys.size());
|
||||
CountDownLatch latch = new CountDownLatch(keys.size());
|
||||
|
||||
// 使用List存储Future对象,用于获取异步执行的结果
|
||||
List<Future<Long>> futures = new ArrayList<>();
|
||||
|
||||
// 提交异步任务到线程池
|
||||
for (GameSecretKeyCurrencyDTO gameSecretKeyCurrencyDTO : gameSecretKeys) {
|
||||
// for (GameSecretKeyCurrencyDTO gameSecretKeyCurrencyDTO : gameSecretKeys) {
|
||||
for (Key key : keys) {
|
||||
futures.add(threadPoolTaskExecutor.submit(() -> {
|
||||
try {
|
||||
|
||||
IGamesService iGamesService = gamesService.get(gameSecretKeyCurrencyDTO.getPlatformCode() + Constants.SERVICE);
|
||||
IGamesService iGamesService = gamesService.get(key.getPlatformCode() + Constants.SERVICE);
|
||||
|
||||
Member member = memberService.selectMemberByAccount(gameExchangeBalanceAllRequest.getAccount(), gameExchangeBalanceAllRequest.getCurrencyCode(), gameSecretKeyCurrencyDTO.getPlatformCode());
|
||||
Member member = memberService.selectMemberByAccount(request.getAccount(), request.getCurrencyCode(), key.getPlatformCode());
|
||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
|
||||
//操作第三方钱包
|
||||
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
|
||||
.agentId(gameSecretKeyCurrencyDTO.getCode())
|
||||
.agentKey(gameSecretKeyCurrencyDTO.getKey())
|
||||
.orderId(gameExchangeBalanceAllRequest.getOrderId())
|
||||
.agentId(key.getCode())
|
||||
.agentKey(key.getKey())
|
||||
.orderId(request.getOrderId())
|
||||
.amount(BigDecimal.ONE)
|
||||
.currency(gameSecretKeyCurrencyDTO.getCurrency())
|
||||
.currency(/*gameSecretKeyCurrencyDTO.getCurrency()*/key.currency)
|
||||
.tenantKey(tenantSecretKey.getTenantKey())
|
||||
.account(member.getGameAccount())
|
||||
.vendor(key.getPlatform())
|
||||
.keyInfo(key.getKeyInfo())
|
||||
.transferType(TransferType.ALL.getCode())
|
||||
.build();
|
||||
return iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
|
||||
|
@ -571,7 +731,7 @@ public class ApiGameController extends BaseController {
|
|||
tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
|
||||
.platformCode(gameExchangeMoney.getPlatformCode())
|
||||
.currencyCode(gameExchangeMoney.getCurrencyCode())
|
||||
.sourceId(gameExchangeBalanceAllRequest.getOrderId())
|
||||
.sourceId(request.getOrderId())
|
||||
.transferType(TransferType.ALL.getCode())
|
||||
.amount(gameExchangeMoney.getBalance())
|
||||
.account(member.getMemberAccount())
|
||||
|
@ -593,33 +753,54 @@ public class ApiGameController extends BaseController {
|
|||
/**
|
||||
* 演示登录
|
||||
*
|
||||
* @param gameDemoLoginRequest 游戏演示登录请求
|
||||
* @param request 游戏演示登录请求
|
||||
* @return {@link AjaxResult }
|
||||
*/
|
||||
@PostMapping("/demo/login")
|
||||
public AjaxResult demoLogin(@Validated @RequestBody GameDemoLoginRequest gameDemoLoginRequest) {
|
||||
public AjaxResult demoLogin(@Validated @RequestBody GameDemoLoginRequest request) {
|
||||
|
||||
Game game = gameService.selectGameById(gameDemoLoginRequest.getGameId());
|
||||
Game game = gameService.selectGameById(request.getGameId());
|
||||
ApiException.notNull(game, ErrorCode.GAME_NOT_EXIST.getCode());
|
||||
|
||||
GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(game.getPlatformId());
|
||||
ApiException.notNull(gamePlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
//GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(game.getPlatformId());
|
||||
//ApiException.notNull(gamePlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
Platform platform = platformService.get(game.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
IGamesService iGamesService = gamesService.get(gamePlatform.getPlatformCode() + Constants.SERVICE);
|
||||
IGamesService iGamesService = gamesService.get(platform.getPlatformCode() + Constants.SERVICE);
|
||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||
.platformCode(gamePlatform.getPlatformCode())
|
||||
.systemLangCode(gameDemoLoginRequest.getLangCode())
|
||||
.build());
|
||||
ApiException.notNull(gameSecretKeyLangDTO, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
String targetLang = platform.getLangInfo().get(request.getLangCode());
|
||||
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
|
||||
// GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||
// .platformCode(gamePlatform.getPlatformCode())
|
||||
// .systemLangCode(gameDemoLoginRequest.getLangCode())
|
||||
// .build());
|
||||
// ApiException.notNull(gameSecretKeyLangDTO, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
GameDemoLoginRequestDTO gamesLogin = GameDemoLoginRequestDTO.builder()
|
||||
.gameId(game.getGameCode())
|
||||
.gameType(game.getGameSourceType())
|
||||
.lang(gameSecretKeyLangDTO.getLang())
|
||||
.lang(/*gameSecretKeyLangDTO.getLang()*/targetLang)
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build();
|
||||
|
||||
GameDemoLoginResponseDTO gameDemoLoginResponseDTO = iGamesService.gameDemoLogin(gamesLogin);
|
||||
|
@ -627,4 +808,14 @@ public class ApiGameController extends BaseController {
|
|||
BeanUtils.copyProperties(gameDemoLoginResponseDTO, gameDemoLoginResponse);
|
||||
return AjaxResult.success(gameDemoLoginResponse);
|
||||
}
|
||||
|
||||
@Data
|
||||
class Key {
|
||||
private String platformCode;
|
||||
private String code;
|
||||
private String currency;
|
||||
private String key;
|
||||
private Platform platform;
|
||||
private KeyInfo keyInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,20 +11,22 @@ import com.ff.base.constant.Constants;
|
|||
import com.ff.base.core.controller.BaseController;
|
||||
import com.ff.base.core.domain.AjaxResult;
|
||||
import com.ff.base.enums.ErrorCode;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.base.exception.base.ApiException;
|
||||
import com.ff.base.exception.base.BaseException;
|
||||
import com.ff.base.utils.StringUtils;
|
||||
import com.ff.base.system.domain.TenantSecretKey;
|
||||
import com.ff.base.utils.StringUtils;
|
||||
import com.ff.config.KeyConfig;
|
||||
import com.ff.game.api.IGamesService;
|
||||
import com.ff.game.api.request.*;
|
||||
import com.ff.game.domain.GameSecretKey;
|
||||
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||
import com.ff.game.service.IGameSecretKeyCurrencyService;
|
||||
import com.ff.game.service.IGameSecretKeyService;
|
||||
import com.ff.game.service.IGameService;
|
||||
import com.ff.game.api.request.CreateMemberRequestDTO;
|
||||
import com.ff.game.api.request.MemberInfoRequestDTO;
|
||||
import com.ff.game.api.request.MemberInfoResponseDTO;
|
||||
import com.ff.game.domain.KeyInfo;
|
||||
import com.ff.game.domain.Platform;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import com.ff.member.domain.Member;
|
||||
import com.ff.member.service.IMemberService;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -32,10 +34,12 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -58,31 +62,21 @@ import java.util.concurrent.Future;
|
|||
@Slf4j
|
||||
public class ApiMemberController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private Map<String, IGamesService> gamesService;
|
||||
|
||||
|
||||
@Resource
|
||||
private IGameService gameService;
|
||||
|
||||
|
||||
@Resource
|
||||
private KeyConfig keyConfig;
|
||||
|
||||
@Resource
|
||||
private IGameSecretKeyService gameSecretKeyService;
|
||||
|
||||
@Resource
|
||||
private IMemberService memberService;
|
||||
|
||||
|
||||
@Autowired
|
||||
@Qualifier("threadPoolTaskExecutor")
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
|
||||
@Resource
|
||||
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
||||
private IPlatformService platformService;
|
||||
|
||||
/**
|
||||
* 创建成员
|
||||
|
@ -98,24 +92,38 @@ public class ApiMemberController extends BaseController {
|
|||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(memberCreateApiRequest.getPlatformCode())
|
||||
.systemCurrency(memberCreateApiRequest.getCurrencyCode()).build());
|
||||
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
Platform platform = platformService.get(memberCreateApiRequest.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
String targetCurrency = platform.getCurrencyInfo().get(memberCreateApiRequest.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(memberCreateApiRequest.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(memberCreateApiRequest.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(memberCreateApiRequest.getPlatformCode())
|
||||
// .systemCurrency(memberCreateApiRequest.getCurrencyCode()).build());
|
||||
|
||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
String gameAccount =memberService.getMemberGameAccount(memberCreateApiRequest.getPlatformCode(), tenantSecretKey.getTenantSn());
|
||||
|
||||
|
||||
// 获取用户信息
|
||||
Member gameMember = memberService.selectMemberByAccount(memberCreateApiRequest.getAccount(), memberCreateApiRequest.getCurrencyCode(), memberCreateApiRequest.getPlatformCode());
|
||||
if (!ObjectUtils.isEmpty(gameMember)){
|
||||
if (!ObjectUtils.isEmpty(gameMember)) {
|
||||
throw new ApiException(ErrorCode.GAME_ACCOUNT_CREATION_FAILED.getCode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//注册本地账号
|
||||
Member member = Member.builder()
|
||||
.tenantKey(tenantSecretKey.getTenantKey())
|
||||
|
@ -130,11 +138,13 @@ public class ApiMemberController extends BaseController {
|
|||
//向第三方注册账号
|
||||
CreateMemberRequestDTO gamesBaseRequestDTO = CreateMemberRequestDTO.builder()
|
||||
.account(gameAccount)
|
||||
.agentId(gameSecretKey.getCode())
|
||||
.agentKey(gameSecretKey.getKey())
|
||||
.agentId(keyInfo.getCode())
|
||||
.agentKey(keyInfo.getKey())
|
||||
.betLimit(memberCreateApiRequest.getBetLimit())
|
||||
.platformType(memberCreateApiRequest.getPlatformType())
|
||||
.currency(gameSecretKey.getCurrency())
|
||||
.currency(targetCurrency)
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build();
|
||||
Boolean result = iGamesService.createMember(gamesBaseRequestDTO);
|
||||
Assert.isTrue(result, "建立游戏账号失败");
|
||||
|
@ -146,35 +156,51 @@ public class ApiMemberController extends BaseController {
|
|||
/**
|
||||
* 获取会员信息
|
||||
*
|
||||
* @param memberInfoApiRequest 成员信息api请求
|
||||
* @param request 成员信息api请求
|
||||
* @return {@link AjaxResult }
|
||||
*/
|
||||
@PostMapping("/info")
|
||||
public AjaxResult getMemberInfo(@Validated @RequestBody MemberInfoApiRequest memberInfoApiRequest) {
|
||||
IGamesService iGamesService = gamesService.get(memberInfoApiRequest.getPlatformCode() + Constants.SERVICE);
|
||||
public AjaxResult getMemberInfo(@Validated @RequestBody MemberInfoApiRequest request) {
|
||||
IGamesService iGamesService = gamesService.get(request.getPlatformCode() + Constants.SERVICE);
|
||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(memberInfoApiRequest.getPlatformCode())
|
||||
.systemCurrency(memberInfoApiRequest.getCurrencyCode()).build());
|
||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
// .platformCode(memberInfoApiRequest.getPlatformCode())
|
||||
// .systemCurrency(memberInfoApiRequest.getCurrencyCode()).build());
|
||||
//
|
||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
Platform platform = platformService.get(request.getPlatformCode());
|
||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
|
||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
||||
// 获取用户信息
|
||||
Member member = memberService.selectMemberByAccount(memberInfoApiRequest.getAccount(), memberInfoApiRequest.getCurrencyCode(), memberInfoApiRequest.getPlatformCode());
|
||||
Member member = memberService.selectMemberByAccount(request.getAccount(), request.getCurrencyCode(), request.getPlatformCode());
|
||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
|
||||
|
||||
|
||||
//向第三方查询账号
|
||||
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
|
||||
.accounts(member.getGameAccount())
|
||||
.agentId(gameSecretKey.getCode())
|
||||
.currency(gameSecretKey.getCurrency())
|
||||
.agentKey(gameSecretKey.getKey())
|
||||
.agentId(keyInfo.getCode())
|
||||
.currency(targetCurrency)
|
||||
.agentKey(keyInfo.getKey())
|
||||
.vendor(platform)
|
||||
.keyInfo(keyInfo)
|
||||
.build();
|
||||
MemberInfoResponseDTO memberInfo = iGamesService.getMemberInfo(gamesBaseRequestDTO);
|
||||
MemberInfoResponse memberInfoResponse = new MemberInfoResponse();
|
||||
|
@ -193,22 +219,49 @@ public class ApiMemberController extends BaseController {
|
|||
public AjaxResult infoAll(@Validated @RequestBody MemberInfoAllApiRequest memberInfoAllApiRequest) {
|
||||
|
||||
|
||||
// List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(
|
||||
// GameSecretKeyCurrencyDTO.builder()
|
||||
// .systemCurrency(memberInfoAllApiRequest.getCurrencyCode()).build());
|
||||
List<Key> keys = new ArrayList<>();
|
||||
for (GamePlatforms platformEnum : GamePlatforms.values()) {
|
||||
|
||||
Platform platform = platformService.get(platformEnum.getCode());
|
||||
String targetCurrency = platform.getCurrencyInfo().get(memberInfoAllApiRequest.getCurrencyCode());
|
||||
if (StringUtils.isEmpty(targetCurrency)) {
|
||||
continue;
|
||||
}
|
||||
KeyInfo keyInfo = null;
|
||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
||||
if (StringUtils.isNotEmpty(memberInfoAllApiRequest.getCurrencyCode())) {
|
||||
if (keyData.getCurrency().equalsIgnoreCase(memberInfoAllApiRequest.getCurrencyCode())) {
|
||||
keyInfo = keyData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null == keyInfo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
||||
.systemCurrency(memberInfoAllApiRequest.getCurrencyCode()).build());
|
||||
|
||||
Key key = new Key();
|
||||
key.setPlatformCode(platform.getPlatformCode());
|
||||
key.setCode(keyInfo.getCode());
|
||||
key.setKey(keyInfo.getKey());
|
||||
key.setCurrency(targetCurrency);
|
||||
keys.add(key);
|
||||
}
|
||||
// 创建线程池
|
||||
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
|
||||
CountDownLatch latch = new CountDownLatch(gameSecretKeys.size());
|
||||
CountDownLatch latch = new CountDownLatch(keys.size());
|
||||
|
||||
// 使用List存储Future对象,用于获取异步执行的结果
|
||||
List<Future<MemberInfoAllResponse>> futures = new ArrayList<>();
|
||||
|
||||
// 提交异步任务到线程池
|
||||
for (GameSecretKeyCurrencyDTO gameSecretKey : gameSecretKeys) {
|
||||
for (Key gameSecretKey : keys) {
|
||||
|
||||
futures.add(threadPoolTaskExecutor.submit(() -> {
|
||||
|
||||
try {
|
||||
IGamesService iGamesService = gamesService.get(gameSecretKey.getPlatformCode() + Constants.SERVICE);
|
||||
|
||||
|
@ -256,5 +309,12 @@ public class ApiMemberController extends BaseController {
|
|||
return AjaxResult.success(balanceMap);
|
||||
}
|
||||
|
||||
@Data
|
||||
class Key {
|
||||
private String platformCode;
|
||||
private String code;
|
||||
private String currency;
|
||||
private String key;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,5 +49,11 @@ public class GameDemoLoginRequest implements Serializable {
|
|||
*/
|
||||
private Integer disableFullScreen;
|
||||
|
||||
/**
|
||||
* 币种
|
||||
*/
|
||||
@NotBlank(message = "currencyCode不能为空")
|
||||
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
|
||||
private String currencyCode;
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ff.base.system.domain.SysDatasource;
|
|||
import com.ff.base.system.mapper.SysDatasourceMapper;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.system.service.ISysDictTypeService;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
|
@ -34,6 +35,9 @@ public class ContentRefreshedEventListener implements ApplicationListener<Contex
|
|||
|
||||
@Resource
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
|
||||
@Resource
|
||||
private IPlatformService platformService;
|
||||
/**
|
||||
* 项目加载时运行
|
||||
*
|
||||
|
@ -50,5 +54,7 @@ public class ContentRefreshedEventListener implements ApplicationListener<Contex
|
|||
}
|
||||
sysConfigService.loadingConfigCache();
|
||||
sysDictTypeService.loadingDictCache();
|
||||
|
||||
platformService.loadToCache();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.ae.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -20,12 +20,12 @@ import javax.annotation.Resource;
|
|||
public class MyAEAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.AE_API_BASE_URL);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"");
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.AE.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "");
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.dg.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -20,12 +20,12 @@ import javax.annotation.Resource;
|
|||
public class MyDGAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.DG_API_BASE_URL);
|
||||
return new ForestAddress("http",apiBaseUrl, 80,"");
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.DG.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("http", apiBaseUrl, 80, "");
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.fc.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -13,12 +13,13 @@ import javax.annotation.Resource;
|
|||
public class MyFCAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
private IPlatformService platformService;
|
||||
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.FC_API_BASE_URL);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"");
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.FC.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,11 @@ package com.ff.game.api.jili.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -19,15 +17,15 @@ import java.util.Random;
|
|||
* @date 2025/02/10
|
||||
*/
|
||||
@Component
|
||||
public class MyJILIAddressSource implements AddressSource {
|
||||
public class MyJILIAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.JILI_API_BASE_URL);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"api1");
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.FC.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "api1");
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.km.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -20,12 +20,12 @@ import javax.annotation.Resource;
|
|||
public class MyKMAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.KM_API_BASE_URL_LOGIN);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"api");
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.KM.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "api");
|
||||
}
|
||||
}
|
|
@ -2,9 +2,7 @@ package com.ff.game.api.km.impl;
|
|||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.druid.support.json.JSONUtils;
|
||||
import com.ff.base.constant.CacheConstants;
|
||||
import com.ff.base.constant.ConfigConstants;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.core.redis.RedisCache;
|
||||
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.StringUtils;
|
||||
import com.ff.base.utils.ip.IpUtils;
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.base.utils.uuid.IdUtils;
|
||||
import com.ff.config.KeyConfig;
|
||||
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.dto.*;
|
||||
import com.ff.game.api.request.*;
|
||||
|
@ -57,6 +50,8 @@ import java.util.stream.Collectors;
|
|||
@Slf4j
|
||||
public class GamesKMServiceImpl implements IGamesService {
|
||||
|
||||
@Resource
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
@ -235,10 +230,10 @@ public class GamesKMServiceImpl implements IGamesService {
|
|||
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 selectConfigByKey + "/gamelauncher?gpcode=" + gamesLogin.getGameType()
|
||||
return loginUrl + "/gamelauncher?gpcode=" + gamesLogin.getGameType()
|
||||
+ "&gcode=" + gamesLogin.getGameId()
|
||||
+ "&token=" + kmUserToken
|
||||
+ "&lang=" + gamesLogin.getLang();
|
||||
|
@ -569,7 +564,7 @@ public class GamesKMServiceImpl implements IGamesService {
|
|||
if (ObjectUtils.isEmpty(kickMember.getErrorCode()) || this.getIsSuccess(kickMember.getErrorCode())) {
|
||||
redisCache.deleteObject(CacheConstants.KM_USER_TOKEN + kickMemberRequestDTO.getAccount());
|
||||
return kickMember.isSuccess();
|
||||
}else {
|
||||
} else {
|
||||
throw new BaseException(kickMember.getDescription());
|
||||
}
|
||||
}
|
||||
|
@ -618,9 +613,10 @@ public class GamesKMServiceImpl implements IGamesService {
|
|||
log.info("GamesKMServiceImpl [gameDemoLogin] 请求参数 {}", gameDemoLoginRequestDTO);
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
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()
|
||||
.url(selectConfigByKey + "/demolauncher?gpcode=" + gameDemoLoginRequestDTO.getGameType()
|
||||
.url(loginUrl + "/demolauncher?gpcode=" + gameDemoLoginRequestDTO.getGameType()
|
||||
+ "&gcode=" + gameDemoLoginRequestDTO.getGameId()
|
||||
+ "&lang=" + gameDemoLoginRequestDTO.getLang())
|
||||
.build();
|
||||
|
@ -683,16 +679,17 @@ public class GamesKMServiceImpl implements IGamesService {
|
|||
return null;
|
||||
}
|
||||
List<KMGameResponse.Game> gamesDatas = redisCache.getCacheList(CacheConstants.KM_GAMES);
|
||||
Map<String, KMGameResponse.Game> dataDTOMap = gamesDatas.stream() .collect(Collectors.toMap(
|
||||
Map<String, KMGameResponse.Game> dataDTOMap = gamesDatas.stream().collect(Collectors.toMap(
|
||||
KMGameResponse.Game::getCode,
|
||||
e -> e,
|
||||
(existing, replacement) -> existing
|
||||
));;
|
||||
));
|
||||
;
|
||||
KMGameResponse.Game gamesDataDTO = dataDTOMap.get(resultBean.getGCode());
|
||||
|
||||
//输赢状态
|
||||
Integer gameStatus = GameStatus.FLAT.getCode();
|
||||
BigDecimal payoffAmount =NumberUtil.sub(resultBean.getWinAmount(), resultBean.getRiskAmount().abs());
|
||||
BigDecimal payoffAmount = NumberUtil.sub(resultBean.getWinAmount(), resultBean.getRiskAmount().abs());
|
||||
if (payoffAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
gameStatus = GameStatus.WIN.getCode();
|
||||
} else if (payoffAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.meitian.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -18,12 +18,12 @@ import javax.annotation.Resource;
|
|||
public class MeiTianAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.MEITIAN_API_BASE_URL);
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.MT.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "services");
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package com.ff.game.api.meitian.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* JiLi游戏纪录查询返回数据类型
|
||||
*
|
||||
* @author shi
|
||||
* @date 2024/10/21
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class JILIBetRecordDataResponseDTO {
|
||||
/**
|
||||
* 账户
|
||||
*/
|
||||
@JsonProperty("Account")
|
||||
private String account;
|
||||
/**
|
||||
* 投注id
|
||||
*/
|
||||
@JsonProperty("WagersId")
|
||||
private String wagersId;
|
||||
/**
|
||||
* 游戏id
|
||||
*/
|
||||
@JsonProperty("GameId")
|
||||
private String gameId;
|
||||
/**
|
||||
* 下注时间
|
||||
*/
|
||||
@JsonProperty("WagersTime")
|
||||
private Long wagersTime;
|
||||
/**
|
||||
* 投注金额
|
||||
*/
|
||||
@JsonProperty("BetAmount")
|
||||
private BigDecimal betAmount;
|
||||
/**
|
||||
* 回报时间
|
||||
*/
|
||||
@JsonProperty("PayoffTime")
|
||||
private Long payoffTime;
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
@JsonProperty("PayoffAmount")
|
||||
private BigDecimal payoffAmount;
|
||||
/**
|
||||
* 注单状态 1: 赢 2: 输 3: 平局
|
||||
*/
|
||||
@JsonProperty("Status")
|
||||
private int status;
|
||||
/**
|
||||
* 结算时间
|
||||
*/
|
||||
@JsonProperty("SettlementTime")
|
||||
private Long settlementTime;
|
||||
/**
|
||||
* 游戏类别id
|
||||
*/
|
||||
@JsonProperty("GameCategoryId")
|
||||
private int gameCategoryId;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@JsonProperty("Type")
|
||||
private int type;
|
||||
/**
|
||||
* 代理id
|
||||
*/
|
||||
@JsonProperty("AgentId")
|
||||
private String agentId;
|
||||
/**
|
||||
* 有效投注金额
|
||||
*/
|
||||
@JsonProperty("Turnover")
|
||||
private BigDecimal turnover;
|
||||
/**
|
||||
* 圆形指数
|
||||
*/
|
||||
@JsonProperty("RoundIndex")
|
||||
private long roundIndex;
|
||||
}
|
|
@ -76,10 +76,6 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
@Resource
|
||||
private IMemberService memberService;
|
||||
|
||||
|
||||
@Resource
|
||||
private IGameSecretKeyService gameSecretKeyService;
|
||||
|
||||
@Resource
|
||||
private MeiTianClient meiTianClient;
|
||||
|
||||
|
@ -112,11 +108,10 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean createMember(CreateMemberRequestDTO createMemberRequestDTO) {
|
||||
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyByCode(createMemberRequestDTO.getAgentId());
|
||||
|
||||
String playerName = createMemberRequestDTO.getAccount();
|
||||
String merchantId = createMemberRequestDTO.getAgentId();
|
||||
String md5Password = Md5Utils.md5New(gameSecretKey.getPassword());
|
||||
String md5Password = Md5Utils.md5New(createMemberRequestDTO.getKeyInfo().getPassword());
|
||||
Map<String, String> rawMap = new LinkedHashMap<>();
|
||||
rawMap.put("nickname", createMemberRequestDTO.getAccount());
|
||||
rawMap.put("playerLevel", "0");
|
||||
|
@ -128,7 +123,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
log.error("[MeiTian] encode rawData failure", e);
|
||||
throw new ApiException(ErrorCode.ERROR.getCode());
|
||||
}
|
||||
String md5Code = Md5Utils.md5New(gameSecretKey.getKey() + rawData);//MD5(key+rawData);
|
||||
String md5Code = Md5Utils.md5New(createMemberRequestDTO.getKeyInfo().getKey() + rawData);//MD5(key+rawData);
|
||||
MeiTianCreateMemberResponseDTO createMemberResponseDTO =
|
||||
meiTianClient.createMember(
|
||||
playerName,
|
||||
|
@ -181,11 +176,10 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public String loginWithoutRedirect(GamesLogin gamesLogin) {
|
||||
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyByCode(gamesLogin.getAgentId());
|
||||
|
||||
String merchantId = gamesLogin.getAgentId();
|
||||
String playerName = gamesLogin.getAccount();
|
||||
String md5Password = Md5Utils.md5New(gameSecretKey.getPassword());
|
||||
String md5Password = Md5Utils.md5New(gamesLogin.getKeyInfo().getPassword());
|
||||
Map<String, String> rawMap = new LinkedHashMap<>();
|
||||
/*rawMap.put("gameHall ", gamesLogin.getGameType());*/
|
||||
rawMap.put("gameCode", gamesLogin.getGameId());
|
||||
|
@ -200,7 +194,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
log.error("[MeiTian] encode rawData failure", e);
|
||||
throw new ApiException(ErrorCode.ERROR.getCode());
|
||||
}
|
||||
String code = Md5Utils.md5New(gameSecretKey.getKey() + rawData);
|
||||
String code = Md5Utils.md5New(gamesLogin.getKeyInfo().getKey() + rawData);
|
||||
MeiTianLoginResultDTO loginWithoutRedirectResponseDTO =
|
||||
meiTianClient.loginWithoutRedirect(
|
||||
merchantId,
|
||||
|
@ -238,12 +232,12 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
for (MeiTianGameDataDTO gamesDataDTO : gameList.getData()) {
|
||||
GamePlatform gamePlatform = GamePlatform.builder()
|
||||
.platformType(MeiTianGameType.findSystemByCode(gamesDataDTO.getGameCategoryId()))
|
||||
.platformCode(GamePlatforms.MeiTian.getCode())
|
||||
.platformCode(GamePlatforms.MT.getCode())
|
||||
.build();
|
||||
List<GamePlatform> gamePlatforms = gamePlatformService.selectGamePlatformList(gamePlatform);
|
||||
//没有此平台就新增一个平台
|
||||
if (CollectionUtils.isEmpty(gamePlatforms)) {
|
||||
gamePlatform.setPlatformName(GamePlatforms.MeiTian.getInfo() + MeiTianGameType.findInfoByCode(gamesDataDTO.getGameCategoryId()));
|
||||
gamePlatform.setPlatformName(GamePlatforms.MT.getInfo() + MeiTianGameType.findInfoByCode(gamesDataDTO.getGameCategoryId()));
|
||||
gamePlatform.setSortNo(gamePlatformService.selectMaxSortNo() + 1);
|
||||
gamePlatform.setCreateBy(Constants.SYSTEM);
|
||||
gamePlatformService.insertGamePlatform(gamePlatform);
|
||||
|
@ -309,7 +303,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
.currency(exchangeTransferMoneyRequestDTO.getCurrency()).build());
|
||||
|
||||
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
|
||||
String transactionId = GamePlatforms.MeiTian.getCode() + IdUtils.simpleUUID();
|
||||
String transactionId = GamePlatforms.MT.getCode() + IdUtils.simpleUUID();
|
||||
|
||||
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
|
||||
GameExchangeMoney.builder()
|
||||
|
@ -331,7 +325,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
.currencyCode(gameSecretKey.getSystemCurrency())
|
||||
.memberId(member.getId())
|
||||
.transactionId(transactionId)
|
||||
.platformCode(GamePlatforms.MeiTian.getCode())
|
||||
.platformCode(GamePlatforms.MT.getCode())
|
||||
.build();
|
||||
exchangeMoney.setCreateBy(Constants.SYSTEM);
|
||||
//接口限制限制50字符
|
||||
|
@ -439,7 +433,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
}
|
||||
|
||||
boolean doSyncRecordByRecordID(BetRecordByTimeDTO betRecordByTimeDTO) {
|
||||
String configKey = GamePlatforms.MeiTian.getCode() + ":lastRecordID";
|
||||
String configKey = GamePlatforms.MT.getCode() + ":lastRecordID";
|
||||
String lastRecordID = sysConfigServiceImpl.selectConfigByKey(configKey);
|
||||
long recordID = 0;
|
||||
if (lastRecordID == null || lastRecordID.isEmpty()) {
|
||||
|
@ -496,7 +490,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
boolean doSyncRecordByDate(BetRecordByTimeDTO betRecordByTimeDTO, int daysToSubtract) {
|
||||
|
||||
String date = getDateStr(daysToSubtract);
|
||||
String configKey = GamePlatforms.MeiTian.getCode() + ":lastSyncDate";
|
||||
String configKey = GamePlatforms.MT.getCode() + ":lastSyncDate";
|
||||
String syncDateStr = sysConfigServiceImpl.selectConfigByKey(configKey);
|
||||
Map<String, Long> syncDateMap = new HashMap<>();
|
||||
long recordID = 0;
|
||||
|
@ -597,9 +591,8 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public GetGameDetailResponseDTO getGameDetail(GetGameDetailRequestDTO getGameDetailRequestDTO) {
|
||||
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyByCode(getGameDetailRequestDTO.getAgentId());
|
||||
|
||||
String key = gameSecretKey.getKey();
|
||||
String key = getGameDetailRequestDTO.getKeyInfo().getKey();
|
||||
String merchantId = getGameDetailRequestDTO.getAgentId();
|
||||
Map<String, String> rawMap = new LinkedHashMap<>();
|
||||
rawMap.put("rowID", getGameDetailRequestDTO.getWagersId());
|
||||
|
@ -721,7 +714,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
}
|
||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||
//查询重复数据id
|
||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds, GamePlatforms.MeiTian.getCode());
|
||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds, GamePlatforms.MT.getCode());
|
||||
//用steam流清除list中与wagersIds集合相同的数据
|
||||
gameBettingDetails = gameBettingDetails.stream()
|
||||
.filter(detail -> !removeWagersIds.contains(detail.getWagersId()))
|
||||
|
@ -747,7 +740,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
GameSecretKeyCurrencyDTO gameSecretKey =
|
||||
gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.currency(dataBean.getCurrency())
|
||||
.platformCode(GamePlatforms.MeiTian.getCode()).build());
|
||||
.platformCode(GamePlatforms.MT.getCode()).build());
|
||||
|
||||
|
||||
Member member = memberService.selectMemberByGameAccount(dataBean.getPlayerName());
|
||||
|
@ -769,7 +762,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
|||
.memberId(member.getId())
|
||||
.gameCode(dataBean.getGameCode())
|
||||
.gameType(MeiTianGameType.findSystemByCode(Integer.parseInt(dataBean.getGameType())))
|
||||
.platformCode(GamePlatforms.MeiTian.getCode())
|
||||
.platformCode(GamePlatforms.MT.getCode())
|
||||
.gameId(gamesDataDTO.getSystemGameId())
|
||||
.gameName(gamesDataDTO.getCnName())
|
||||
.gameStatus(compareResult > 0 ? GameStatus.WIN.getCode() : compareResult < 0 ? GameStatus.FAIL.getCode() : GameStatus.FLAT.getCode())
|
||||
|
|
|
@ -3,22 +3,24 @@ package com.ff.game.api.ng.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
public class MyNGAddressSource implements AddressSource {
|
||||
public class MyNGAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
private IPlatformService platformService;
|
||||
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.NG_API_BASE_URL);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"api");
|
||||
//String apiBaseUrl = configService.selectConfigByKey(Constants.NG_API_BASE_URL);
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.PG.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "api");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.ff.game.api.ng.service.impl;
|
|||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.ff.base.config.RedisConfig;
|
||||
import com.ff.base.constant.CacheConstants;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.core.redis.RedisCache;
|
||||
|
@ -11,19 +10,14 @@ import com.ff.base.exception.base.ApiException;
|
|||
import com.ff.base.exception.base.BaseException;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.utils.DateUtils;
|
||||
import com.ff.base.utils.JsonUtil;
|
||||
import com.ff.base.utils.SleepUtil;
|
||||
import com.ff.base.utils.StringUtils;
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.base.utils.uuid.IdUtils;
|
||||
import com.ff.config.KeyConfig;
|
||||
import com.ff.game.api.IGamesService;
|
||||
import com.ff.game.api.jili.dto.*;
|
||||
import com.ff.game.api.ng.client.NGClient;
|
||||
import com.ff.game.api.ng.dto.*;
|
||||
import com.ff.game.api.request.*;
|
||||
import com.ff.game.api.xk.dto.XKBetRecordResponseDTO;
|
||||
import com.ff.game.api.xk.dto.XKGamesDTO;
|
||||
import com.ff.game.domain.*;
|
||||
import com.ff.game.dto.*;
|
||||
import com.ff.game.service.*;
|
||||
|
@ -42,15 +36,12 @@ import org.springframework.util.ObjectUtils;
|
|||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.security.SecureRandom;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
@ -228,7 +219,7 @@ public class GamesPGServiceImpl implements IGamesService {
|
|||
paramsMap.put("lang", gamesLogin.getLang());
|
||||
paramsMap.put("gameCode", gamesLogin.getGameId());
|
||||
paramsMap.put("returnUrl", gamesLogin.getHomeUrl());
|
||||
paramsMap.put("ingress", PlatformHomeType.WEB.getValue().equals(gamesLogin.getPlatform()) ? IngressType.PC_WEB.getValue() : IngressType.MOBILE_WEB.getValue());
|
||||
paramsMap.put("ingress", PlatformHomeType.WEB.getValue().equals(gamesLogin.getVendor()) ? IngressType.PC_WEB.getValue() : IngressType.MOBILE_WEB.getValue());
|
||||
Map<String, String> headerMap = this.getKey(gamesLogin);
|
||||
ApiNGResponseDTO<ApiLoginResponseDTO> apiLoginResponseDTOApiNGResponseDTO = ngClient.loginWithoutRedirect(paramsMap, headerMap);
|
||||
if (this.getIsSuccess(apiLoginResponseDTOApiNGResponseDTO.getCode())) {
|
||||
|
|
|
@ -58,8 +58,8 @@ public interface PGTClient {
|
|||
* @param parameters 范围
|
||||
* @return {@link PGXGameLoginResponse }
|
||||
*/
|
||||
@Post("/launchGames.aspx?${parameters}")
|
||||
PGXGameLoginResponse loginWithoutRedirect(@Var("parameters") String parameters);
|
||||
@Post("/logIn")
|
||||
PGXGameLoginResponse loginWithoutRedirect(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ public class GamesPGTServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public String loginWithoutRedirect(GamesLogin gamesLogin) {
|
||||
log.info("GamesPGXServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
|
||||
log.info("GamesPGTServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
|
||||
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyByCode(gamesLogin.getAgentId());
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("operatorcode", gamesLogin.getAgentId());
|
||||
|
@ -191,7 +191,7 @@ public class GamesPGTServiceImpl implements IGamesService {
|
|||
params.put("lang", gamesLogin.getLang());
|
||||
params.put("html5", 1);
|
||||
params.put("signature", key);
|
||||
PGXGameLoginResponse PGXGameLoginResponse = pgtClient.loginWithoutRedirect(JsonUtil.mapToQueryString(params));
|
||||
PGXGameLoginResponse PGXGameLoginResponse = pgtClient.loginWithoutRedirect(params,key);
|
||||
//判断是否获取成功
|
||||
if (this.getIsSuccess(PGXGameLoginResponse.getErrCode())) {
|
||||
return PGXGameLoginResponse.getGameUrl();
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.pgx.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -20,12 +20,13 @@ import javax.annotation.Resource;
|
|||
public class MyPGXAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.PGX_API_BASE_URL);
|
||||
return new ForestAddress("http",apiBaseUrl, 80,"");
|
||||
// String apiBaseUrl = configService.selectConfigByKey(Constants.PGX_API_BASE_URL);
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.PGX.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("http", apiBaseUrl, 80, "");
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package com.ff.game.api.request;
|
||||
|
||||
import com.ff.game.domain.KeyInfo;
|
||||
import com.ff.game.domain.Platform;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
@ -36,12 +37,14 @@ public class GamesBaseRequestDTO implements Serializable {
|
|||
private String query;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 货币
|
||||
*/
|
||||
private String currency;
|
||||
|
||||
private Platform vendor;
|
||||
|
||||
private KeyInfo keyInfo;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.sa.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -20,12 +20,14 @@ import javax.annotation.Resource;
|
|||
public class MySAAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
private IPlatformService platformService;
|
||||
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.SA_API_BASE_URL);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"api");
|
||||
// String apiBaseUrl = configService.selectConfigByKey(Constants.SA_API_BASE_URL);
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.SA.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "api");
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.xk.address;
|
|||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -20,12 +20,13 @@ import javax.annotation.Resource;
|
|||
public class MyXKAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.XK_API_BASE_URL);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"api");
|
||||
// String apiBaseUrl = configService.selectConfigByKey(Constants.XK_API_BASE_URL);
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.XK.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "api");
|
||||
}
|
||||
}
|
|
@ -11,7 +11,6 @@ import com.ff.base.exception.base.BaseException;
|
|||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.utils.DateUtils;
|
||||
import com.ff.base.utils.JsonUtil;
|
||||
import com.ff.base.utils.MessageUtils;
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.base.utils.uuid.IdUtils;
|
||||
import com.ff.config.KeyConfig;
|
||||
|
@ -210,7 +209,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
|||
params.put("key", key);
|
||||
params.put("disableFullScreen", gamesLogin.getDisableFullScreen());
|
||||
params.put("homeUrl", gamesLogin.getHomeUrl());
|
||||
params.put("platform", gamesLogin.getPlatform());
|
||||
params.put("platform", gamesLogin.getVendor());
|
||||
XKLoginWithoutRedirectResponseDTO xkLoginWithoutRedirectResponseDTO = xkClient.loginWithoutRedirect(params);
|
||||
//判断是否获取成功
|
||||
if (this.getIsSuccess(xkLoginWithoutRedirectResponseDTO.getCode())) {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.ff.game.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
public class CurrencyInfo extends HashMap<String, String> implements Serializable {
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|||
import com.ff.base.annotation.Excel;
|
||||
import com.ff.base.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
@ -20,24 +19,31 @@ import lombok.experimental.SuperBuilder;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class Game extends BaseEntity
|
||||
{
|
||||
public class Game extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 排序 */
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Excel(name = "排序")
|
||||
private Integer sortNo;
|
||||
|
||||
/** 游戏平台id */
|
||||
/**
|
||||
* 游戏平台id
|
||||
*/
|
||||
@Excel(name = "游戏平台id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long platformId;
|
||||
|
||||
/** 游戏第三方id */
|
||||
/**
|
||||
* 游戏第三方id
|
||||
*/
|
||||
@Excel(name = "游戏第三方id")
|
||||
private String gameCode;
|
||||
|
||||
|
@ -46,27 +52,44 @@ public class Game extends BaseEntity
|
|||
*/
|
||||
private Integer ingress;
|
||||
|
||||
/** 第三方来源分类 */
|
||||
/**
|
||||
* 第三方来源分类
|
||||
*/
|
||||
@Excel(name = "第三方来源分类")
|
||||
private String gameSourceType;
|
||||
|
||||
/** 游戏名称 */
|
||||
/**
|
||||
* 游戏名称
|
||||
*/
|
||||
@Excel(name = "游戏名称")
|
||||
private String gameName;
|
||||
|
||||
/** 是否支持免费游戏 1 支持 0 不支持 */
|
||||
/**
|
||||
* 是否支持免费游戏 1 支持 0 不支持
|
||||
*/
|
||||
@Excel(name = "是否支持免费游戏 1 支持 0 不支持")
|
||||
private Boolean freespin;
|
||||
|
||||
/** 是否支持试玩 0关闭 1开启 */
|
||||
/**
|
||||
* 是否支持试玩 0关闭 1开启
|
||||
*/
|
||||
@Excel(name = "是否支持试玩 0关闭 1开启")
|
||||
private Boolean demoStatus;
|
||||
|
||||
/** 维护开关 维护状态 */
|
||||
/**
|
||||
* 维护开关 维护状态
|
||||
*/
|
||||
@Excel(name = "维护开关 ")
|
||||
private Boolean stopStatus;
|
||||
|
||||
/**
|
||||
* 平台code
|
||||
*/
|
||||
private String platformCode;
|
||||
|
||||
|
||||
/**
|
||||
* 平台类型
|
||||
*/
|
||||
private Integer platformType;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.ff.game.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 其它字段按需加
|
||||
*
|
||||
* @author cengy
|
||||
*/
|
||||
@Data
|
||||
public class KeyInfo implements Serializable {
|
||||
|
||||
private String code;
|
||||
private String key;
|
||||
private String currency;
|
||||
private String password;
|
||||
private String providerCode;
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.ff.game.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
public class LangInfo extends HashMap<String, String> implements Serializable {
|
||||
|
||||
public String get(String lang) {
|
||||
return super.get(lang);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.ff.game.domain;
|
||||
|
||||
import com.ff.base.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
@Data
|
||||
public class Platform extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortNo;
|
||||
/**
|
||||
* 平台code
|
||||
*/
|
||||
private String platformCode;
|
||||
/**
|
||||
* 平台名称
|
||||
*/
|
||||
private String platformName;
|
||||
|
||||
/**
|
||||
* 状态:true:启用 false:停用
|
||||
*/
|
||||
private Boolean stopStatus;
|
||||
|
||||
private List<PlatformInfo> platformInfo;
|
||||
private List<KeyInfo> keyInfo;
|
||||
private LangInfo langInfo;
|
||||
private CurrencyInfo currencyInfo;
|
||||
private UrlInfo urlInfo;
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.ff.game.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
@Data
|
||||
public class PlatformInfo implements Serializable {
|
||||
private String code;
|
||||
private String name;
|
||||
private int type;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.ff.game.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
@Data
|
||||
public class UrlInfo implements Serializable {
|
||||
|
||||
private String url;
|
||||
private String loginUrl;
|
||||
private String hallCode;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.ff.game.mapper;
|
||||
|
||||
import com.ff.game.domain.Platform;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
public interface PlatformMapper {
|
||||
|
||||
|
||||
List<Platform> selectList(Platform platform);
|
||||
|
||||
Platform selectByPlatformCode(String platformCode);
|
||||
|
||||
int updatePlatform(Platform platform);
|
||||
|
||||
int insertPlatform(Platform platform);
|
||||
|
||||
int deleteById(Long id);
|
||||
|
||||
int deleteByIds(String ids);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.ff.game.service;
|
||||
|
||||
import com.ff.game.domain.Platform;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
public interface IPlatformService {
|
||||
|
||||
List<Platform> selectList(Platform platform);
|
||||
|
||||
Platform selectByPlatformCode(String platformCode);
|
||||
|
||||
int updatePlatform(Platform platform);
|
||||
|
||||
int insertPlatform(Platform platform);
|
||||
|
||||
int deleteById(Long id);
|
||||
|
||||
int deleteByIds(String ids);
|
||||
|
||||
void loadToCache();
|
||||
|
||||
Platform get(String platformCode);
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.ff.game.service.impl;
|
||||
|
||||
import com.ff.base.constant.CacheConstants;
|
||||
import com.ff.base.core.redis.RedisCache;
|
||||
import com.ff.base.datasource.DynamicDataSourceContextHolder;
|
||||
import com.ff.game.domain.Platform;
|
||||
import com.ff.game.mapper.PlatformMapper;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
@Service
|
||||
public class PlatformServiceImpl implements IPlatformService {
|
||||
|
||||
@Autowired
|
||||
PlatformMapper platformMapper;
|
||||
@Autowired
|
||||
RedisCache redisCache;
|
||||
|
||||
@Override
|
||||
public List<Platform> selectList(Platform platform) {
|
||||
return platformMapper.selectList(platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Platform selectByPlatformCode(String platformCode) {
|
||||
return platformMapper.selectByPlatformCode(platformCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updatePlatform(Platform platform) {
|
||||
return platformMapper.updatePlatform(platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertPlatform(Platform platform) {
|
||||
return platformMapper.insertPlatform(platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteById(Long id) {
|
||||
return platformMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByIds(String ids) {
|
||||
return platformMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadToCache() {
|
||||
Map<Object, DataSource> resolvedDataSources = DynamicDataSourceContextHolder.getAllDataSource();
|
||||
for (Map.Entry<Object, DataSource> entry : resolvedDataSources.entrySet()) {
|
||||
Object key = entry.getKey();
|
||||
// 设置数据源类型
|
||||
DynamicDataSourceContextHolder.setDataSourceType(key.toString());
|
||||
List<Platform> list = selectList(new Platform());
|
||||
for (Platform pp : list) {
|
||||
redisCache.setCacheObject(getCacheKey(pp.getPlatformCode()), pp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Platform get(String platformCode) {
|
||||
return redisCache.getCacheObject(getCacheKey(platformCode));
|
||||
}
|
||||
|
||||
private String getCacheKey(String configKey) {
|
||||
return CacheConstants.Platform + configKey;
|
||||
}
|
||||
}
|
|
@ -220,7 +220,7 @@ public class GameTask {
|
|||
Long endTime = DateUtils.getNowDate();
|
||||
|
||||
//捞取指定分钟前的数据
|
||||
gameService.insertGameBettingDetails(startTime, endTime, GamePlatforms.MeiTian.getCode());
|
||||
gameService.insertGameBettingDetails(startTime, endTime, GamePlatforms.MT.getCode());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.ff.sports.api.fb.address;
|
||||
|
||||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* @author shi
|
||||
* @date 2025/02/10
|
||||
*/
|
||||
@Component
|
||||
public class FbAddress implements AddressSource {
|
||||
|
||||
public static final String API_BASE_URL = "fb.api.base.url";
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(API_BASE_URL);
|
||||
return new ForestAddress("https", apiBaseUrl, 443, "services");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.ff.sports.fb;
|
||||
|
||||
/**
|
||||
* @author cengy
|
||||
*/
|
||||
public class A {
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ff.game.mapper.PlatformMapper">
|
||||
|
||||
<resultMap type="Platform" id="PlatformResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sortNo" column="sort_no" />
|
||||
<result property="platformCode" column="platform_code" />
|
||||
<result property="platformName" column="platform_name" />
|
||||
<result property="platformInfo" column="platform_info" typeHandler="com.ff.base.handler.JsonListHandler" javaType="com.ff.game.domain.PlatformInfo"/>
|
||||
<result property="urlInfo" column="url_info" typeHandler="com.ff.base.handler.JsonHandler" javaType="com.ff.game.domain.UrlInfo"/>
|
||||
<result property="keyInfo" column="key_info" typeHandler="com.ff.base.handler.JsonListHandler" javaType="com.ff.game.domain.KeyInfo"/>
|
||||
<result property="langInfo" column="lang_info" typeHandler="com.ff.base.handler.JsonHandler" javaType="com.ff.game.domain.LangInfo"/>
|
||||
<result property="currencyInfo" column="currency_info" typeHandler="com.ff.base.handler.JsonHandler" javaType="com.ff.game.domain.CurrencyInfo"/>
|
||||
<result property="stopStatus" column="stop_status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVO">
|
||||
select * from ff_platform
|
||||
</sql>
|
||||
|
||||
<select id="selectList" parameterType="Platform" resultMap="PlatformResult">
|
||||
<include refid="selectVO"/>
|
||||
<where>
|
||||
<if test="platformCode != null and platformCode != ''"> and platform_code = #{platformCode}</if>
|
||||
<if test="platformName != null and platformName != ''"> and instr(platform_name,#{platformName}) > 0</if>
|
||||
<if test="stopStatus != null"> and stop_status = #{stopStatus}</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByPlatformCode" parameterType="String" resultMap="PlatformResult">
|
||||
<include refid="selectVO"/>
|
||||
where platform_code = #{platformCode}
|
||||
</select>
|
||||
<insert id="insertPlatform" parameterType="Platform">
|
||||
insert into ff_platform
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="sortNo != null">sort_no,</if>
|
||||
<if test="platformCode != null and platformCode != ''">platform_code,</if>
|
||||
<if test="platformName != null and platformName != ''">platform_name,</if>
|
||||
<if test="platformInfo != null and platformInfo != ''">platform_info,</if>
|
||||
<if test="urlInfo != null and urlInfo != ''">url_info,</if>
|
||||
|
||||
<if test="keyInfo != null and keyInfo != ''">key_info,</if>
|
||||
<if test="langInfo != null and langInfo != ''">lang_info,</if>
|
||||
<if test="currencyInfo != null and currencyInfo != ''">currency_info,</if>
|
||||
<if test="stopStatus != null">stop_status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="sortNo != null">#{sortNo}</if>
|
||||
<if test="platformCode != null and platformCode != ''">#{platformCode},</if>
|
||||
<if test="platformName != null and platformName != ''">#{platformName},</if>
|
||||
<if test="platformInfo != null and platformInfo != ''">#{platformInfo},</if>
|
||||
<if test="urlInfo != null and urlInfo != ''">#{urlInfo},</if>
|
||||
<if test="keyInfo != null and keyInfo != ''">#{keyInfo},</if>
|
||||
<if test="langInfo != null and langInfo != ''">#{langInfo},</if>
|
||||
<if test="currencyInfo != null and currencyInfo != ''">#{currencyInfo},</if>
|
||||
<if test="stopStatus != null">#{stopStatus},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePlatform" parameterType="Platform">
|
||||
update ff_platform
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sortNo != null">sort_no = #{sortNo},</if>
|
||||
<if test="platformCode != null and platformCode != ''">platform_code = #{platformCode},</if>
|
||||
<if test="platformName != null and platformName != ''">platform_name = #{platformName},</if>
|
||||
<if test="platformInfo != null and platformInfo != ''">platform_info = #{platformInfo},</if>
|
||||
<if test="urlInfo != null and urlInfo != ''">url_info = #{urlInfo},</if>
|
||||
|
||||
<if test="keyInfo != null and keyInfo != ''">key_info = #{keyInfo},</if>
|
||||
<if test="langInfo != null and langInfo != ''">lang_info = #{langInfo},</if>
|
||||
<if test="currencyInfo != null and currencyInfo != ''">currency_info = #{currencyInfo},</if>
|
||||
<if test="stopStatus != null">stop_status = #{stopStatus},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById" parameterType="Long">
|
||||
delete from ff_platform where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByIds" parameterType="String">
|
||||
delete from ff_platform where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue