Compare commits

..

No commits in common. "3ce8dba98f9630a29345d695c7946e2a0129adee" and "e020b73282f4fbd57cadb7f0e4c18697c09be714" have entirely different histories.

44 changed files with 507 additions and 1130 deletions

View File

@ -100,8 +100,6 @@ public class CacheConstants {
public static final String MeiTian_GAMES = "meitian_games:";
public static final String Platform = "platform:";
/**
* km
*/

View File

@ -178,6 +178,65 @@ 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-apiurl
*/
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-apiurl
*/
public static final String PGX_API_BASE_URL = "gpx.api.base.url";
/**
* dg-apiurl
*/
public static final String DG_API_BASE_URL = "dg.api.base.url";
/**
* ae apiurl
*/
public static final String AE_API_BASE_URL = "ae.api.base.url";
/**
* sa-apiurl
*/
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-apiurl
*/
public static final String KM_API_BASE_URL_LOGIN = "km.api.base.url";
/**
* km-apiurl
*/
public static final String KM_API_BASE_LOGIN_URL = "km.api.base.login.url";
/**
*

View File

@ -11,7 +11,7 @@ public enum GamePlatforms {
FC("FC", "FC"),
SA("SA", "SA"),
DG("DG", "DG"),
MT("MT", "美天棋牌"),
MeiTian("MeiTian","美天棋牌"),
AE("AE", "AE"),
KM("KM", "KM"),
PGT("PGT", "PGT"),
@ -20,14 +20,16 @@ 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());
@ -35,11 +37,13 @@ public enum GamePlatforms {
return result;
}
public String getCode() {
public String getCode()
{
return code;
}
public String getInfo() {
public String getInfo()
{
return info;
}

View File

@ -21,8 +21,7 @@ public enum PlatformType {
VIDEO(6, "视讯"),
LOTTERY(7, "彩票"),
SPORTS(8, "体育"),
HUNTING(9, "捕猎"),
BaiRen(10, "百人场");
HUNTING(9, "捕猎");
private final int code;
private final String name;

View File

@ -1,59 +0,0 @@
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;
}
}

View File

@ -1,64 +0,0 @@
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);
}
}

View File

@ -4,6 +4,7 @@ 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;
@ -14,23 +15,27 @@ 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");
@ -58,24 +63,30 @@ public class Md5Utils {
return null;
}
String result = "";
try {
try{
MessageDigest md5 = MessageDigest.getInstance("MD5");
result = Base64.encode(md5.digest(str.getBytes(StandardCharsets.UTF_8)));
} catch (Exception e) {
log.error("encoderByMd5...{}", str, e);
BASE64Encoder base64en = new BASE64Encoder();
result = base64en.encode(md5.digest(str.getBytes(StandardCharsets.UTF_8)));
}catch (Exception e){
log.error("encoderByMd5...{0}", 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));
@ -83,11 +94,15 @@ 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;
}
}

View File

@ -16,6 +16,7 @@
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -9,14 +9,12 @@ 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.ErrorCode;
import com.ff.base.enums.GamePlatforms;
import com.ff.base.enums.TransferType;
import com.ff.base.enums.*;
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;
@ -25,16 +23,18 @@ 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,12 +45,10 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
/**
* api
@ -76,9 +74,16 @@ 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;
@ -93,12 +98,17 @@ 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;
/**
*
@ -108,20 +118,11 @@ public class ApiGameController extends BaseController {
@PostMapping("/list")
public AjaxResult list() {
List<GameResponse> gameResponses = gameService.selectGameResponseList();
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());
for (GameResponse gameRespons : gameResponses) {
List<String> currencyCode = new ArrayList<>(platform.getCurrencyInfo().keySet());
gameResponse.setCurrencyCode(currencyCode);
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);
}
return AjaxResult.success(gameResponses);
}
@ -130,67 +131,50 @@ public class ApiGameController extends BaseController {
/**
*
*
* @param loginRequest
* @param memberCreateApiRequest api
* @return {@link AjaxResult }
*/
@PostMapping("/login")
public AjaxResult login(@Validated @RequestBody GameLoginRequest loginRequest) {
public AjaxResult login(@Validated @RequestBody GameLoginRequest memberCreateApiRequest) {
Game game = gameService.selectGameById(loginRequest.getGameId());
Game game = gameService.selectGameById(memberCreateApiRequest.getGameId());
ApiException.notNull(game, ErrorCode.GAME_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());
GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(game.getPlatformId());
ApiException.notNull(gamePlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
Member member = memberService.selectMemberByAccount(loginRequest.getAccount(), loginRequest.getCurrencyCode(), platform.getPlatformCode());
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());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
GamesLogin gamesLogin = GamesLogin.builder()
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.agentId(secretKeyCurrencyDTO.getCode())
.agentKey(secretKeyCurrencyDTO.getKey())
.account(member.getGameAccount())
.gameType(game.getGameSourceType())
.currency(/*secretKeyCurrencyDTO.getCurrency()*/targetCurrency)
.currency(secretKeyCurrencyDTO.getCurrency())
.gameId(game.getGameCode())
.homeUrl(loginRequest.getHomeUrl())
.betLimit(loginRequest.getBetLimit())
.platform(loginRequest.getPlatform())
.disableFullScreen(loginRequest.getDisableFullScreen())
.lang(/*gameSecretKeyLangDTO.getLang()*/ targetLang)
.vendor(platform)
.keyInfo(keyInfo)
.homeUrl(memberCreateApiRequest.getHomeUrl())
.betLimit(memberCreateApiRequest.getBetLimit())
.platform(memberCreateApiRequest.getPlatform())
.disableFullScreen(memberCreateApiRequest.getDisableFullScreen())
.lang(gameSecretKeyLangDTO.getLang())
.build();
String login = iGamesService.loginWithoutRedirect(gamesLogin);
@ -209,33 +193,17 @@ 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());
//
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
.systemCurrency(gameExchangeBalanceRequest.getCurrencyCode()).build());
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());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
BigDecimal quota = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
@ -254,17 +222,15 @@ public class ApiGameController extends BaseController {
//操作第三方额度接口
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey())
.orderId(gameExchangeBalanceRequest.getOrderId())
.account(member.getGameAccount())
.currency(/*gameSecretKey.getCurrency()*/targetCurrency)
.currency(gameSecretKey.getCurrency())
.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);
@ -310,27 +276,12 @@ 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());
Platform platform = platformService.get(gameCreateFreeSpinRequest.getPlatformCode());
ApiException.notNull(platform, 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());
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());
@ -338,17 +289,15 @@ public class ApiGameController extends BaseController {
CreateFreeSpinRequestDTO createFreeSpinRequestDTO = CreateFreeSpinRequestDTO.builder()
.account(member.getGameAccount())
.currency(/*gameCreateFreeSpinRequest.getCurrencyCode()*/targetCurrency)
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.currency(gameCreateFreeSpinRequest.getCurrencyCode())
.agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey())
.referenceId(gameCreateFreeSpinRequest.getReferenceId())
.freeSpinValidity(gameCreateFreeSpinRequest.getFreeSpinValidity())
.numberOfRounds(gameCreateFreeSpinRequest.getNumberOfRounds())
.gameIds(gameCreateFreeSpinRequest.getGameIds())
.betValue(gameCreateFreeSpinRequest.getBetValue())
.startTime(gameCreateFreeSpinRequest.getStartTime())
.vendor(platform)
.keyInfo(keyInfo)
.build();
@ -401,52 +350,32 @@ 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());
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
.platformCode(gameGetDetailRequest.getPlatformCode())
.systemCurrency(gameGetDetailRequest.getCurrencyCode()).build());
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()*/targetLang)
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.vendor(platform)
.keyInfo(keyInfo)
.lang(gameSecretKeyLang.getLang())
.agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey())
.build());
return AjaxResult.success(gameDetail);
}
@ -459,80 +388,44 @@ 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());
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());
Member member = memberService.selectMemberByAccount(gameKickMemeberRequest.getAccount(), gameKickMemeberRequest.getCurrencyCode(), gameKickMemeberRequest.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_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(keyInfo.getCode())
.currency(targetCurrency)
.agentKey(keyInfo.getKey())
.vendor(platform)
.keyInfo(keyInfo)
.agentId(gameSecretKey.getCode())
.currency(gameSecretKey.getCurrency())
.agentKey(gameSecretKey.getKey())
.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());
//
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Platform platform = platformService.get(gameKickMemeberAllRequest.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
.platformCode(gameKickMemeberAllRequest.getPlatformCode())
.systemCurrency(gameKickMemeberAllRequest.getCurrencyCode()).build());
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());
ApiException.notNull(gameSecretKey, 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(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.currency(/*gameSecretKey.getCurrency()*/targetCurrency)
.vendor(platform)
.keyInfo(keyInfo)
.agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey())
.currency(gameSecretKey.getCurrency())
.build();
if (!ObjectUtils.isEmpty(gameKickMemeberAllRequest.getGameId())) {
Game game = gameService.selectGameById(gameKickMemeberAllRequest.getGameId());
@ -581,42 +474,23 @@ public class ApiGameController extends BaseController {
/**
*
*
* @param request dashflow
* @param gameGetFreeSpinDashflowRequest dashflow
* @return {@link TableDataInfo }
*/
@PostMapping("/cancel/free/spin")
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());
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());
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);
IGamesService iGamesService = gamesService.get(gameGetFreeSpinDashflowRequest.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
Boolean cancelFreeSpin = iGamesService.cancelFreeSpin(CancelFreeSpinRequestDTO.builder()
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.referenceId(request.getReferenceId())
.vendor(platform)
.keyInfo(keyInfo)
.agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey())
.referenceId(gameGetFreeSpinDashflowRequest.getReferenceId())
.build());
return AjaxResult.success(cancelFreeSpin);
}
@ -624,79 +498,45 @@ public class ApiGameController extends BaseController {
/**
*
*
* @param request api
* @param gameExchangeBalanceAllRequest api
* @return {@link AjaxResult }
*/
@PostMapping("/exchange/balance/all")
public AjaxResult exchangeBalanceAll(@Validated @RequestBody GameExchangeBalanceAllRequest request) {
public AjaxResult exchangeBalanceAll(@Validated @RequestBody GameExchangeBalanceAllRequest gameExchangeBalanceAllRequest) {
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(keys.size());
CountDownLatch latch = new CountDownLatch(gameSecretKeys.size());
// 使用List存储Future对象用于获取异步执行的结果
List<Future<Long>> futures = new ArrayList<>();
// 提交异步任务到线程池
// for (GameSecretKeyCurrencyDTO gameSecretKeyCurrencyDTO : gameSecretKeys) {
for (Key key : keys) {
for (GameSecretKeyCurrencyDTO gameSecretKeyCurrencyDTO : gameSecretKeys) {
futures.add(threadPoolTaskExecutor.submit(() -> {
try {
IGamesService iGamesService = gamesService.get(key.getPlatformCode() + Constants.SERVICE);
IGamesService iGamesService = gamesService.get(gameSecretKeyCurrencyDTO.getPlatformCode() + Constants.SERVICE);
Member member = memberService.selectMemberByAccount(request.getAccount(), request.getCurrencyCode(), key.getPlatformCode());
Member member = memberService.selectMemberByAccount(gameExchangeBalanceAllRequest.getAccount(), gameExchangeBalanceAllRequest.getCurrencyCode(), gameSecretKeyCurrencyDTO.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
//操作第三方钱包
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
.agentId(key.getCode())
.agentKey(key.getKey())
.orderId(request.getOrderId())
.agentId(gameSecretKeyCurrencyDTO.getCode())
.agentKey(gameSecretKeyCurrencyDTO.getKey())
.orderId(gameExchangeBalanceAllRequest.getOrderId())
.amount(BigDecimal.ONE)
.currency(/*gameSecretKeyCurrencyDTO.getCurrency()*/key.currency)
.currency(gameSecretKeyCurrencyDTO.getCurrency())
.tenantKey(tenantSecretKey.getTenantKey())
.account(member.getGameAccount())
.vendor(key.getPlatform())
.keyInfo(key.getKeyInfo())
.transferType(TransferType.ALL.getCode())
.build();
return iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
@ -731,7 +571,7 @@ public class ApiGameController extends BaseController {
tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
.platformCode(gameExchangeMoney.getPlatformCode())
.currencyCode(gameExchangeMoney.getCurrencyCode())
.sourceId(request.getOrderId())
.sourceId(gameExchangeBalanceAllRequest.getOrderId())
.transferType(TransferType.ALL.getCode())
.amount(gameExchangeMoney.getBalance())
.account(member.getMemberAccount())
@ -753,54 +593,33 @@ public class ApiGameController extends BaseController {
/**
*
*
* @param request
* @param gameDemoLoginRequest
* @return {@link AjaxResult }
*/
@PostMapping("/demo/login")
public AjaxResult demoLogin(@Validated @RequestBody GameDemoLoginRequest request) {
public AjaxResult demoLogin(@Validated @RequestBody GameDemoLoginRequest gameDemoLoginRequest) {
Game game = gameService.selectGameById(request.getGameId());
Game game = gameService.selectGameById(gameDemoLoginRequest.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(platform.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(gamePlatform.getPlatformCode() + Constants.SERVICE);
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());
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());
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()*/targetLang)
.vendor(platform)
.keyInfo(keyInfo)
.lang(gameSecretKeyLangDTO.getLang())
.build();
GameDemoLoginResponseDTO gameDemoLoginResponseDTO = iGamesService.gameDemoLogin(gamesLogin);
@ -808,14 +627,4 @@ 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;
}
}

View File

@ -11,22 +11,20 @@ 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.system.domain.TenantSecretKey;
import com.ff.base.utils.StringUtils;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.config.KeyConfig;
import com.ff.game.api.IGamesService;
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.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.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;
@ -34,12 +32,10 @@ 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -62,21 +58,31 @@ 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 IPlatformService platformService;
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
/**
*
@ -92,38 +98,24 @@ 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());
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());
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())
@ -138,13 +130,11 @@ public class ApiMemberController extends BaseController {
//向第三方注册账号
CreateMemberRequestDTO gamesBaseRequestDTO = CreateMemberRequestDTO.builder()
.account(gameAccount)
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey())
.betLimit(memberCreateApiRequest.getBetLimit())
.platformType(memberCreateApiRequest.getPlatformType())
.currency(targetCurrency)
.vendor(platform)
.keyInfo(keyInfo)
.currency(gameSecretKey.getCurrency())
.build();
Boolean result = iGamesService.createMember(gamesBaseRequestDTO);
Assert.isTrue(result, "建立游戏账号失败");
@ -156,51 +146,35 @@ public class ApiMemberController extends BaseController {
/**
*
*
* @param request api
* @param memberInfoApiRequest api
* @return {@link AjaxResult }
*/
@PostMapping("/info")
public AjaxResult getMemberInfo(@Validated @RequestBody MemberInfoApiRequest request) {
IGamesService iGamesService = gamesService.get(request.getPlatformCode() + Constants.SERVICE);
public AjaxResult getMemberInfo(@Validated @RequestBody MemberInfoApiRequest memberInfoApiRequest) {
IGamesService iGamesService = gamesService.get(memberInfoApiRequest.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());
//
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Platform platform = platformService.get(request.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
.platformCode(memberInfoApiRequest.getPlatformCode())
.systemCurrency(memberInfoApiRequest.getCurrencyCode()).build());
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
ApiException.notNull(gameSecretKey, 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(request.getAccount(), request.getCurrencyCode(), request.getPlatformCode());
Member member = memberService.selectMemberByAccount(memberInfoApiRequest.getAccount(), memberInfoApiRequest.getCurrencyCode(), memberInfoApiRequest.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
//向第三方查询账号
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
.accounts(member.getGameAccount())
.agentId(keyInfo.getCode())
.currency(targetCurrency)
.agentKey(keyInfo.getKey())
.vendor(platform)
.keyInfo(keyInfo)
.agentId(gameSecretKey.getCode())
.currency(gameSecretKey.getCurrency())
.agentKey(gameSecretKey.getKey())
.build();
MemberInfoResponseDTO memberInfo = iGamesService.getMemberInfo(gamesBaseRequestDTO);
MemberInfoResponse memberInfoResponse = new MemberInfoResponse();
@ -219,49 +193,22 @@ 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;
}
Key key = new Key();
key.setPlatformCode(platform.getPlatformCode());
key.setCode(keyInfo.getCode());
key.setKey(keyInfo.getKey());
key.setCurrency(targetCurrency);
keys.add(key);
}
List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
.systemCurrency(memberInfoAllApiRequest.getCurrencyCode()).build());
// 创建线程池
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
CountDownLatch latch = new CountDownLatch(keys.size());
CountDownLatch latch = new CountDownLatch(gameSecretKeys.size());
// 使用List存储Future对象用于获取异步执行的结果
List<Future<MemberInfoAllResponse>> futures = new ArrayList<>();
// 提交异步任务到线程池
for (Key gameSecretKey : keys) {
for (GameSecretKeyCurrencyDTO gameSecretKey : gameSecretKeys) {
futures.add(threadPoolTaskExecutor.submit(() -> {
try {
IGamesService iGamesService = gamesService.get(gameSecretKey.getPlatformCode() + Constants.SERVICE);
@ -309,12 +256,5 @@ public class ApiMemberController extends BaseController {
return AjaxResult.success(balanceMap);
}
@Data
class Key {
private String platformCode;
private String code;
private String currency;
private String key;
}
}

View File

@ -49,11 +49,5 @@ public class GameDemoLoginRequest implements Serializable {
*/
private Integer disableFullScreen;
/**
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
}

View File

@ -5,7 +5,6 @@ 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;
@ -35,9 +34,6 @@ public class ContentRefreshedEventListener implements ApplicationListener<Contex
@Resource
private ISysDictTypeService sysDictTypeService;
@Resource
private IPlatformService platformService;
/**
*
*
@ -54,7 +50,5 @@ public class ContentRefreshedEventListener implements ApplicationListener<Contex
}
sysConfigService.loadingConfigCache();
sysDictTypeService.loadingDictCache();
platformService.loadToCache();
}
}

View File

@ -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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -20,12 +20,12 @@ import javax.annotation.Resource;
public class MyAEAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = platformService.get(GamePlatforms.AE.getCode())
.getUrlInfo().getUrl();
return new ForestAddress("https", apiBaseUrl, 443, "");
String apiBaseUrl = configService.selectConfigByKey(Constants.AE_API_BASE_URL);
return new ForestAddress("https",apiBaseUrl, 443,"");
}
}

View File

@ -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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -20,12 +20,12 @@ import javax.annotation.Resource;
public class MyDGAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = platformService.get(GamePlatforms.DG.getCode())
.getUrlInfo().getUrl();
return new ForestAddress("http", apiBaseUrl, 80, "");
String apiBaseUrl = configService.selectConfigByKey(Constants.DG_API_BASE_URL);
return new ForestAddress("http",apiBaseUrl, 80,"");
}
}

View File

@ -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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -13,13 +13,12 @@ import javax.annotation.Resource;
public class MyFCAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = platformService.get(GamePlatforms.FC.getCode())
.getUrlInfo().getUrl();
return new ForestAddress("https", apiBaseUrl, 443, "");
String apiBaseUrl = configService.selectConfigByKey(Constants.FC_API_BASE_URL);
return new ForestAddress("https",apiBaseUrl, 443,"");
}
}

View File

@ -3,11 +3,13 @@ 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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Random;
/**
@ -17,15 +19,15 @@ import javax.annotation.Resource;
* @date 2025/02/10
*/
@Component
public class MyJILIAddressSource implements AddressSource {
public class MyJILIAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = platformService.get(GamePlatforms.FC.getCode())
.getUrlInfo().getUrl();
return new ForestAddress("https", apiBaseUrl, 443, "api1");
String apiBaseUrl = configService.selectConfigByKey(Constants.JILI_API_BASE_URL);
return new ForestAddress("https",apiBaseUrl, 443,"api1");
}
}

View File

@ -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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -20,12 +20,12 @@ import javax.annotation.Resource;
public class MyKMAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = platformService.get(GamePlatforms.KM.getCode())
.getUrlInfo().getUrl();
return new ForestAddress("https", apiBaseUrl, 443, "api");
String apiBaseUrl = configService.selectConfigByKey(Constants.KM_API_BASE_URL_LOGIN);
return new ForestAddress("https",apiBaseUrl, 443,"api");
}
}

View File

@ -2,7 +2,9 @@ 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.*;
@ -13,9 +15,14 @@ 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.*;
@ -50,8 +57,6 @@ import java.util.stream.Collectors;
@Slf4j
public class GamesKMServiceImpl implements IGamesService {
@Resource
private IPlatformService platformService;
@Resource
private ISysConfigService configService;
@ -230,10 +235,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);
return loginUrl + "/gamelauncher?gpcode=" + gamesLogin.getGameType()
String selectConfigByKey = configService.selectConfigByKey(Constants.KM_API_BASE_LOGIN_URL);
return selectConfigByKey + "/gamelauncher?gpcode=" + gamesLogin.getGameType()
+ "&gcode=" + gamesLogin.getGameId()
+ "&token=" + kmUserToken
+ "&lang=" + gamesLogin.getLang();
@ -564,7 +569,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());
}
}
@ -613,10 +618,9 @@ public class GamesKMServiceImpl implements IGamesService {
log.info("GamesKMServiceImpl [gameDemoLogin] 请求参数 {}", gameDemoLoginRequestDTO);
Map<String, Object> params = new LinkedHashMap<>();
params.put("lang", gameDemoLoginRequestDTO.getLang());
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 GameDemoLoginResponseDTO.builder()
.url(loginUrl + "/demolauncher?gpcode=" + gameDemoLoginRequestDTO.getGameType()
.url(selectConfigByKey + "/demolauncher?gpcode=" + gameDemoLoginRequestDTO.getGameType()
+ "&gcode=" + gameDemoLoginRequestDTO.getGameId()
+ "&lang=" + gameDemoLoginRequestDTO.getLang())
.build();
@ -679,17 +683,16 @@ 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) {

View File

@ -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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -18,12 +18,12 @@ import javax.annotation.Resource;
public class MeiTianAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = platformService.get(GamePlatforms.MT.getCode())
.getUrlInfo().getUrl();
String apiBaseUrl = configService.selectConfigByKey(Constants.MEITIAN_API_BASE_URL);
return new ForestAddress("https", apiBaseUrl, 443, "services");
}
}

View File

@ -0,0 +1,89 @@
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;
}

View File

@ -76,6 +76,10 @@ public class MeiTianGameServiceImpl implements IGamesService {
@Resource
private IMemberService memberService;
@Resource
private IGameSecretKeyService gameSecretKeyService;
@Resource
private MeiTianClient meiTianClient;
@ -108,10 +112,11 @@ 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(createMemberRequestDTO.getKeyInfo().getPassword());
String md5Password = Md5Utils.md5New(gameSecretKey.getPassword());
Map<String, String> rawMap = new LinkedHashMap<>();
rawMap.put("nickname", createMemberRequestDTO.getAccount());
rawMap.put("playerLevel", "0");
@ -123,7 +128,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
log.error("[MeiTian] encode rawData failure", e);
throw new ApiException(ErrorCode.ERROR.getCode());
}
String md5Code = Md5Utils.md5New(createMemberRequestDTO.getKeyInfo().getKey() + rawData);//MD5(key+rawData);
String md5Code = Md5Utils.md5New(gameSecretKey.getKey() + rawData);//MD5(key+rawData);
MeiTianCreateMemberResponseDTO createMemberResponseDTO =
meiTianClient.createMember(
playerName,
@ -176,10 +181,11 @@ 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(gamesLogin.getKeyInfo().getPassword());
String md5Password = Md5Utils.md5New(gameSecretKey.getPassword());
Map<String, String> rawMap = new LinkedHashMap<>();
/*rawMap.put("gameHall ", gamesLogin.getGameType());*/
rawMap.put("gameCode", gamesLogin.getGameId());
@ -194,7 +200,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
log.error("[MeiTian] encode rawData failure", e);
throw new ApiException(ErrorCode.ERROR.getCode());
}
String code = Md5Utils.md5New(gamesLogin.getKeyInfo().getKey() + rawData);
String code = Md5Utils.md5New(gameSecretKey.getKey() + rawData);
MeiTianLoginResultDTO loginWithoutRedirectResponseDTO =
meiTianClient.loginWithoutRedirect(
merchantId,
@ -232,12 +238,12 @@ public class MeiTianGameServiceImpl implements IGamesService {
for (MeiTianGameDataDTO gamesDataDTO : gameList.getData()) {
GamePlatform gamePlatform = GamePlatform.builder()
.platformType(MeiTianGameType.findSystemByCode(gamesDataDTO.getGameCategoryId()))
.platformCode(GamePlatforms.MT.getCode())
.platformCode(GamePlatforms.MeiTian.getCode())
.build();
List<GamePlatform> gamePlatforms = gamePlatformService.selectGamePlatformList(gamePlatform);
//没有此平台就新增一个平台
if (CollectionUtils.isEmpty(gamePlatforms)) {
gamePlatform.setPlatformName(GamePlatforms.MT.getInfo() + MeiTianGameType.findInfoByCode(gamesDataDTO.getGameCategoryId()));
gamePlatform.setPlatformName(GamePlatforms.MeiTian.getInfo() + MeiTianGameType.findInfoByCode(gamesDataDTO.getGameCategoryId()));
gamePlatform.setSortNo(gamePlatformService.selectMaxSortNo() + 1);
gamePlatform.setCreateBy(Constants.SYSTEM);
gamePlatformService.insertGamePlatform(gamePlatform);
@ -303,7 +309,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
.currency(exchangeTransferMoneyRequestDTO.getCurrency()).build());
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
String transactionId = GamePlatforms.MT.getCode() + IdUtils.simpleUUID();
String transactionId = GamePlatforms.MeiTian.getCode() + IdUtils.simpleUUID();
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
GameExchangeMoney.builder()
@ -325,7 +331,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
.currencyCode(gameSecretKey.getSystemCurrency())
.memberId(member.getId())
.transactionId(transactionId)
.platformCode(GamePlatforms.MT.getCode())
.platformCode(GamePlatforms.MeiTian.getCode())
.build();
exchangeMoney.setCreateBy(Constants.SYSTEM);
//接口限制限制50字符
@ -433,7 +439,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
}
boolean doSyncRecordByRecordID(BetRecordByTimeDTO betRecordByTimeDTO) {
String configKey = GamePlatforms.MT.getCode() + ":lastRecordID";
String configKey = GamePlatforms.MeiTian.getCode() + ":lastRecordID";
String lastRecordID = sysConfigServiceImpl.selectConfigByKey(configKey);
long recordID = 0;
if (lastRecordID == null || lastRecordID.isEmpty()) {
@ -490,7 +496,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
boolean doSyncRecordByDate(BetRecordByTimeDTO betRecordByTimeDTO, int daysToSubtract) {
String date = getDateStr(daysToSubtract);
String configKey = GamePlatforms.MT.getCode() + ":lastSyncDate";
String configKey = GamePlatforms.MeiTian.getCode() + ":lastSyncDate";
String syncDateStr = sysConfigServiceImpl.selectConfigByKey(configKey);
Map<String, Long> syncDateMap = new HashMap<>();
long recordID = 0;
@ -591,8 +597,9 @@ public class MeiTianGameServiceImpl implements IGamesService {
*/
@Override
public GetGameDetailResponseDTO getGameDetail(GetGameDetailRequestDTO getGameDetailRequestDTO) {
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyByCode(getGameDetailRequestDTO.getAgentId());
String key = getGameDetailRequestDTO.getKeyInfo().getKey();
String key = gameSecretKey.getKey();
String merchantId = getGameDetailRequestDTO.getAgentId();
Map<String, String> rawMap = new LinkedHashMap<>();
rawMap.put("rowID", getGameDetailRequestDTO.getWagersId());
@ -714,7 +721,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
}
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
//查询重复数据id
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds, GamePlatforms.MT.getCode());
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds, GamePlatforms.MeiTian.getCode());
//用steam流清除list中与wagersIds集合相同的数据
gameBettingDetails = gameBettingDetails.stream()
.filter(detail -> !removeWagersIds.contains(detail.getWagersId()))
@ -740,7 +747,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
GameSecretKeyCurrencyDTO gameSecretKey =
gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
.currency(dataBean.getCurrency())
.platformCode(GamePlatforms.MT.getCode()).build());
.platformCode(GamePlatforms.MeiTian.getCode()).build());
Member member = memberService.selectMemberByGameAccount(dataBean.getPlayerName());
@ -762,7 +769,7 @@ public class MeiTianGameServiceImpl implements IGamesService {
.memberId(member.getId())
.gameCode(dataBean.getGameCode())
.gameType(MeiTianGameType.findSystemByCode(Integer.parseInt(dataBean.getGameType())))
.platformCode(GamePlatforms.MT.getCode())
.platformCode(GamePlatforms.MeiTian.getCode())
.gameId(gamesDataDTO.getSystemGameId())
.gameName(gamesDataDTO.getCnName())
.gameStatus(compareResult > 0 ? GameStatus.WIN.getCode() : compareResult < 0 ? GameStatus.FAIL.getCode() : GameStatus.FLAT.getCode())

View File

@ -3,24 +3,22 @@ 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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class MyNGAddressSource implements AddressSource {
public class MyNGAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
//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");
String apiBaseUrl = configService.selectConfigByKey(Constants.NG_API_BASE_URL);
return new ForestAddress("https",apiBaseUrl, 443,"api");
}
}

View File

@ -2,6 +2,7 @@ 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;
@ -10,14 +11,19 @@ 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.*;
@ -36,12 +42,15 @@ 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;
@ -219,7 +228,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.getVendor()) ? IngressType.PC_WEB.getValue() : IngressType.MOBILE_WEB.getValue());
paramsMap.put("ingress", PlatformHomeType.WEB.getValue().equals(gamesLogin.getPlatform()) ? 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())) {

View File

@ -58,8 +58,8 @@ public interface PGTClient {
* @param parameters
* @return {@link PGXGameLoginResponse }
*/
@Post("/logIn")
PGXGameLoginResponse loginWithoutRedirect(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
@Post("/launchGames.aspx?${parameters}")
PGXGameLoginResponse loginWithoutRedirect(@Var("parameters") String parameters);

View File

@ -178,7 +178,7 @@ public class GamesPGTServiceImpl implements IGamesService {
*/
@Override
public String loginWithoutRedirect(GamesLogin gamesLogin) {
log.info("GamesPGTServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
log.info("GamesPGXServiceImpl [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(params,key);
PGXGameLoginResponse PGXGameLoginResponse = pgtClient.loginWithoutRedirect(JsonUtil.mapToQueryString(params));
//判断是否获取成功
if (this.getIsSuccess(PGXGameLoginResponse.getErrCode())) {
return PGXGameLoginResponse.getGameUrl();

View File

@ -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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -20,13 +20,12 @@ import javax.annotation.Resource;
public class MyPGXAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
// String apiBaseUrl = configService.selectConfigByKey(Constants.PGX_API_BASE_URL);
String apiBaseUrl = platformService.get(GamePlatforms.PGX.getCode())
.getUrlInfo().getUrl();
return new ForestAddress("http", apiBaseUrl, 80, "");
String apiBaseUrl = configService.selectConfigByKey(Constants.PGX_API_BASE_URL);
return new ForestAddress("http",apiBaseUrl, 80,"");
}
}

View File

@ -1,8 +1,7 @@
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;
@ -37,14 +36,12 @@ public class GamesBaseRequestDTO implements Serializable {
private String query;
/**
*
*/
private String currency;
private Platform vendor;
private KeyInfo keyInfo;
}

View File

@ -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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -20,14 +20,12 @@ import javax.annotation.Resource;
public class MySAAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
// 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");
String apiBaseUrl = configService.selectConfigByKey(Constants.SA_API_BASE_URL);
return new ForestAddress("https",apiBaseUrl, 443,"api");
}
}

View File

@ -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.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -20,13 +20,12 @@ import javax.annotation.Resource;
public class MyXKAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
// 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");
String apiBaseUrl = configService.selectConfigByKey(Constants.XK_API_BASE_URL);
return new ForestAddress("https",apiBaseUrl, 443,"api");
}
}

View File

@ -11,6 +11,7 @@ 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;
@ -209,7 +210,7 @@ public class GamesXKServiceImpl implements IGamesService {
params.put("key", key);
params.put("disableFullScreen", gamesLogin.getDisableFullScreen());
params.put("homeUrl", gamesLogin.getHomeUrl());
params.put("platform", gamesLogin.getVendor());
params.put("platform", gamesLogin.getPlatform());
XKLoginWithoutRedirectResponseDTO xkLoginWithoutRedirectResponseDTO = xkClient.loginWithoutRedirect(params);
//判断是否获取成功
if (this.getIsSuccess(xkLoginWithoutRedirectResponseDTO.getCode())) {

View File

@ -1,11 +0,0 @@
package com.ff.game.domain;
import java.io.Serializable;
import java.util.HashMap;
/**
* @author cengy
*/
public class CurrencyInfo extends HashMap<String, String> implements Serializable {
}

View File

@ -5,6 +5,7 @@ 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;
@ -19,31 +20,24 @@ 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;
@ -52,44 +46,27 @@ 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;
}

View File

@ -1,21 +0,0 @@
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;
}

View File

@ -1,14 +0,0 @@
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);
}
}

View File

@ -1,38 +0,0 @@
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;
}

View File

@ -1,15 +0,0 @@
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;
}

View File

@ -1,16 +0,0 @@
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;
}

View File

@ -1,24 +0,0 @@
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);
}

View File

@ -1,27 +0,0 @@
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);
}

View File

@ -1,79 +0,0 @@
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;
}
}

View File

@ -220,7 +220,7 @@ public class GameTask {
Long endTime = DateUtils.getNowDate();
//捞取指定分钟前的数据
gameService.insertGameBettingDetails(startTime, endTime, GamePlatforms.MT.getCode());
gameService.insertGameBettingDetails(startTime, endTime, GamePlatforms.MeiTian.getCode());
}

View File

@ -1,29 +0,0 @@
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");
}
}

View File

@ -1,7 +0,0 @@
package com.ff.sports.fb;
/**
* @author cengy
*/
public class A {
}

View File

@ -1,110 +0,0 @@
<?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}) &gt; 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>