feat(game): 新增 NG 游戏平台支持

- 新增 NG 游戏平台的相关接口和数据结构
- 实现 NG 游戏平台的余额转移和状态查询功能
- 更新数据库结构,增加支持终端类型和系统货币字段- 优化错误码处理,增加新的错误类型
main-p
shi 2025-03-12 17:55:57 +08:00
parent b995a026c8
commit bd1c3d9d9e
46 changed files with 1318 additions and 66 deletions

View File

@ -52,7 +52,10 @@ public class CacheConstants
*/ */
public static final String XK_GAMES= "xk_games:"; public static final String XK_GAMES= "xk_games:";
/**
* pg
*/
public static final String PG_GAMES= "pg_games:";
/** /**
* *
*/ */

View File

@ -183,6 +183,11 @@ public class Constants {
*/ */
public static final String JILI_API_BASE_URL = "jili.api.base.url"; 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";
/** /**
* *
*/ */

View File

@ -20,6 +20,8 @@ public enum ErrorCode {
CURRENCY_NOT_EXIST(1004, "游戏平台不支持的货币"), CURRENCY_NOT_EXIST(1004, "游戏平台不支持的货币"),
GAME_NOT_EXIST(1005, "游戏不存在"), GAME_NOT_EXIST(1005, "游戏不存在"),
CURRENCY_EXCHANGE(1006, "不支持币种的汇率"), CURRENCY_EXCHANGE(1006, "不支持币种的汇率"),
FREQUENT_INTERFACE_REQUESTS (1007, "接口请求频繁"),
BALANCE_TRANSFER_FAILED (1008, "余额转移失败"),
; ;
// 获取错误码 // 获取错误码

View File

@ -0,0 +1,26 @@
package com.ff.base.enums;
import lombok.Data;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/03/12
*/
@Getter
public enum GameMemberStatus {
ONLINE(1, "在线"),
OFFLINE(2, "脱机"),
ACCOUNT_NOT_EXIST(3, "账号不存在"),
UNKNOWN(4, "未知");
private final int code;
private final String description;
GameMemberStatus(int code, String description) {
this.code = code;
this.description = description;
}
}

View File

@ -6,6 +6,7 @@ import java.util.List;
public enum GamePlatforms { public enum GamePlatforms {
JILI("JILI", "JILI"), JILI("JILI", "JILI"),
XK("XK", "XK"), XK("XK", "XK"),
PG("PG", "PG"),
; ;
private final String code; private final String code;

View File

@ -0,0 +1,24 @@
package com.ff.base.enums;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/03/12
*/
@Getter
public enum IngressType {
PC_WEB(1, "电脑网页"),
MOBILE_WEB(2, "手机网页"),
PC_AND_MOBILE_WEB(3, "电脑/手机网页");
private final Integer value;
private final String description;
IngressType(Integer value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -0,0 +1,67 @@
package com.ff.base.enums;
import lombok.Getter;
import java.util.Optional;
import java.util.stream.Stream;
/**
* xkgame
*
* @author shi
* @date 2024/11/13
*/
@Getter
public enum NGGameType {
VIDEO(1, 6,"视讯"),
SLOT(2,5, "老虎机"),
LOTTERY(3,7, "彩票"),
SPORTS(4, 8,"体育"),
ESPORTS(5, 1,"电竞"),
HUNTING(6, 9,"捕猎"),
CHESS(7,2, "棋牌")
;
private final Integer code;
private final Integer systemCode;
private final String info;
NGGameType(Integer code, Integer systemCode, String info)
{
this.code = code;
this.systemCode = systemCode;
this.info = info;
}
/**
*
*
* @param code
* @return {@link String }
*/
public static Integer findSystemByCode(Integer code) {
Optional<Integer> system = Stream.of(NGGameType.values())
.filter(gameType -> gameType.getCode().equals(code))
.map(NGGameType::getSystemCode)
.findFirst();
return system.orElse(null);
}
/**
*
*
* @param code
* @return {@link String }
*/
public static String findInfoByCode(Integer code) {
Optional<String> system = Stream.of(NGGameType.values())
.filter(gameType -> gameType.getCode().equals(code))
.map(NGGameType::getInfo)
.findFirst();
return system.orElse(null);
}
}

View File

@ -0,0 +1,32 @@
package com.ff.base.enums;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
/**
* ng
*
* @author shi
* @date 2025/03/11
*/
@Getter
public enum NGPlatforms {
PG("pg", "PG")
;
private final String code;
private final String platform;
NGPlatforms(String code, String platform)
{
this.code = code;
this.platform = platform;
}
}

View File

@ -0,0 +1,23 @@
package com.ff.base.enums;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/03/12
*/
@Getter
public enum NGTransferType {
TRANSFER_IN("1", "转入"),
TRANSFER_OUT("2", "转出");
private final String value;
private final String description;
NGTransferType(String value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -0,0 +1,25 @@
package com.ff.base.enums;
import lombok.Data;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/03/12
*/
@Getter
public enum PlatformHomeType {
WEB("web", "Web 平台"),
APP("app", "App 平台");
private final String value;
private final String description;
PlatformHomeType(String value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -0,0 +1,24 @@
package com.ff.base.enums;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/03/12
*/
@Getter
public enum StatusType {
IN_PROGRESS(0, "进行中"),
SUCCESS(1, "成功"),
FAILURE(2, "失败");
private final Integer value;
private final String description;
StatusType(Integer value, String description) {
this.value = value;
this.description = description;
}
}

View File

@ -52,4 +52,18 @@ public class ApiException extends RuntimeException {
throw new ApiException(code); throw new ApiException(code);
} }
} }
/**
*
*
* @param bool
* @param code
*/
public static void isTrue(@Nullable Boolean bool, Integer code) {
if (Boolean.FALSE.equals(bool)) {
throw new ApiException(code);
}
}
} }

View File

@ -0,0 +1,22 @@
package com.ff.base.utils;
/**
*
*
* @author shi
* @date 2025/03/12
*/
public class SleepUtil {
/**
* 使线
*
* @param millis
*/
public static void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // 恢复中断状态
}
}
}

View File

@ -5,6 +5,8 @@ import com.ff.base.constant.Constants;
import com.ff.base.core.text.StrFormatter; import com.ff.base.core.text.StrFormatter;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*; import java.util.*;
/** /**
@ -588,7 +590,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* @return {@link String } * @return {@link String }
*/ */
public static String addSuffix(String account, String suffix) { public static String addSuffix(String account, String suffix) {
return account + "_" + suffix; return account + suffix;
} }
/** /**
@ -597,14 +599,64 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* @param original * @param original
* @return * @return
*/ */
public static String removeLastOccurrence(String original) { public static String removeLastOccurrence(String original, String suffix) {
// 查找下划线的位置 // 查找位置
int index = original.indexOf('_'); if (original.endsWith(suffix)) {
if (index != -1) { return original.substring(0, original.length() - suffix.length());
// 返回下划线前面的部分
return original.substring(0, index);
} }
return original; return original;
} }
/**
*
*
* @param prefix "PG"
* @param length
* @return
*/
public static String generateOrderId(String prefix, int length) {
if (length <= prefix.length()) {
throw new IllegalArgumentException("订单号长度必须大于前缀长度");
}
// 获取当前时间戳
long timestamp = System.currentTimeMillis();
// 使用UUID生成一个随机的字符串并去掉 "-"
String randomString = UUID.randomUUID().toString().replace("-", "");
// 拼接时间戳和随机字符串
String source = prefix + timestamp + randomString;
// 截取指定长度的部分(确保符合需求的长度)
String orderId = getMD5Hash(source).substring(0, length - prefix.length());
return prefix + orderId;
}
/**
* 使MD5
*
* @param source
* @return
*/
private static String getMD5Hash(String source) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(source.getBytes());
StringBuilder hexString = new StringBuilder();
// 转换为16进制
for (byte b : digest) {
String hex = Integer.toHexString(0xFF & b);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString(); // 返回32位MD5哈希
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
}
} }

View File

@ -111,7 +111,7 @@ public class ApiGameController extends BaseController {
List<GameSecretKey> gameSecretKeys = gameSecretKeyService.selectGameSecretKeyList(GameSecretKey.builder() List<GameSecretKey> gameSecretKeys = gameSecretKeyService.selectGameSecretKeyList(GameSecretKey.builder()
.platform(gameRespons.getPlatformCode()) .platform(gameRespons.getPlatformCode())
.build()); .build());
List<String> currencyCode = gameSecretKeys.stream().map(GameSecretKey::getSystemCode).collect(Collectors.toList()); List<String> currencyCode = gameSecretKeys.stream().map(GameSecretKey::getSystemCurrency).collect(Collectors.toList());
gameRespons.setCurrencyCode(currencyCode); gameRespons.setCurrencyCode(currencyCode);
} }
return AjaxResult.success(gameResponses); return AjaxResult.success(gameResponses);
@ -138,7 +138,7 @@ public class ApiGameController extends BaseController {
TenantSecretKey tenantSecretKey = keyConfig.get(); TenantSecretKey tenantSecretKey = keyConfig.get();
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(gamePlatform.getPlatformCode(), memberCreateApiRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(gamePlatform.getPlatformCode(), memberCreateApiRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
GameSecretKey gameSecretKeyLang = gameSecretKeyService.findByPlatformAndSystemLangCode(gamePlatform.getPlatformCode(), memberCreateApiRequest.getLangCode()); GameSecretKey gameSecretKeyLang = gameSecretKeyService.findByPlatformAndSystemLangCode(gamePlatform.getPlatformCode(), memberCreateApiRequest.getLangCode());
@ -151,6 +151,8 @@ public class ApiGameController extends BaseController {
.agentId(gameSecretKey.getCode()) .agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey()) .agentKey(gameSecretKey.getKey())
.account(member.getGameAccount()) .account(member.getGameAccount())
.gameSecretKeyId(gameSecretKey.getId())
.gameType(game.getGameSourceType())
.gameId(game.getGameCode()) .gameId(game.getGameCode())
.homeUrl(memberCreateApiRequest.getHomeUrl()) .homeUrl(memberCreateApiRequest.getHomeUrl())
.platform(memberCreateApiRequest.getPlatform()) .platform(memberCreateApiRequest.getPlatform())
@ -180,7 +182,7 @@ public class ApiGameController extends BaseController {
TenantSecretKey tenantSecretKey = keyConfig.get(); TenantSecretKey tenantSecretKey = keyConfig.get();
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(gameExchangeBalanceRequest.getPlatformCode(), gameExchangeBalanceRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(gameExchangeBalanceRequest.getPlatformCode(), gameExchangeBalanceRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
BigDecimal quota = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder() BigDecimal quota = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
@ -203,6 +205,7 @@ public class ApiGameController extends BaseController {
.agentKey(gameSecretKey.getKey()) .agentKey(gameSecretKey.getKey())
.orderId(gameExchangeBalanceRequest.getOrderId()) .orderId(gameExchangeBalanceRequest.getOrderId())
.account(member.getGameAccount()) .account(member.getGameAccount())
.gameSecretKeyId(gameSecretKey.getId())
.tenantKey(tenantSecretKey.getTenantKey()) .tenantKey(tenantSecretKey.getTenantKey())
.quota(quota) .quota(quota)
.amount(gameExchangeBalanceRequest.getAmount()) .amount(gameExchangeBalanceRequest.getAmount())
@ -231,7 +234,7 @@ public class ApiGameController extends BaseController {
TenantSecretKey tenantSecretKey = keyConfig.get(); TenantSecretKey tenantSecretKey = keyConfig.get();
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(gameCreateFreeSpinRequest.getPlatformCode(), gameCreateFreeSpinRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(gameCreateFreeSpinRequest.getPlatformCode(), gameCreateFreeSpinRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Member member = memberService.selectMemberByGameAccount(StringUtils.addSuffix(gameCreateFreeSpinRequest.getAccount(), gameCreateFreeSpinRequest.getCurrencyCode() + tenantSecretKey.getTenantSn())); Member member = memberService.selectMemberByGameAccount(StringUtils.addSuffix(gameCreateFreeSpinRequest.getAccount(), gameCreateFreeSpinRequest.getCurrencyCode() + tenantSecretKey.getTenantSn()));
@ -300,7 +303,7 @@ public class ApiGameController extends BaseController {
public AjaxResult getDetail(@Validated @RequestBody GameGetDetailRequest gameGetDetailRequest) { public AjaxResult getDetail(@Validated @RequestBody GameGetDetailRequest gameGetDetailRequest) {
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(gameGetDetailRequest.getPlatformCode(), gameGetDetailRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(gameGetDetailRequest.getPlatformCode(), gameGetDetailRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
@ -328,7 +331,7 @@ public class ApiGameController extends BaseController {
*/ */
@PostMapping("/kick/member") @PostMapping("/kick/member")
public AjaxResult kickMember(@Validated @RequestBody GameKickMemeberRequest gameKickMemeberRequest) { public AjaxResult kickMember(@Validated @RequestBody GameKickMemeberRequest gameKickMemeberRequest) {
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(gameKickMemeberRequest.getPlatformCode(), gameKickMemeberRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(gameKickMemeberRequest.getPlatformCode(), gameKickMemeberRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
TenantSecretKey tenantSecretKey = keyConfig.get(); TenantSecretKey tenantSecretKey = keyConfig.get();
@ -348,7 +351,7 @@ public class ApiGameController extends BaseController {
@PostMapping("/kick/member/all") @PostMapping("/kick/member/all")
public AjaxResult kickMemberAll(@Validated @RequestBody GameKickMemeberAllRequest gameKickMemeberAllRequest) { public AjaxResult kickMemberAll(@Validated @RequestBody GameKickMemeberAllRequest gameKickMemeberAllRequest) {
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(gameKickMemeberAllRequest.getPlatformCode(), gameKickMemeberAllRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(gameKickMemeberAllRequest.getPlatformCode(), gameKickMemeberAllRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(gameKickMemeberAllRequest.getPlatformCode() + Constants.SERVICE); IGamesService iGamesService = gamesService.get(gameKickMemeberAllRequest.getPlatformCode() + Constants.SERVICE);
@ -410,7 +413,7 @@ public class ApiGameController extends BaseController {
*/ */
@PostMapping("/cancel/free/spin") @PostMapping("/cancel/free/spin")
public AjaxResult cancelFreeSpin(@Validated @RequestBody GameCancelFreeSpinRequest gameGetFreeSpinDashflowRequest) { public AjaxResult cancelFreeSpin(@Validated @RequestBody GameCancelFreeSpinRequest gameGetFreeSpinDashflowRequest) {
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(gameGetFreeSpinDashflowRequest.getPlatformCode(), gameGetFreeSpinDashflowRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(gameGetFreeSpinDashflowRequest.getPlatformCode(), gameGetFreeSpinDashflowRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(gameGetFreeSpinDashflowRequest.getPlatformCode() + Constants.SERVICE); IGamesService iGamesService = gamesService.get(gameGetFreeSpinDashflowRequest.getPlatformCode() + Constants.SERVICE);
@ -438,7 +441,7 @@ public class ApiGameController extends BaseController {
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode()); ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
List<GameSecretKey> gameSecretKeys = gameSecretKeyService.selectGameSecretKeyList(GameSecretKey.builder().systemCode(gameExchangeBalanceAllRequest.getCurrencyCode()).build()); List<GameSecretKey> gameSecretKeys = gameSecretKeyService.selectGameSecretKeyList(GameSecretKey.builder().systemCurrency(gameExchangeBalanceAllRequest.getCurrencyCode()).build());
// 创建线程池 // 创建线程池
@ -459,6 +462,7 @@ public class ApiGameController extends BaseController {
.agentId(gameSecretKey.getCode()) .agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey()) .agentKey(gameSecretKey.getKey())
.orderId(gameExchangeBalanceAllRequest.getOrderId()) .orderId(gameExchangeBalanceAllRequest.getOrderId())
.gameSecretKeyId(gameSecretKey.getId())
.amount(BigDecimal.ONE) .amount(BigDecimal.ONE)
.tenantKey(tenantSecretKey.getTenantKey()) .tenantKey(tenantSecretKey.getTenantKey())
.account(member.getGameAccount()) .account(member.getGameAccount())

View File

@ -92,7 +92,7 @@ public class ApiMemberController extends BaseController {
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode()); ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
TenantSecretKey tenantSecretKey = keyConfig.get(); TenantSecretKey tenantSecretKey = keyConfig.get();
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(memberCreateApiRequest.getPlatformCode(), memberCreateApiRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(memberCreateApiRequest.getPlatformCode(), memberCreateApiRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
String gameAccount = StringUtils.addSuffix(memberCreateApiRequest.getAccount(), memberCreateApiRequest.getCurrencyCode() + tenantSecretKey.getTenantSn()); String gameAccount = StringUtils.addSuffix(memberCreateApiRequest.getAccount(), memberCreateApiRequest.getCurrencyCode() + tenantSecretKey.getTenantSn());
@ -116,6 +116,7 @@ public class ApiMemberController extends BaseController {
CreateMemberRequestDTO gamesBaseRequestDTO = CreateMemberRequestDTO.builder() CreateMemberRequestDTO gamesBaseRequestDTO = CreateMemberRequestDTO.builder()
.account(gameAccount) .account(gameAccount)
.agentId(gameSecretKey.getCode()) .agentId(gameSecretKey.getCode())
.gameSecretKeyId(gameSecretKey.getId())
.agentKey(gameSecretKey.getKey()) .agentKey(gameSecretKey.getKey())
.build(); .build();
Boolean result = iGamesService.createMember(gamesBaseRequestDTO); Boolean result = iGamesService.createMember(gamesBaseRequestDTO);
@ -138,7 +139,7 @@ public class ApiMemberController extends BaseController {
TenantSecretKey tenantSecretKey = keyConfig.get(); TenantSecretKey tenantSecretKey = keyConfig.get();
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(memberInfoApiRequest.getPlatformCode(), memberInfoApiRequest.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(memberInfoApiRequest.getPlatformCode(), memberInfoApiRequest.getCurrencyCode());
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Member member = memberService.selectMemberByGameAccount(StringUtils.addSuffix(memberInfoApiRequest.getAccount(), memberInfoApiRequest.getCurrencyCode() + tenantSecretKey.getTenantSn())); Member member = memberService.selectMemberByGameAccount(StringUtils.addSuffix(memberInfoApiRequest.getAccount(), memberInfoApiRequest.getCurrencyCode() + tenantSecretKey.getTenantSn()));
@ -148,6 +149,7 @@ public class ApiMemberController extends BaseController {
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder() MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
.accounts(member.getGameAccount()) .accounts(member.getGameAccount())
.agentId(gameSecretKey.getCode()) .agentId(gameSecretKey.getCode())
.gameSecretKeyId(gameSecretKey.getId())
.agentKey(gameSecretKey.getKey()) .agentKey(gameSecretKey.getKey())
.build(); .build();
MemberInfoResponseDTO memberInfo = iGamesService.getMemberInfo(gamesBaseRequestDTO); MemberInfoResponseDTO memberInfo = iGamesService.getMemberInfo(gamesBaseRequestDTO);
@ -171,7 +173,7 @@ public class ApiMemberController extends BaseController {
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode()); ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
List<GameSecretKey> gameSecretKeys = gameSecretKeyService.selectGameSecretKeyList(GameSecretKey.builder().systemCode(memberInfoAllApiRequest.getCurrencyCode()).build()); List<GameSecretKey> gameSecretKeys = gameSecretKeyService.selectGameSecretKeyList(GameSecretKey.builder().systemCurrency(memberInfoAllApiRequest.getCurrencyCode()).build());
// 创建线程池 // 创建线程池
@ -189,6 +191,7 @@ public class ApiMemberController extends BaseController {
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder() MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
.accounts(member.getGameAccount()) .accounts(member.getGameAccount())
.agentId(gameSecretKey.getCode()) .agentId(gameSecretKey.getCode())
.gameSecretKeyId(gameSecretKey.getId())
.agentKey(gameSecretKey.getKey()) .agentKey(gameSecretKey.getKey())
.build(); .build();
//查询余额 //查询余额

View File

@ -43,7 +43,7 @@ public class GameExchangeBalanceRequest implements Serializable {
* *
*/ */
@NotNull(message = "amount不能为空") @NotNull(message = "amount不能为空")
@DecimalMin(value = "0.01", message = "amount必须大于等于0.1") @Min(value = 1, message = "amount最小值为1")
@Max(value = 999999999, message = "amount最大值为999999999") @Max(value = 999999999, message = "amount最大值为999999999")
private BigDecimal amount; private BigDecimal amount;

View File

@ -49,6 +49,12 @@ public class GameResponse implements Serializable {
*/ */
private Integer platformType; private Integer platformType;
/**
* 1:2:3:/
*/
private Integer ingress;
/** /**
* *
*/ */

View File

@ -282,7 +282,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
@Override @Override
public BigDecimal gameBalanceExchange(GameBalanceExchange gameBalanceExchange) { public BigDecimal gameBalanceExchange(GameBalanceExchange gameBalanceExchange) {
// 获取平台接口密钥 // 获取平台接口密钥
GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCode(gameBalanceExchange.getPlatformCode(), gameBalanceExchange.getCurrencyCode()); GameSecretKey gameSecretKey = gameSecretKeyService.findSecretKeyByPlatformAndSystemCurrency(gameBalanceExchange.getPlatformCode(), gameBalanceExchange.getCurrencyCode());
// 检查平台密钥是否存在,否则抛出异常 // 检查平台密钥是否存在,否则抛出异常
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode()); ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
@ -329,6 +329,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder() MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
.accounts(member.getGameAccount()) .accounts(member.getGameAccount())
.agentId(gameSecretKey.getCode()) .agentId(gameSecretKey.getCode())
.gameSecretKeyId(gameSecretKey.getId())
.agentKey(gameSecretKey.getKey()) .agentKey(gameSecretKey.getKey())
.build(); .build();
balanceRequestAmount = iGamesService.getMemberInfo(gamesBaseRequestDTO).getBalance(); balanceRequestAmount = iGamesService.getMemberInfo(gamesBaseRequestDTO).getBalance();

View File

@ -17,14 +17,6 @@ import java.util.List;
public interface IGamesService { public interface IGamesService {
/**
*
*
* @param gamesBaseRequestDTO dto
* @return {@link String }
*/
String getKey(GamesBaseRequestDTO gamesBaseRequestDTO);
/** /**
* *
* *
@ -70,6 +62,15 @@ public interface IGamesService {
Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO); Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO);
/**
*
*
* @param exchangeTransferMoneyRequestDTO dto
* @return {@link Boolean }
*/
Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO);
/** /**
* *
* *

View File

@ -102,8 +102,7 @@ public class GamesJILIServiceImpl implements IGamesService {
* @param gamesBaseRequestDTO dto * @param gamesBaseRequestDTO dto
* @return {@link String } * @return {@link String }
*/ */
@Override private String getKey(GamesBaseRequestDTO gamesBaseRequestDTO) {
public String getKey(GamesBaseRequestDTO gamesBaseRequestDTO) {
Random random = new Random(); Random random = new Random();
//取出对应的key跟密钥跟请求参数 //取出对应的key跟密钥跟请求参数
String agentKey = gamesBaseRequestDTO.getAgentKey(); String agentKey = gamesBaseRequestDTO.getAgentKey();
@ -247,7 +246,7 @@ public class GamesJILIServiceImpl implements IGamesService {
} }
Game game = Game.builder() Game game = Game.builder()
.platformId(gamePlatform.getId()) .platformId(gamePlatform.getId())
.gameCode(gamesDataDTO.getGameId()) .gameCode(String.valueOf(gamesDataDTO.getGameId()))
.build(); .build();
List<Game> games = gameService.selectGameList(game); List<Game> games = gameService.selectGameList(game);
//不存在这个游戏 //不存在这个游戏
@ -332,6 +331,9 @@ public class GamesJILIServiceImpl implements IGamesService {
JILIExchangeMoneyResponseDTO.BeanData exchangeMoneyResponseData = exchangeMoneyResponse.getData(); JILIExchangeMoneyResponseDTO.BeanData exchangeMoneyResponseData = exchangeMoneyResponse.getData();
ApiException.isTrue(!StatusType.FAILURE.getValue().equals(exchangeMoneyResponseData.getStatus()), ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
//更新数据 //更新数据
exchangeMoney.setBalance(NumberUtil.sub(exchangeMoneyResponseData.getCurrencyAfter(), exchangeMoneyResponseData.getCurrencyBefore()).abs()); exchangeMoney.setBalance(NumberUtil.sub(exchangeMoneyResponseData.getCurrencyAfter(), exchangeMoneyResponseData.getCurrencyBefore()).abs());
exchangeMoney.setCoinBefore(exchangeMoneyResponseData.getCoinBefore()); exchangeMoney.setCoinBefore(exchangeMoneyResponseData.getCoinBefore());
@ -349,6 +351,17 @@ public class GamesJILIServiceImpl implements IGamesService {
return exchangeMoney.getId(); return exchangeMoney.getId();
} }
/**
*
*
* @param exchangeTransferMoneyRequestDTO dto
* @return {@link Boolean }
*/
@Override
public Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
return Boolean.TRUE;
}
/** /**
* *

View File

@ -0,0 +1,24 @@
package com.ff.game.api.ng.address;
import com.dtflys.forest.callback.AddressSource;
import com.dtflys.forest.http.ForestAddress;
import com.dtflys.forest.http.ForestRequest;
import com.ff.base.constant.Constants;
import com.ff.base.system.service.ISysConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class MyNGAddressSource implements AddressSource {
@Resource
private ISysConfigService configService;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = configService.selectConfigByKey(Constants.NG_API_BASE_URL);
return new ForestAddress("https",apiBaseUrl, 443,"api");
}
}

View File

@ -0,0 +1,88 @@
package com.ff.game.api.ng.client;
import com.dtflys.forest.annotation.*;
import com.ff.game.api.jili.address.MyJILIAddressSource;
import com.ff.game.api.jili.dto.JILICreateMemberResponseDTO;
import com.ff.game.api.jili.dto.JILIExchangeMoneyResponseDTO;
import com.ff.game.api.ng.address.MyNGAddressSource;
import com.ff.game.api.ng.dto.*;
import com.ff.game.api.xk.dto.XKExchangeMoneyResponseDTO;
import com.ff.game.api.xk.dto.XKLoginWithoutRedirectResponseDTO;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* ng
*
* @author shi
* @date 2025/03/11
*/
@Address(source = MyNGAddressSource.class)
public interface NGClient {
/**
*
*
* @param parameters
* @return {@link String }
*/
@Post("/server/create")
ApiNGResponseDTO createMember(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
/**
*
*
* @param parameters
* @param headerMap
* @return {@link ApiNGResponseDTO }<{@link String }>
*/
@Post("/server/balance")
ApiNGResponseDTO<ApiMemberInfoResponseDTO> getMemberInfo(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
/**
*
*
* @param parameters
* @param headerMap
* @return {@link ApiNGResponseDTO }<{@link List<ApiGameInfoResponseDTO> }>
*/
@Post("/server/gameCode")
ApiNGResponseDTO<List<ApiGameInfoResponseDTO>> getGameList(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
/**
*
*
* @param parameters
* @param headerMap
* @return {@link ApiNGResponseDTO }<{@link ApiLoginResponseDTO }>
*/
@Post("/server/gameUrl")
ApiNGResponseDTO<ApiLoginResponseDTO> loginWithoutRedirect(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
/**
* id
*
* @param parameters
* @param headerMap
* @return {@link ApiNGResponseDTO }<{@link ApiLoginResponseDTO }>
*/
@Post(url = "/server/transfer",connectTimeout = 70000)
ApiNGResponseDTO exchangeTransferByAgentId(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
/**
*
*
* @param parameters
* @param headerMap
* @return {@link ApiNGResponseDTO }<{@link ApiExchangeTransferStatusResponseDTO }>
*/
@Post(url = "/server/transferStatus")
ApiNGResponseDTO<ApiExchangeTransferStatusResponseDTO> exchangeTransferStatus(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
}

View File

@ -0,0 +1,50 @@
package com.ff.game.api.ng.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* apidto
*
* @author shi
* @date 2025/03/12
*/
@Data
public class ApiExchangeTransferStatusResponseDTO {
/**
*
*/
private String playerId;
/**
*
*/
private String orderId;
/**
*
* 使 LocalDateTime
*/
private Date createTime;
/**
*
* 使 BigDecimal 便
*/
private BigDecimal amount;
/**
*
* 使 BigDecimal 便
*/
private BigDecimal afterBalance;
/**
* 0:1:2:
*/
private int status;
}

View File

@ -0,0 +1,41 @@
package com.ff.game.api.ng.dto;
import lombok.Data;
import java.util.Map;
/**
* apidto
*
* @author shi
* @date 2025/03/12
*/
@Data
public class ApiGameInfoResponseDTO {
/**
*
*/
private String platType;
/**
*
*/
private Integer gameType;
/**
*
*/
private String gameCode;
/**
*
*/
private String ingress;
/**
*
*/
private Map<String, String> gameName;
/**
* id
*/
private Long systemGameId;
}

View File

@ -0,0 +1,20 @@
package com.ff.game.api.ng.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* apidto
*
* @author shi
* @date 2025/03/12
*/
@Data
public class ApiLoginResponseDTO {
/**
*
*/
private String url;
}

View File

@ -0,0 +1,19 @@
package com.ff.game.api.ng.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* apidto
*
* @author shi
* @date 2025/03/12
*/
@Data
public class ApiMemberInfoResponseDTO {
/**
*
*/
private BigDecimal balance;
}

View File

@ -0,0 +1,26 @@
package com.ff.game.api.ng.dto;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
/**
* api
*
* @author shi
* @date 2025/03/11
*/
@Data
public class ApiNGResponseDTO<T> {
/**
* 10000
*/
private int code;
/**
*
*/
private String msg;
/**
*
*/
private T data;
}

View File

@ -0,0 +1,507 @@
package com.ff.game.api.ng.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import com.ff.base.constant.CacheConstants;
import com.ff.base.constant.Constants;
import com.ff.base.core.redis.RedisCache;
import com.ff.base.enums.*;
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.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.domain.*;
import com.ff.game.service.*;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.security.SecureRandom;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
*
*
* @author shi
* @date 2024/10/21
*/
@Service("PGService")
@Slf4j
public class GamesPGServiceImpl implements IGamesService {
@Resource
private ISysConfigService configService;
@Resource
private RedisCache redisCache;
@Resource
private IGameExchangeMoneyService gameExchangeMoneyService;
@Resource
private IGamePlatformService gamePlatformService;
@Resource
private IGameService gameService;
@Resource
private IMemberService memberService;
@Resource
private IGameFreeRecordService gameFreeRecordService;
@Resource
private IGameSecretKeyService gameSecretKeyService;
@Resource
private NGClient ngClient;
@Resource
private KeyConfig keyConfig;
@Resource
private IGameBettingDetailsService gameBettingDetailsService;
/**
*
*
* @param errorCode
* @return {@link Boolean }
*/
private Boolean getIsSuccess(Integer errorCode) {
ApiException.isTrue(10009 != errorCode, ErrorCode.FREQUENT_INTERFACE_REQUESTS.getCode());
return 10000 == errorCode;
}
/**
*
*
* @param gamesBaseRequestDTO dto
* @return {@link Map }<{@link String }, {@link String }>
*/
private Map<String, String> getKey(GamesBaseRequestDTO gamesBaseRequestDTO) {
Map<String, String> headerMap = new HashMap<>();
String characters = "abcdefghijklmnopqrstuvwxyz0123456789";
SecureRandom random = new SecureRandom();
// 生成 16-32 之间的随机长度
int length = 16 + random.nextInt(17);
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; i++) {
sb.append(characters.charAt(random.nextInt(characters.length())));
}
//取出对应的key跟密钥跟请求参数
String agentKey = gamesBaseRequestDTO.getAgentKey();
String agentId = gamesBaseRequestDTO.getAgentId();
String key = Md5Utils.md5New(sb + agentId + agentKey);
headerMap.put("sign", key);
headerMap.put("random", String.valueOf(sb));
headerMap.put("sn", agentId);
headerMap.put("Content-Type", "application/json");
return headerMap;
}
/**
*
*
* @param createMemberRequestDTO dto
* @return {@link Boolean }
*/
@Override
public Boolean createMember(CreateMemberRequestDTO createMemberRequestDTO) {
log.info("GamesNGServiceImpl [createMember] 请求参数 {}", createMemberRequestDTO);
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyById(createMemberRequestDTO.getGameSecretKeyId());
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("playerId", createMemberRequestDTO.getAccount());
paramsMap.put("platType", NGPlatforms.PG.getCode());
paramsMap.put("currency", gameSecretKey.getCurrency());
Map<String, String> headerMap = this.getKey(createMemberRequestDTO);
ApiNGResponseDTO apiNGResponseDTO = ngClient.createMember(paramsMap, headerMap);
int errorCode = apiNGResponseDTO.getCode();
if (10000 == errorCode) {
return Boolean.TRUE;
}
if (10002 == errorCode) {
throw new ApiException(ErrorCode.GAME_ACCOUNT_CREATION_FAILED.getCode());
}
//判断是否获取成功
return Boolean.FALSE;
}
/**
*
*
* @param memberInfoRequestDTO dto
* @return {@link MemberInfoResponseDTO }
*/
@Override
public MemberInfoResponseDTO getMemberInfo(MemberInfoRequestDTO memberInfoRequestDTO) {
log.info("GamesNGServiceImpl [getMemberInfo] 请求参数 {}", memberInfoRequestDTO);
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyById(memberInfoRequestDTO.getGameSecretKeyId());
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("playerId", memberInfoRequestDTO.getAccounts());
paramsMap.put("platType", NGPlatforms.PG.getCode());
paramsMap.put("currency", gameSecretKey.getCurrency());
Map<String, String> headerMap = this.getKey(memberInfoRequestDTO);
//这个接口请求稍微重复一次就报错
SleepUtil.sleep(500);
ApiNGResponseDTO<ApiMemberInfoResponseDTO> apiNGResponseDTO = ngClient.getMemberInfo(paramsMap, headerMap);
int errorCode = apiNGResponseDTO.getCode();
if (this.getIsSuccess(errorCode)) {
return MemberInfoResponseDTO.builder().account(memberInfoRequestDTO.getAccounts()).balance(apiNGResponseDTO.getData().getBalance()).status(GameMemberStatus.UNKNOWN.getCode()).build();
} else {
throw new BaseException(apiNGResponseDTO.getMsg());
}
}
/**
*
*
* @param gamesLogin
* @return {@link String }
*/
@Override
public String loginWithoutRedirect(GamesLogin gamesLogin) {
log.info("GamesNGServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyById(gamesLogin.getGameSecretKeyId());
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("playerId", gamesLogin.getAccount());
paramsMap.put("platType", NGPlatforms.PG.getCode());
paramsMap.put("currency", gameSecretKey.getCurrency());
paramsMap.put("gameType", gamesLogin.getGameType());
paramsMap.put("lang", gameSecretKey.getLang());
paramsMap.put("gameCode", gamesLogin.getGameId());
paramsMap.put("returnUrl", gamesLogin.getHomeUrl());
paramsMap.put("ingress", PlatformHomeType.WEB.getValue().equals(gamesLogin.getPlatform()) ? IngressType.PC_WEB.getValue() : IngressType.MOBILE_WEB.getValue());
Map<String, String> headerMap = this.getKey(gamesLogin);
ApiNGResponseDTO<ApiLoginResponseDTO> apiLoginResponseDTOApiNGResponseDTO = ngClient.loginWithoutRedirect(paramsMap, headerMap);
if (this.getIsSuccess(apiLoginResponseDTOApiNGResponseDTO.getCode())) {
return apiLoginResponseDTOApiNGResponseDTO.getData().getUrl();
} else {
throw new BaseException(apiLoginResponseDTOApiNGResponseDTO.getMsg());
}
}
/**
*
*
* @param gamesBaseRequestDTO dto
* @return {@link String }
*/
@Transactional
@Override
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
List<ApiGameInfoResponseDTO> apiGameInfoResponseDTOS = redisCache.getCacheList(CacheConstants.PG_GAMES);
if (!CollectionUtils.isEmpty(apiGameInfoResponseDTOS)) {
return CacheConstants.PG_GAMES;
}
log.info("GamesNGServiceImpl [getGameList] 请求参数 {}", gamesBaseRequestDTO);
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("platType", NGPlatforms.PG.getCode());
Map<String, String> headerMap = this.getKey(gamesBaseRequestDTO);
ApiNGResponseDTO<List<ApiGameInfoResponseDTO>> gameList = ngClient.getGameList(paramsMap, headerMap);
if (this.getIsSuccess(gameList.getCode())) {
for (ApiGameInfoResponseDTO apiGameInfoResponseDTO : gameList.getData()) {
GamePlatform gamePlatform = GamePlatform.builder()
.platformType(NGGameType.findSystemByCode(apiGameInfoResponseDTO.getGameType()))
.platformCode(GamePlatforms.PG.getCode())
.build();
List<GamePlatform> gamePlatforms = gamePlatformService.selectGamePlatformList(gamePlatform);
//没有此平台就新增一个平台
if (CollectionUtils.isEmpty(gamePlatforms)) {
gamePlatform.setPlatformName(GamePlatforms.PG.getInfo() + NGGameType.findInfoByCode(apiGameInfoResponseDTO.getGameType()));
gamePlatform.setSortNo(gamePlatformService.selectMaxSortNo() + 1);
gamePlatform.setCreateBy(Constants.SYSTEM);
gamePlatformService.insertGamePlatform(gamePlatform);
} else {
gamePlatform = gamePlatforms.get(0);
}
Game game = Game.builder()
.platformId(gamePlatform.getId())
.gameCode(apiGameInfoResponseDTO.getGameCode())
.build();
List<Game> games = gameService.selectGameList(game);
//不存在这个游戏
if (CollectionUtils.isEmpty(games)) {
game.setGameSourceType(apiGameInfoResponseDTO.getGameType());
game.setFreespin(Boolean.FALSE);
game.setDemoStatus(Boolean.TRUE);
game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1);
game.setGameName(apiGameInfoResponseDTO.getGameName().get("zh-hans"));
game.setCreateBy(Constants.SYSTEM);
gameService.insertGame(game);
} else {
game = games.get(0);
}
apiGameInfoResponseDTO.setSystemGameId(game.getId());
}
redisCache.deleteObject(CacheConstants.PG_GAMES);
redisCache.setCacheList(CacheConstants.PG_GAMES, gameList.getData());
redisCache.expire(CacheConstants.PG_GAMES, 5L, TimeUnit.HOURS);
} else {
throw new BaseException(gameList.getMsg());
}
return CacheConstants.PG_GAMES;
}
/**
* id
*
* @param exchangeTransferMoneyRequestDTO moeny dto
* @return {@link Long }
*/
@Override
@Transactional
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO) {
log.info("GamesNGServiceImpl [exchangeTransferByAgentId] 请求参数 {}", exchangeTransferMoneyRequestDTO);
GameSecretKey gameSecretKey = gameSecretKeyService.selectGameSecretKeyById(exchangeTransferMoneyRequestDTO.getGameSecretKeyId());
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
String transactionId = gameExchangeMoneyService.getTransactionId(GamePlatforms.PG.getCode(), 32);
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
GameExchangeMoney.builder()
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
.orderId(exchangeTransferMoneyRequestDTO.getOrderId())
.build()
);
Assert.isTrue(CollectionUtils.isEmpty(gameExchangeMonies), "订单号重复");
//获取下一个自增id
GameExchangeMoney exchangeMoney = GameExchangeMoney
.builder()
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
.orderId(exchangeTransferMoneyRequestDTO.getOrderId())
.quota(exchangeTransferMoneyRequestDTO.getQuota())
.balance(exchangeTransferMoneyRequestDTO.getAmount())
.exchangeType(exchangeTransferMoneyRequestDTO.getTransferType())
.currencyCode(gameSecretKey.getSystemCurrency())
.memberId(member.getId())
.transactionId(transactionId)
.platformCode(GamePlatforms.PG.getCode())
.build();
exchangeMoney.setCreateBy(Constants.SYSTEM);
//获取余额
String type = TransferType.ALL.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType()) ? NGTransferType.TRANSFER_IN.getValue() : NGTransferType.TRANSFER_OUT.getValue();
//获取当前游戏币
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
.accounts(member.getGameAccount())
.agentId(gameSecretKey.getCode())
.gameSecretKeyId(gameSecretKey.getId())
.agentKey(gameSecretKey.getKey())
.build();
MemberInfoResponseDTO memberInfo = this.getMemberInfo(gamesBaseRequestDTO);
//判断是不是转出
if (NGTransferType.TRANSFER_OUT.getValue().equals(type)) {
exchangeTransferMoneyRequestDTO.setAmount(memberInfo.getBalance());
}
System.out.print("aa" + transactionId.length());
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("platType", NGPlatforms.PG.getCode());
paramsMap.put("playerId", exchangeTransferMoneyRequestDTO.getAccount());
paramsMap.put("currency", gameSecretKey.getCurrency());
paramsMap.put("type", type);
paramsMap.put("amount", String.valueOf(exchangeTransferMoneyRequestDTO.getAmount()));
paramsMap.put("orderId", transactionId);
Map<String, String> key = this.getKey(exchangeTransferMoneyRequestDTO);
ApiNGResponseDTO apiNGResponseDTO = ngClient.exchangeTransferByAgentId(paramsMap, key);
if (this.getIsSuccess(apiNGResponseDTO.getCode())) {
//更新数据
exchangeMoney.setBalance(exchangeTransferMoneyRequestDTO.getAmount());
exchangeMoney.setStatus(StatusType.IN_PROGRESS.getValue());
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
ExchangeTransferStatusRequestDTO exchangeTransferStatusRequestDTO=new ExchangeTransferStatusRequestDTO();
exchangeTransferStatusRequestDTO.setAccount(exchangeTransferMoneyRequestDTO.getAccount());
exchangeTransferStatusRequestDTO.setCurrency(gameSecretKey.getCurrency());
exchangeTransferStatusRequestDTO.setOrderId(transactionId);
exchangeTransferStatusRequestDTO.setAgentId(exchangeTransferMoneyRequestDTO.getAgentId());
exchangeTransferStatusRequestDTO.setAgentKey(exchangeTransferMoneyRequestDTO.getAgentKey());
exchangeTransferStatusRequestDTO.setGameSecretKeyId(exchangeTransferMoneyRequestDTO.getGameSecretKeyId());
this.exchangeTransferStatus(exchangeTransferStatusRequestDTO);
} else {
log.error("GamesPGServiceImpl [exchangeTransferByAgentId] 金额转移失败,错误代码{},错误信息{}", apiNGResponseDTO.getCode(), apiNGResponseDTO.getMsg());
throw new BaseException(apiNGResponseDTO.getMsg());
}
return exchangeMoney.getId();
}
/**
*
*
* @param exchangeTransferMoneyRequestDTO dto
* @return {@link Boolean }
*/
@Override
public Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("playerId", exchangeTransferMoneyRequestDTO.getAccount());
paramsMap.put("currency", exchangeTransferMoneyRequestDTO.getCurrency());
paramsMap.put("orderId", exchangeTransferMoneyRequestDTO.getOrderId());
Map<String, String> key = this.getKey(exchangeTransferMoneyRequestDTO);
ApiNGResponseDTO<ApiExchangeTransferStatusResponseDTO> apiNGResponseDTO = ngClient.exchangeTransferStatus(paramsMap, key);
if (this.getIsSuccess(apiNGResponseDTO.getCode())) {
ApiExchangeTransferStatusResponseDTO apiNGResponseDTOData = apiNGResponseDTO.getData();
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
GameExchangeMoney.builder()
.platformCode(GamePlatforms.PG.getCode())
.transactionId(exchangeTransferMoneyRequestDTO.getOrderId())
.build()
);
for (GameExchangeMoney exchangeMoney : gameExchangeMonies) {
//更新数据
exchangeMoney.setBalance(apiNGResponseDTOData.getAmount().abs());
exchangeMoney.setCoinBefore(NumberUtil.add(apiNGResponseDTOData.getAmount(), apiNGResponseDTOData.getAfterBalance()));
exchangeMoney.setCoinAfter(apiNGResponseDTOData.getAfterBalance());
exchangeMoney.setCurrencyBefore(exchangeMoney.getCoinBefore());
exchangeMoney.setCurrencyAfter(exchangeMoney.getCoinAfter());
exchangeMoney.setStatus(apiNGResponseDTOData.getStatus());
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
}
return Boolean.TRUE;
} else {
log.error("GamesPGServiceImpl [exchangeTransferStatus]错误代码{},错误信息{}", apiNGResponseDTO.getCode(), apiNGResponseDTO.getMsg());
return Boolean.FALSE;
}
}
/**
*
*
* @param betRecordByTimeDTO dto
* @return {@link Boolean }
*/
@Override
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
return null;
}
/**
*
*
* @param createFreeSpinRequest
* @return {@link Boolean }
*/
@Override
public Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest) {
return null;
}
/**
*
*
* @param getGameDetailRequestDTO dto
* @return {@link GetGameDetailResponseDTO }
*/
@Override
public GetGameDetailResponseDTO getGameDetail(GetGameDetailRequestDTO getGameDetailRequestDTO) {
return null;
}
/**
*
*
* @param kickMemberRequestDTO dto
* @return {@link Boolean }
*/
@Override
public Boolean kickMember(KickMemberRequestDTO kickMemberRequestDTO) {
return null;
}
/**
*
*
* @param kickMemberAllDTO dto
* @return {@link Boolean }
*/
@Override
public Boolean kickMemberAll(KickMemberAllDTO kickMemberAllDTO) {
return null;
}
/**
* 使
*
* @param getFreeSpinDashflowRequestDTO dashflowdto
* @return {@link List }<{@link GameFreeRecord }>
*/
@Override
public List<GameFreeRecord> getFreeSpinDashflow(GetFreeSpinDashflowRequestDTO getFreeSpinDashflowRequestDTO) {
return Collections.emptyList();
}
/**
*
*
* @param cancelFreeSpinRequestDTO
* @return {@link Boolean }
*/
@Override
public Boolean cancelFreeSpin(CancelFreeSpinRequestDTO cancelFreeSpinRequestDTO) {
return null;
}
/**
*
*
* @param gamesDataBuildDTO
* @return {@link GameBettingDetails }
*/
@Override
public GameBettingDetails dataBuild(GamesDataBuildDTO gamesDataBuildDTO) {
return null;
}
}

View File

@ -0,0 +1,33 @@
package com.ff.game.api.request;
import lombok.Data;
/**
* dto
*
* @author shi
* @date 2025/03/12
*/
@Data
public class ExchangeTransferStatusRequestDTO extends GamesBaseRequestDTO {
/**
*
*/
private String account;
/**
*
*/
private String currency;
/**
* ID
*/
private String orderId;
}

View File

@ -34,4 +34,12 @@ public class GamesBaseRequestDTO implements Serializable {
* *
*/ */
private String query; private String query;
/**
* id
*/
private Long gameSecretKeyId;
} }

View File

@ -24,7 +24,7 @@ public class GamesLogin extends GamesBaseRequestDTO{
/** /**
* ( GameList GameId) * ( GameList GameId)
*/ */
private Integer gameId; private String gameId;
/** /**
* UI , * UI ,
*/ */
@ -41,4 +41,9 @@ public class GamesLogin extends GamesBaseRequestDTO{
* md5 , 1 * md5 , 1
*/ */
private Integer disableFullScreen; private Integer disableFullScreen;
/**
*
*/
private Integer gameType;
} }

View File

@ -23,6 +23,6 @@ public class KickMemberAllDTO extends GamesBaseRequestDTO {
/** /**
* id * id
*/ */
private Integer gameId; private String gameId;
} }

View File

@ -34,6 +34,7 @@ public class MemberInfoResponseDTO {
* 1: 线 * 1: 线
* 2: * 2:
* 3: * 3:
* 4
*/ */
private Integer status; private Integer status;
} }

View File

@ -5,10 +5,7 @@ import cn.hutool.core.util.NumberUtil;
import com.ff.base.constant.CacheConstants; import com.ff.base.constant.CacheConstants;
import com.ff.base.constant.Constants; import com.ff.base.constant.Constants;
import com.ff.base.core.redis.RedisCache; import com.ff.base.core.redis.RedisCache;
import com.ff.base.enums.ErrorCode; import com.ff.base.enums.*;
import com.ff.base.enums.GamePlatforms;
import com.ff.base.enums.GameStatus;
import com.ff.base.enums.XKGameType;
import com.ff.base.exception.base.ApiException; import com.ff.base.exception.base.ApiException;
import com.ff.base.exception.base.BaseException; import com.ff.base.exception.base.BaseException;
import com.ff.base.system.service.ISysConfigService; import com.ff.base.system.service.ISysConfigService;
@ -105,8 +102,7 @@ public class GamesXKServiceImpl implements IGamesService {
* @param gamesBaseRequestDTO dto * @param gamesBaseRequestDTO dto
* @return {@link String } * @return {@link String }
*/ */
@Override private String getKey(GamesBaseRequestDTO gamesBaseRequestDTO) {
public String getKey(GamesBaseRequestDTO gamesBaseRequestDTO) {
Random random = new Random(); Random random = new Random();
//取出对应的key跟密钥跟请求参数 //取出对应的key跟密钥跟请求参数
String agentKey = gamesBaseRequestDTO.getAgentKey(); String agentKey = gamesBaseRequestDTO.getAgentKey();
@ -142,10 +138,10 @@ public class GamesXKServiceImpl implements IGamesService {
params.put("key", key); params.put("key", key);
XKCreateMemberResponseDTO xkCreateMemberResponseDTO = xkClient.createMember(params); XKCreateMemberResponseDTO xkCreateMemberResponseDTO = xkClient.createMember(params);
int errorCode = xkCreateMemberResponseDTO.getCode(); int errorCode = xkCreateMemberResponseDTO.getCode();
if (0 == errorCode){ if (0 == errorCode) {
return Boolean.TRUE; return Boolean.TRUE;
} }
if (101 == errorCode){ if (101 == errorCode) {
throw new ApiException(ErrorCode.GAME_ACCOUNT_CREATION_FAILED.getCode()); throw new ApiException(ErrorCode.GAME_ACCOUNT_CREATION_FAILED.getCode());
} }
//判断是否获取成功 //判断是否获取成功
@ -198,7 +194,7 @@ public class GamesXKServiceImpl implements IGamesService {
Map<String, Object> params = new LinkedHashMap<>(); Map<String, Object> params = new LinkedHashMap<>();
params.put("account", gamesLogin.getAccount()); params.put("account", gamesLogin.getAccount());
params.put("gameId", gamesLogin.getGameId()); params.put("gameId", Integer.valueOf(gamesLogin.getGameId()));
params.put("lang", gamesLogin.getLang()); params.put("lang", gamesLogin.getLang());
params.put("agentId", gamesLogin.getAgentId()); params.put("agentId", gamesLogin.getAgentId());
String query = JsonUtil.mapToQueryString(params); String query = JsonUtil.mapToQueryString(params);
@ -262,7 +258,7 @@ public class GamesXKServiceImpl implements IGamesService {
} }
Game game = Game.builder() Game game = Game.builder()
.platformId(gamePlatform.getId()) .platformId(gamePlatform.getId())
.gameCode(gamesDataDTO.getGameId()) .gameCode(String.valueOf(gamesDataDTO.getGameId()))
.build(); .build();
List<Game> games = gameService.selectGameList(game); List<Game> games = gameService.selectGameList(game);
//不存在这个游戏 //不存在这个游戏
@ -343,6 +339,8 @@ public class GamesXKServiceImpl implements IGamesService {
//判断是否转移成功 //判断是否转移成功
if (this.getIsSuccess(exchangeMoneyResponse.getCode())) { if (this.getIsSuccess(exchangeMoneyResponse.getCode())) {
XKExchangeMoneyResponseDTO.DataBean exchangeMoneyResponseData = exchangeMoneyResponse.getData(); XKExchangeMoneyResponseDTO.DataBean exchangeMoneyResponseData = exchangeMoneyResponse.getData();
ApiException.isTrue(!StatusType.FAILURE.getValue().equals(exchangeMoneyResponseData.getStatus()), ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
//更新数据 //更新数据
exchangeMoney.setBalance(NumberUtil.sub(exchangeMoneyResponseData.getCurrencyAfter(), exchangeMoneyResponseData.getCurrencyBefore()).abs()); exchangeMoney.setBalance(NumberUtil.sub(exchangeMoneyResponseData.getCurrencyAfter(), exchangeMoneyResponseData.getCurrencyBefore()).abs());
exchangeMoney.setCoinBefore(exchangeMoneyResponseData.getCoinBefore()); exchangeMoney.setCoinBefore(exchangeMoneyResponseData.getCoinBefore());
@ -359,6 +357,17 @@ public class GamesXKServiceImpl implements IGamesService {
return exchangeMoney.getId(); return exchangeMoney.getId();
} }
/**
*
*
* @param exchangeTransferMoneyRequestDTO dto
* @return {@link Boolean }
*/
@Override
public Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
return Boolean.TRUE;
}
/** /**
* *

View File

@ -38,7 +38,12 @@ public class Game extends BaseEntity
/** 游戏第三方id */ /** 游戏第三方id */
@Excel(name = "游戏第三方id") @Excel(name = "游戏第三方id")
private Integer gameCode; private String gameCode;
/**
* 1:2:3:/
*/
private Integer ingress;
/** 第三方来源分类 */ /** 第三方来源分类 */
@Excel(name = "第三方来源分类") @Excel(name = "第三方来源分类")

View File

@ -85,7 +85,7 @@ public class GameExchangeMoney extends BaseEntity
@Excel(name = "转出类型 1游戏商转入到用户全部转出 2 用户转移到游戏商 3 游戏商转移额度到平台商") @Excel(name = "转出类型 1游戏商转入到用户全部转出 2 用户转移到游戏商 3 游戏商转移额度到平台商")
private Integer exchangeType; private Integer exchangeType;
/** 状态 1 成功 2失败 */ /** 状态0:进行中、1:成功、2:失败 */
@Excel(name = "状态 1 成功 2失败") @Excel(name = "状态 1 成功 2失败")
private Integer status; private Integer status;

View File

@ -39,9 +39,15 @@ public class GameSecretKey extends BaseEntity
@Excel(name = "密钥") @Excel(name = "密钥")
private String key; private String key;
/** 系统代码 */
@Excel(name = "系统代码") /**
private String systemCode; *
*/
private String currency;
/** 系统币种 */
@Excel(name = "系统币种")
private String systemCurrency;
/** 语言 */ /** 语言 */
@Excel(name = "语言") @Excel(name = "语言")

View File

@ -77,7 +77,7 @@ public interface GameSecretKeyMapper
* @param systemCode * @param systemCode
* @return {@link TenantSecretKey } * @return {@link TenantSecretKey }
*/ */
GameSecretKey findSecretKeyByPlatformAndSystemCode(@Param("platform") String platform, @Param("systemCode") String systemCode); GameSecretKey findSecretKeyByPlatformAndSystemCurrency(@Param("platform") String platform, @Param("systemCurrency") String systemCode);
/** /**
* lang * lang

View File

@ -46,6 +46,16 @@ public interface IGameExchangeMoneyService
*/ */
int insertGameExchangeMoney(GameExchangeMoney gameExchangeMoney); int insertGameExchangeMoney(GameExchangeMoney gameExchangeMoney);
/**
* id
*
* @param prefix
* @param length
* @return {@link String }
*/
String getTransactionId(String prefix, int length );
/** /**
* *
* *

View File

@ -78,7 +78,7 @@ public interface IGameSecretKeyService
* @param systemCode * @param systemCode
* @return {@link GameSecretKey } * @return {@link GameSecretKey }
*/ */
GameSecretKey findSecretKeyByPlatformAndSystemCode(String platform, String systemCode); GameSecretKey findSecretKeyByPlatformAndSystemCurrency(String platform, String systemCode);
/** /**

View File

@ -4,13 +4,16 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.ff.base.enums.GamePlatforms;
import com.ff.base.utils.DateUtils; import com.ff.base.utils.DateUtils;
import com.ff.base.utils.StringUtils;
import com.ff.game.dto.GameExchangeMoneyDTO; import com.ff.game.dto.GameExchangeMoneyDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ff.game.mapper.GameExchangeMoneyMapper; import com.ff.game.mapper.GameExchangeMoneyMapper;
import com.ff.game.domain.GameExchangeMoney; import com.ff.game.domain.GameExchangeMoney;
import com.ff.game.service.IGameExchangeMoneyService; import com.ff.game.service.IGameExchangeMoneyService;
import org.springframework.util.CollectionUtils;
/** /**
* Service * Service
@ -67,6 +70,33 @@ public class GameExchangeMoneyServiceImpl implements IGameExchangeMoneyService
return gameExchangeMoneyMapper.insertGameExchangeMoney(gameExchangeMoney); return gameExchangeMoneyMapper.insertGameExchangeMoney(gameExchangeMoney);
} }
/**
* id
*
* @param prefix
* @param length
* @return {@link String }
*/
@Override
public synchronized String getTransactionId(String prefix, int length) {
String transactionId = StringUtils.generateOrderId(prefix,length);
List<GameExchangeMoney> gameExchangeMonies = this.selectGameExchangeMoneyList(
GameExchangeMoney.builder()
.transactionId(transactionId)
.build()
);
while (!CollectionUtils.isEmpty(gameExchangeMonies)){
transactionId = StringUtils.generateOrderId(prefix,length);
gameExchangeMonies = this.selectGameExchangeMoneyList(
GameExchangeMoney.builder()
.transactionId(transactionId)
.build()
);
}
return transactionId;
}
/** /**
* *
* *

View File

@ -118,8 +118,8 @@ public class GameSecretKeyServiceImpl implements IGameSecretKeyService
* @return {@link GameSecretKey } * @return {@link GameSecretKey }
*/ */
@Override @Override
public GameSecretKey findSecretKeyByPlatformAndSystemCode(String platform, String systemCode) { public GameSecretKey findSecretKeyByPlatformAndSystemCurrency(String platform, String systemCode) {
return gameSecretKeyMapper.findSecretKeyByPlatformAndSystemCode(platform,systemCode); return gameSecretKeyMapper.findSecretKeyByPlatformAndSystemCurrency(platform,systemCode);
} }
/** /**

View File

@ -67,7 +67,7 @@ public class SysLoginController {
// 生成令牌 // 生成令牌
String token = ""; String token = "";
// 验证码校验 // 验证码校验
// loginService.validateCaptcha(loginBody.getUsername(), loginBody.getCode(), loginBody.getUuid()); loginService.validateCaptcha(loginBody.getUsername(), loginBody.getCode(), loginBody.getUuid());
// 登录前置校验 // 登录前置校验
loginService.loginPreCheck(loginBody.getUsername(), loginBody.getPassword()); loginService.loginPreCheck(loginBody.getUsername(), loginBody.getPassword());
if (LoginType.TENANT.getValue().equals(loginBody.getLoginType())) { if (LoginType.TENANT.getValue().equals(loginBody.getLoginType())) {

View File

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="sortNo" column="sort_no" /> <result property="sortNo" column="sort_no" />
<result property="platformId" column="platform_id" /> <result property="platformId" column="platform_id" />
<result property="gameCode" column="game_code" /> <result property="gameCode" column="game_code" />
<result property="ingress" column="ingress" />
<result property="gameSourceType" column="game_source_type" /> <result property="gameSourceType" column="game_source_type" />
<result property="gameName" column="game_name" /> <result property="gameName" column="game_name" />
<result property="freespin" column="freespin" /> <result property="freespin" column="freespin" />
@ -21,15 +22,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectGameVo"> <sql id="selectGameVo">
select id, sort_no, platform_id, game_code, game_source_type, game_name, freespin, demo_status, stop_status, create_by, create_time, update_by, update_time from ff_game select id, sort_no, platform_id, game_code,ingress, game_source_type, game_name, freespin, demo_status, stop_status, create_by, create_time, update_by, update_time from ff_game
</sql> </sql>
<select id="selectGameByGameCode" resultMap="GameResult">
<include refid="selectGameVo"/>
where game_code = #{gameCode} and platform_id = #{platformId}
</select>
<select id="selectGameList" parameterType="Game" resultMap="GameResult"> <select id="selectGameList" parameterType="Game" resultMap="GameResult">
<include refid="selectGameVo"/> <include refid="selectGameVo"/>
<where> <where>
<if test="sortNo != null "> and sort_no = #{sortNo}</if> <if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="platformId != null "> and platform_id = #{platformId}</if> <if test="platformId != null "> and platform_id = #{platformId}</if>
<if test="gameCode != null "> and game_code = #{gameCode}</if> <if test="gameCode != null "> and game_code = #{gameCode}</if>
<if test="ingress != null "> and ingress = #{ingress}</if>
<if test="gameSourceType != null "> and game_source_type = #{gameSourceType}</if> <if test="gameSourceType != null "> and game_source_type = #{gameSourceType}</if>
<if test="gameName != null and gameName != ''"> and game_name like concat('%', #{gameName}, '%')</if> <if test="gameName != null and gameName != ''"> and game_name like concat('%', #{gameName}, '%')</if>
<if test="freespin != null "> and freespin = #{freespin}</if> <if test="freespin != null "> and freespin = #{freespin}</if>
@ -49,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sortNo != null">sort_no,</if> <if test="sortNo != null">sort_no,</if>
<if test="platformId != null">platform_id,</if> <if test="platformId != null">platform_id,</if>
<if test="gameCode != null">game_code,</if> <if test="gameCode != null">game_code,</if>
<if test="ingress != null">ingress,</if>
<if test="gameSourceType != null">game_source_type,</if> <if test="gameSourceType != null">game_source_type,</if>
<if test="gameName != null and gameName != ''">game_name,</if> <if test="gameName != null and gameName != ''">game_name,</if>
<if test="freespin != null">freespin,</if> <if test="freespin != null">freespin,</if>
@ -63,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sortNo != null">#{sortNo},</if> <if test="sortNo != null">#{sortNo},</if>
<if test="platformId != null">#{platformId},</if> <if test="platformId != null">#{platformId},</if>
<if test="gameCode != null">#{gameCode},</if> <if test="gameCode != null">#{gameCode},</if>
<if test="ingress != null">#{ingress},</if>
<if test="gameSourceType != null">#{gameSourceType},</if> <if test="gameSourceType != null">#{gameSourceType},</if>
<if test="gameName != null and gameName != ''">#{gameName},</if> <if test="gameName != null and gameName != ''">#{gameName},</if>
<if test="freespin != null">#{freespin},</if> <if test="freespin != null">#{freespin},</if>
@ -81,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sortNo != null">sort_no = #{sortNo},</if> <if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="platformId != null">platform_id = #{platformId},</if> <if test="platformId != null">platform_id = #{platformId},</if>
<if test="gameCode != null">game_code = #{gameCode},</if> <if test="gameCode != null">game_code = #{gameCode},</if>
<if test="ingress != null">ingress = #{ingress},</if>
<if test="gameSourceType != null">game_source_type = #{gameSourceType},</if> <if test="gameSourceType != null">game_source_type = #{gameSourceType},</if>
<if test="gameName != null and gameName != ''">game_name = #{gameName},</if> <if test="gameName != null and gameName != ''">game_name = #{gameName},</if>
<if test="freespin != null">freespin = #{freespin},</if> <if test="freespin != null">freespin = #{freespin},</if>
@ -119,6 +130,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="demoStatus" column="demo_status"/> <result property="demoStatus" column="demo_status"/>
<result property="platformCode" column="platform_code"/> <result property="platformCode" column="platform_code"/>
<result property="platformType" column="platform_type"/> <result property="platformType" column="platform_type"/>
<result property="ingress" column="ingress"/>
</resultMap> </resultMap>
@ -129,6 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
g.freespin, g.freespin,
g.demo_status, g.demo_status,
gp.platform_code, gp.platform_code,
g.ingress,
gp.platform_type gp.platform_type
from ff_game g from ff_game g
inner join ff_game_platform gp on g.platform_id=gp.id inner join ff_game_platform gp on g.platform_id=gp.id
@ -137,12 +151,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectGameUniqueList" parameterType="com.ff.game.api.request.GameUniqueDTO" resultMap="GameResult"> <select id="selectGameUniqueList" parameterType="com.ff.game.api.request.GameUniqueDTO" resultMap="GameResult">
<include refid="selectGameVo"/> <include refid="selectGameVo"/>
<where> <where>
<if test="sortNo != null "> and sort_no = #{sortNo}</if> <if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="platformId != null "> and platform_id = #{platformId}</if> <if test="platformId != null "> and platform_id = #{platformId}</if>
<if test="gameCode != null "> and game_code = #{gameCode}</if> <if test="gameCode != null "> and game_code = #{gameCode}</if>
<if test="ingress != null "> and ingress = #{ingress}</if>
<if test="gameSourceType != null "> and game_source_type = #{gameSourceType}</if> <if test="gameSourceType != null "> and game_source_type = #{gameSourceType}</if>
<if test="gameName != null and gameName != ''"> and game_name like concat('%', #{gameName}, '%')</if> <if test="gameName != null and gameName != ''"> and game_name like concat('%', #{gameName}, '%')</if>
<if test="freespin != null "> and freespin = #{freespin}</if> <if test="freespin != null "> and freespin = #{freespin}</if>

View File

@ -9,7 +9,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="platform" column="platform" /> <result property="platform" column="platform" />
<result property="code" column="code" /> <result property="code" column="code" />
<result property="key" column="key" /> <result property="key" column="key" />
<result property="systemCode" column="system_code" /> <result property="currency" column="currency" />
<result property="systemCurrency" column="system_currency" />
<result property="lang" column="lang" /> <result property="lang" column="lang" />
<result property="systemLangCode" column="system_lang_code" /> <result property="systemLangCode" column="system_lang_code" />
<result property="info" column="info" /> <result property="info" column="info" />
@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectGameSecretKeyVo"> <sql id="selectGameSecretKeyVo">
select id, platform, code, `key`, system_code, lang, system_lang_code, info, create_by, create_time, update_by, update_time from ff_game_secret_key select id, platform, code,currency, `key`, system_currency, lang, system_lang_code, info, create_by, create_time, update_by, update_time from ff_game_secret_key
</sql> </sql>
<select id="selectGameSecretKeyList" parameterType="GameSecretKey" resultMap="GameSecretKeyResult"> <select id="selectGameSecretKeyList" parameterType="GameSecretKey" resultMap="GameSecretKeyResult">
@ -29,7 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="platform != null and platform != ''"> and platform = #{platform}</if> <if test="platform != null and platform != ''"> and platform = #{platform}</if>
<if test="code != null and code != ''"> and code = #{code}</if> <if test="code != null and code != ''"> and code = #{code}</if>
<if test="key != null and key != ''"> and `key` = #{key}</if> <if test="key != null and key != ''"> and `key` = #{key}</if>
<if test="systemCode != null and systemCode != ''"> and system_code = #{systemCode}</if> <if test="currency != null and currency != ''"> and currency = #{currency}</if>
<if test="systemCurrency != null and systemCurrency != ''"> and system_currency = #{systemCurrency}</if>
<if test="lang != null and lang != ''"> and lang = #{lang}</if> <if test="lang != null and lang != ''"> and lang = #{lang}</if>
<if test="systemLangCode != null and systemLangCode != ''"> and system_lang_code = #{systemLangCode}</if> <if test="systemLangCode != null and systemLangCode != ''"> and system_lang_code = #{systemLangCode}</if>
<if test="info != null and info != ''"> and info = #{info}</if> <if test="info != null and info != ''"> and info = #{info}</if>
@ -46,8 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if> <trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if>
<if test="platform != null and platform != ''">platform,</if> <if test="platform != null and platform != ''">platform,</if>
<if test="code != null and code != ''">code,</if> <if test="code != null and code != ''">code,</if>
<if test="currency != null and currency != ''">currency,</if>
<if test="key != null and key != ''">`key`,</if> <if test="key != null and key != ''">`key`,</if>
<if test="systemCode != null and systemCode != ''">system_code,</if> <if test="systemCurrency != null and systemCurrency != ''">system_currency,</if>
<if test="lang != null and lang != ''">lang,</if> <if test="lang != null and lang != ''">lang,</if>
<if test="systemLangCode != null">system_lang_code,</if> <if test="systemLangCode != null">system_lang_code,</if>
<if test="info != null and info != ''">info,</if> <if test="info != null and info != ''">info,</if>
@ -59,8 +62,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if>
<if test="platform != null and platform != ''">#{platform},</if> <if test="platform != null and platform != ''">#{platform},</if>
<if test="code != null and code != ''">#{code},</if> <if test="code != null and code != ''">#{code},</if>
<if test="currency != null and currency != ''">#{currency},</if>
<if test="key != null and key != ''">#{key},</if> <if test="key != null and key != ''">#{key},</if>
<if test="systemCode != null and systemCode != ''">#{systemCode},</if> <if test="systemCurrency != null and systemCurrency != ''">#{systemCurrency},</if>
<if test="lang != null and lang != ''">#{lang},</if> <if test="lang != null and lang != ''">#{lang},</if>
<if test="systemLangCode != null">#{systemLangCode},</if> <if test="systemLangCode != null">#{systemLangCode},</if>
<if test="info != null and info != ''">#{info},</if> <if test="info != null and info != ''">#{info},</if>
@ -77,7 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="platform != null and platform != ''">platform = #{platform},</if> <if test="platform != null and platform != ''">platform = #{platform},</if>
<if test="code != null and code != ''">code = #{code},</if> <if test="code != null and code != ''">code = #{code},</if>
<if test="key != null and key != ''">`key` = #{key},</if> <if test="key != null and key != ''">`key` = #{key},</if>
<if test="systemCode != null and systemCode != ''">system_code = #{systemCode},</if> <if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="systemCurrency != null and systemCurrency != ''">system_currency = #{systemCurrency},</if>
<if test="lang != null and lang != ''">lang = #{lang},</if> <if test="lang != null and lang != ''">lang = #{lang},</if>
<if test="systemLangCode != null">system_lang_code = #{systemLangCode},</if> <if test="systemLangCode != null">system_lang_code = #{systemLangCode},</if>
<if test="info != null and info != ''">info = #{info},</if> <if test="info != null and info != ''">info = #{info},</if>
@ -101,14 +106,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="findSystemByCode" resultType="string"> <select id="findSystemByCode" resultType="string">
SELECT system_code SELECT system_currency
FROM ff_game_secret_key FROM ff_game_secret_key
WHERE code = #{code} and platform = #{platform} WHERE code = #{code} and platform = #{platform}
</select> </select>
<select id="findSecretKeyByPlatformAndSystemCode" resultType="com.ff.game.domain.GameSecretKey"> <select id="findSecretKeyByPlatformAndSystemCurrency" resultType="com.ff.game.domain.GameSecretKey">
<include refid="selectGameSecretKeyVo"/> <include refid="selectGameSecretKeyVo"/>
where platform = #{platform} and system_code = #{systemCode} where platform = #{platform} and system_currency = #{systemCurrency}
</select> </select>
<select id="findByPlatformAndSystemLangCode" resultType="com.ff.game.domain.GameSecretKey"> <select id="findByPlatformAndSystemLangCode" resultType="com.ff.game.domain.GameSecretKey">