feat(game): 添加 PGT 游戏接口实现
- 新增 PGT 游戏列表获取功能- 实现 PGT 投注记录获取和处理 - 添加 PGT 成员踢出功能 - 优化 PGT 客户端接口定义 - 新增相关枚举类和数据传输对象main-meitian
parent
4e5fb79858
commit
905893df96
|
|
@ -68,6 +68,11 @@ public class CacheConstants {
|
|||
*/
|
||||
public static final String PG_GAMES = "pg_games:";
|
||||
|
||||
/**
|
||||
* pgt游戏
|
||||
*/
|
||||
public static final String PGT_GAMES = "pgt_games:";
|
||||
|
||||
|
||||
/**
|
||||
* fc游戏
|
||||
|
|
@ -89,6 +94,12 @@ public class CacheConstants {
|
|||
*/
|
||||
public static final String PG_GAMES_BET_CURRENCY = "pg_games:bet:currency";
|
||||
|
||||
|
||||
/**
|
||||
* pgt下一个id
|
||||
*/
|
||||
public static final String PGT_NEXT_ID = "pgt_next:id:";
|
||||
|
||||
/**
|
||||
* ae时间从
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ff.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 完成
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/04/07
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PGTBetStatus {
|
||||
OPEN(1, "打开 或 未结算", "OPEN"),
|
||||
SETTLED(2, "已结算", "SETTLED"),
|
||||
UNSETTLED(1, "未结算", "UNSETTLED"),
|
||||
VOID(3, "作废 或 无效", "VOID");
|
||||
|
||||
private final int code;
|
||||
private final String description;
|
||||
private final String type;
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.ff.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* pgt名称类型
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/04/07
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PGTGameType {
|
||||
EGAMES("EGAMES",1, "游戏老虎机"),
|
||||
LIVECASINO("LIVECASINO",2, "现场赌场"),
|
||||
SPORT("SPORT",8, "体育"),
|
||||
POKER("POKER",2, "扑克"),
|
||||
TRADING("TRADING",1, "贸易");
|
||||
|
||||
// 枚举字段
|
||||
private final String code;
|
||||
private final Integer systemCode;
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* 按代码查找系统
|
||||
*
|
||||
* @param code 代码
|
||||
* @return {@link Integer }
|
||||
*/
|
||||
public static Integer findSystemByCode(String code) {
|
||||
Optional<Integer> system = Stream.of(PGTGameType.values())
|
||||
.filter(gameType -> gameType.getCode().equals(code))
|
||||
.map(PGTGameType::getSystemCode)
|
||||
.findFirst();
|
||||
return system.orElse(null);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ff.base.enums;
|
||||
|
||||
import com.dtflys.forest.annotation.Get;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* pgtplayout状态
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/04/07
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PGTPayoutStatus {
|
||||
|
||||
LOSE("LOSE", 2, "输"),
|
||||
WIN("WIN",1, "赢"),
|
||||
DRAW("DRAW",3, "平"),
|
||||
UNKNOWN("UNKNOWN",4, "未知");
|
||||
|
||||
private final String code;
|
||||
private final Integer systemCode;
|
||||
private final String description;
|
||||
|
||||
public static PGTPayoutStatus getByCode(String code) {
|
||||
for (PGTPayoutStatus status : PGTPayoutStatus.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
|
@ -40,6 +40,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||
|
||||
public static final String ISO_8601_FORMAT= "yyyy-MM-dd'T'HH:mm:ss";
|
||||
|
||||
|
||||
|
||||
public static final String ISO_8601_FORMAT_Z= "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前Date型日期
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package com.ff.game.api.pgt.client;
|
|||
|
||||
import com.dtflys.forest.annotation.*;
|
||||
import com.ff.game.api.dg.dto.DGResponse;
|
||||
import com.ff.game.api.fc.dto.ApiFCGameListResponseDTO;
|
||||
import com.ff.game.api.jili.dto.JILIKickMemberAllDTO;
|
||||
import com.ff.game.api.jili.dto.JILIKickMemberDTO;
|
||||
import com.ff.game.api.ng.dto.ApiExchangeTransferStatusResponseDTO;
|
||||
import com.ff.game.api.ng.dto.ApiNGResponseDTO;
|
||||
import com.ff.game.api.pgt.address.MyPGTAddressSource;
|
||||
import com.ff.game.api.pgt.dto.*;
|
||||
import com.ff.game.api.pgx.dto.PGXPlayerStatusResponse;
|
||||
import com.ff.game.api.success.MySuccessCondition;
|
||||
import com.ff.game.api.xk.dto.XKKickMemberAllDTO;
|
||||
|
||||
|
|
@ -42,14 +44,7 @@ public interface PGTClient {
|
|||
PGTBalanceResponse getMemberInfo(@Var("parameters") String parameters, @Header Map<String, String> headerMap);
|
||||
|
||||
|
||||
/**
|
||||
* 获取会员游戏信息 目前仅支持供应商代号JD.
|
||||
*
|
||||
* @param parameters 范围
|
||||
* @return {@link PGXPlayerStatusResponse }
|
||||
*/
|
||||
@Get("/isPlayerIngame.ashx?${parameters}")
|
||||
PGXPlayerStatusResponse getMemberPlayInfo(@Var("parameters") String parameters);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -62,6 +57,17 @@ public interface PGTClient {
|
|||
PGTLoginResponse loginWithoutRedirect(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
|
||||
|
||||
|
||||
/**
|
||||
* 获取游戏列表
|
||||
*
|
||||
* @param parameters 范围
|
||||
* @param headerMap 标题映射
|
||||
* @return {@link PGTGameListResponse }
|
||||
*/
|
||||
@Get("/GetGameIconList")
|
||||
PGTGameListResponse getGameList(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
|
||||
|
||||
|
||||
/**
|
||||
* 押金
|
||||
*
|
||||
|
|
@ -101,32 +107,24 @@ public interface PGTClient {
|
|||
* @param headerMap 标题映射
|
||||
* @return {@link PGTTransactionDetailsResponse }
|
||||
*/
|
||||
@Get(url = "/betTransactionsV2")
|
||||
PGTTransactionDetailsResponse getBetRecordByTime(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
|
||||
@Get(url = "/betTransactionsV2?{parameters}")
|
||||
PGTTransactionDetailsResponse getBetRecordByTime(@Var("parameters") String parameters, @Header Map<String, String> headerMap);
|
||||
|
||||
|
||||
|
||||
@Get(url = "h/fetchArchieve.aspx?{parameters}")
|
||||
PGXBetHistoryResponse getBetRecordByHistoryTime(@Var("parameters") String parameters);
|
||||
|
||||
|
||||
/**
|
||||
* 踢出队员
|
||||
*
|
||||
* @param parameters 范围
|
||||
* @return {@link JILIKickMemberDTO }
|
||||
* @param headerMap 标题映射
|
||||
* @return {@link PGTKickMemberResponse }
|
||||
*/
|
||||
@Post("/kickPlayerFromProduct.ashx?{parameters}")
|
||||
PGXErrorResponse kickMember(@Var("parameters") String parameters);
|
||||
@Post("/seamless/kickOutPlayer")
|
||||
PGTKickMemberResponse kickMember(@JSONBody Map<String, Object> parameters, @Header Map<String, String> headerMap);
|
||||
|
||||
|
||||
/**
|
||||
* 踢出所有队员
|
||||
*
|
||||
* @param params 参数
|
||||
* @return {@link JILIKickMemberAllDTO }
|
||||
*/
|
||||
@Get("/kickMemberAll")
|
||||
XKKickMemberAllDTO kickMemberAll(@JSONBody Map<String, Object> params);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,133 @@
|
|||
package com.ff.game.api.pgt.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pgtgame列表响应
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/04/07
|
||||
*/
|
||||
@Data
|
||||
public class PGTGameListResponse {
|
||||
/**
|
||||
* 每个请求的唯一引用
|
||||
*/
|
||||
@JsonProperty("reqId")
|
||||
private String reqId;
|
||||
|
||||
/**
|
||||
* 响应状态,0 表示成功,其他值表示错误
|
||||
*/
|
||||
@JsonProperty("code")
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 有关响应状态的其他信息
|
||||
*/
|
||||
@JsonProperty("message")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 包含游戏数据的对象
|
||||
*/
|
||||
@JsonProperty("data")
|
||||
private GameData data;
|
||||
|
||||
@Data
|
||||
public static class GameData {
|
||||
|
||||
/**
|
||||
* 游戏列表
|
||||
*/
|
||||
@JsonProperty("games")
|
||||
private List<Game> games;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Game {
|
||||
|
||||
/**
|
||||
* 游戏名称
|
||||
*/
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 游戏类别
|
||||
*/
|
||||
@JsonProperty("category")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 游戏类型
|
||||
*/
|
||||
@JsonProperty("type")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 游戏代码
|
||||
*/
|
||||
@JsonProperty("code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 游戏图片链接
|
||||
*/
|
||||
@JsonProperty("img")
|
||||
private String img;
|
||||
|
||||
/**
|
||||
* 系统游戏id
|
||||
*/
|
||||
private Long systemGameId;
|
||||
|
||||
/**
|
||||
* 游戏排名
|
||||
*/
|
||||
@JsonProperty("rank")
|
||||
private int rank;
|
||||
|
||||
/**
|
||||
* 游戏提供者代码
|
||||
*/
|
||||
@JsonProperty("providerCode")
|
||||
private String providerCode;
|
||||
|
||||
|
||||
/**
|
||||
* 场所
|
||||
*/
|
||||
@JsonProperty("locale")
|
||||
private Locale locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* 场所
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/04/07
|
||||
*/
|
||||
@Data
|
||||
public class Locale {
|
||||
/**
|
||||
* 泰文
|
||||
*/
|
||||
@JsonProperty("TH")
|
||||
private String th;
|
||||
/**
|
||||
* 英语
|
||||
*/
|
||||
@JsonProperty("EN")
|
||||
private String en;
|
||||
/**
|
||||
* 中国
|
||||
*/
|
||||
@JsonProperty("CN")
|
||||
private String cn;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.ff.game.api.pgt.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pgtkick成员响应
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/04/07
|
||||
*/
|
||||
@Data
|
||||
public class PGTKickMemberResponse {
|
||||
|
||||
|
||||
/**
|
||||
* 每个请求的唯一引用
|
||||
*/
|
||||
@JsonProperty("reqId")
|
||||
private String reqId;
|
||||
|
||||
/**
|
||||
* 响应状态代码
|
||||
* 0:成功,其他代码表示失败
|
||||
*/
|
||||
@JsonProperty("code")
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 消息描述
|
||||
*/
|
||||
@JsonProperty("message")
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 交易数据
|
||||
*/
|
||||
@JsonProperty("data")
|
||||
private TransactionData data;
|
||||
|
||||
@Data
|
||||
public static class TransactionData {
|
||||
|
||||
/**
|
||||
* 交易成功的状态描述
|
||||
*/
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 玩家用户名
|
||||
*/
|
||||
@JsonProperty("username")
|
||||
private String username;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,8 @@ package com.ff.game.api.pgt.dto;
|
|||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -85,25 +87,25 @@ public class PGTTransactionDetailsResponse {
|
|||
* 结算时间
|
||||
*/
|
||||
@JsonProperty("accountingDate")
|
||||
private String accountingDate;
|
||||
private Date accountingDate;
|
||||
|
||||
/**
|
||||
* 最新更新时间
|
||||
*/
|
||||
@JsonProperty("updatedDate")
|
||||
private String updatedDate;
|
||||
private Date updatedDate;
|
||||
|
||||
/**
|
||||
* 质押金额
|
||||
*/
|
||||
@JsonProperty("stake")
|
||||
private double stake;
|
||||
private BigDecimal stake;
|
||||
|
||||
/**
|
||||
* 支付金额(包括本金)
|
||||
*/
|
||||
@JsonProperty("payout")
|
||||
private double payout;
|
||||
private BigDecimal payout;
|
||||
|
||||
/**
|
||||
* 产品 ID
|
||||
|
|
@ -131,6 +133,7 @@ public class PGTTransactionDetailsResponse {
|
|||
|
||||
/**
|
||||
* 投注状态(未结、已结算、未结算、无效)
|
||||
* OPEN, SETTLED, UNSETTLED, VOID
|
||||
*/
|
||||
@JsonProperty("betStatus")
|
||||
private String betStatus;
|
||||
|
|
|
|||
|
|
@ -1,148 +0,0 @@
|
|||
package com.ff.game.api.pgt.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 错误信息与投注历史记录返回结果对象
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/28
|
||||
*/
|
||||
@Data
|
||||
public class PGXBetHistoryResponse {
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
@JsonProperty("errCode")
|
||||
private Integer errCode;
|
||||
|
||||
/**
|
||||
* 投注历史记录的JSON字符串 (String类型)
|
||||
*/
|
||||
@JsonProperty("result")
|
||||
private String result;
|
||||
|
||||
/**
|
||||
* 错误信息 (String类型)
|
||||
*/
|
||||
@JsonProperty("errMsg")
|
||||
private String errMsg;
|
||||
|
||||
/**
|
||||
* AIO投注记录对象
|
||||
*/
|
||||
@Data
|
||||
public class Result {
|
||||
|
||||
/**
|
||||
* AIO注单号 (唯一值) (Long类型)
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 供应商注单号 (Long类型)
|
||||
*/
|
||||
@JsonProperty("ref_no")
|
||||
private Long refNo;
|
||||
|
||||
/**
|
||||
* 供应商代号 (String类型)
|
||||
*/
|
||||
@JsonProperty("site")
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 游戏类型代号 (String类型)
|
||||
*/
|
||||
@JsonProperty("product")
|
||||
private String product;
|
||||
|
||||
/**
|
||||
* 玩家帐号 (String类型)
|
||||
*/
|
||||
@JsonProperty("member")
|
||||
private String member;
|
||||
|
||||
/**
|
||||
* 游戏代号 (String类型)
|
||||
*/
|
||||
@JsonProperty("game_id")
|
||||
private String gameId;
|
||||
|
||||
/**
|
||||
* 下注时间 (玩家实际的投注时间) 依据 GMT/UTC +0 时区
|
||||
*/
|
||||
@JsonProperty("start_time")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结算时间 (String类型) 依据 GMT/UTC +0 时区
|
||||
*/
|
||||
@JsonProperty("end_time")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 开赛时间 (String类型) 依据 GMT/UTC +0 时区
|
||||
*/
|
||||
@JsonProperty("match_time")
|
||||
private String matchTime;
|
||||
|
||||
/**
|
||||
* 投注明细 (String类型)
|
||||
*/
|
||||
@JsonProperty("bet_detail")
|
||||
private String betDetail;
|
||||
|
||||
/**
|
||||
* 有效投注金额 (Double类型)
|
||||
*/
|
||||
@JsonProperty("turnover")
|
||||
private BigDecimal turnover;
|
||||
|
||||
/**
|
||||
* 投注金额 (Double类型)
|
||||
*/
|
||||
@JsonProperty("bet")
|
||||
private BigDecimal bet;
|
||||
|
||||
/**
|
||||
* 派彩金额 (Double类型)
|
||||
*/
|
||||
@JsonProperty("payout")
|
||||
private BigDecimal payout;
|
||||
|
||||
/**
|
||||
* 佣金 (Double类型)
|
||||
*/
|
||||
@JsonProperty("commission")
|
||||
private BigDecimal commission;
|
||||
|
||||
/**
|
||||
* 彩池投注金额 (Double类型)
|
||||
*/
|
||||
@JsonProperty("p_share")
|
||||
private BigDecimal pShare;
|
||||
|
||||
/**
|
||||
* 彩池派彩金额 (Double类型)
|
||||
*/
|
||||
@JsonProperty("p_win")
|
||||
private BigDecimal pWin;
|
||||
|
||||
/**
|
||||
* 注单状态 (Int类型)
|
||||
* 1 (valid bet record 有效注单)
|
||||
* 0 (running/ongoing match 赛事进行中)
|
||||
* -1 (invalid bet record 无效注单 e.g. voided 作废, canceled 取消)
|
||||
*/
|
||||
@JsonProperty("status")
|
||||
private int status;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package com.ff.game.api.pgt.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 错误响应类
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/27
|
||||
*/
|
||||
@Data
|
||||
public class PGXErrorResponse {
|
||||
|
||||
/** 错误码 */
|
||||
@JsonProperty("errCode")
|
||||
private Integer errCode;
|
||||
|
||||
/** 内部参考代码 (字符串类型) */
|
||||
@JsonProperty("innerCode")
|
||||
private String innerCode;
|
||||
|
||||
/** 错误信息 (字符串类型) */
|
||||
@JsonProperty("errMsg")
|
||||
private String errMsg;
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
package com.ff.game.api.pgt.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pgxexchange传输状态响应
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/28
|
||||
*/
|
||||
@Data
|
||||
public class PGXExchangeTransferStatusResponse {
|
||||
|
||||
/** 错误码 */
|
||||
@JsonProperty("errCode")
|
||||
private Integer errCode;
|
||||
|
||||
|
||||
|
||||
/** 错误信息 (字符串类型) */
|
||||
@JsonProperty("errMsg")
|
||||
private String errMsg;
|
||||
|
||||
|
||||
/** GSC生成的转账ID (String类型) */
|
||||
@JsonProperty("trans_id")
|
||||
private String transId;
|
||||
|
||||
/** 交易时间,GMT+0 (String类型) */
|
||||
@JsonProperty("trans_time")
|
||||
private String transTime;
|
||||
|
||||
/** 玩家姓名 (String类型) */
|
||||
@JsonProperty("username")
|
||||
private String username;
|
||||
|
||||
/** 交易类型 (String类型),0为存款,1为取款 */
|
||||
@JsonProperty("type")
|
||||
private String type;
|
||||
|
||||
/** 提供商 (String类型) */
|
||||
@JsonProperty("provider")
|
||||
private String provider;
|
||||
|
||||
/** 交易金额 (double类型) */
|
||||
@JsonProperty("amount")
|
||||
private double amount;
|
||||
|
||||
/** 运营商的参考ID (String类型) */
|
||||
@JsonProperty("ref_id")
|
||||
private String refId;
|
||||
|
||||
/** 交易状态 (String类型),SUCCESS 成功
|
||||
PROCESSING 进行中,请稍后再确认
|
||||
FAILED 失败 */
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
|
||||
/** GSC操作员代码 (String类型) */
|
||||
@JsonProperty("operator")
|
||||
private String operator;
|
||||
|
||||
/** 交易备注 (String类型) */
|
||||
@JsonProperty("remark")
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package com.ff.game.api.pgt.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 游戏响应对象
|
||||
*/
|
||||
@Data
|
||||
public class PGXGameLoginResponse {
|
||||
|
||||
/**
|
||||
* 错误码 (String类型)
|
||||
*/
|
||||
@JsonProperty("errCode")
|
||||
private Integer errCode;
|
||||
|
||||
/**
|
||||
* 启动游戏链接 (String类型)
|
||||
*/
|
||||
@JsonProperty("gameUrl")
|
||||
private String gameUrl;
|
||||
|
||||
/**
|
||||
* 错误信息 (String类型)
|
||||
*/
|
||||
@JsonProperty("errMsg")
|
||||
private String errMsg;
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package com.ff.game.api.pgt.dto;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 响应类,包含错误码、余额和错误信息
|
||||
*/
|
||||
@Data
|
||||
public class PGXMemberResponse {
|
||||
|
||||
/** 错误码 */
|
||||
@JsonProperty("errCode")
|
||||
private Integer errCode;
|
||||
|
||||
/** 账户余额 (小数类型) */
|
||||
@JsonProperty("balance")
|
||||
private BigDecimal balance;
|
||||
|
||||
/** 错误信息 (字符串类型) */
|
||||
@JsonProperty("errMsg")
|
||||
private String errMsg;
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package com.ff.game.api.pgt.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 响应类,包含错误码、玩家是否在游戏中状态和错误信息
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/28
|
||||
*/
|
||||
@Data
|
||||
public class PGXPlayerStatusResponse {
|
||||
|
||||
/** 错误码 (字符串类型) */
|
||||
@JsonProperty("errCode")
|
||||
private Integer errCode;
|
||||
|
||||
/** 玩家是否在游戏中 (字符串类型) "true" 表示在游戏中,"false" 表示不在游戏中 */
|
||||
@JsonProperty("result")
|
||||
private Boolean result;
|
||||
|
||||
/** 错误信息 (字符串类型) */
|
||||
@JsonProperty("errMsg")
|
||||
private String errMsg;
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
package com.ff.game.api.pgt.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
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;
|
||||
|
|
@ -9,13 +11,18 @@ 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.JsonUtil;
|
||||
import com.ff.base.utils.sign.Base64;
|
||||
import com.ff.config.KeyConfig;
|
||||
import com.ff.game.api.IGamesService;
|
||||
import com.ff.game.api.fc.dto.ApiFCGameListResponseDTO;
|
||||
import com.ff.game.api.fc.dto.ApiFCResult;
|
||||
import com.ff.game.api.pgt.client.PGTClient;
|
||||
import com.ff.game.api.pgt.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.GameSecretKeyCurrencyDTO;
|
||||
import com.ff.game.service.*;
|
||||
|
|
@ -32,10 +39,8 @@ import org.springframework.util.ObjectUtils;
|
|||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
|
@ -206,9 +211,60 @@ public class GamesPGTServiceImpl implements IGamesService {
|
|||
@Transactional
|
||||
@Override
|
||||
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
||||
List<PGTGameListResponse.Game> apiGameInfoResponseDTOS = redisCache.getCacheList(CacheConstants.PGT_GAMES);
|
||||
if (!CollectionUtils.isEmpty(apiGameInfoResponseDTOS)) {
|
||||
return CacheConstants.PGT_GAMES;
|
||||
}
|
||||
|
||||
|
||||
return CacheConstants.PGX_GAMES;
|
||||
log.info("GamesPGTServiceImpl [getGameList] 请求参数 {}", gamesBaseRequestDTO);
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("productId", productId);
|
||||
PGTGameListResponse gameList = pgtClient.getGameList(paramsMap, this.getKey(gamesBaseRequestDTO));
|
||||
if (this.getIsSuccess(gameList.getCode())) {
|
||||
|
||||
|
||||
//新增游戏
|
||||
for (PGTGameListResponse.Game gameIdKey : gameList.getData().getGames()) {
|
||||
|
||||
Game game = Game.builder()
|
||||
.platformCode(GamePlatforms.PGT.getCode())
|
||||
.gameCode(gameIdKey.getCode())
|
||||
.build();
|
||||
List<Game> games = gameService.selectGameList(game);
|
||||
int platformType = PGTGameType.findSystemByCode(gameIdKey.getCategory());
|
||||
//不存在这个游戏
|
||||
if (CollectionUtils.isEmpty(games)) {
|
||||
|
||||
game.setGameSourceType(gameIdKey.getCategory());
|
||||
game.setFreespin(Boolean.FALSE);
|
||||
game.setDemoStatus(Boolean.FALSE);
|
||||
game.setPlatformCode(GamePlatforms.PGT.getCode());
|
||||
game.setPlatformType(platformType);
|
||||
game.setSortNo(gameService.selectMaxSortNo(platformType, GamePlatforms.PGT.getCode()) + 1);
|
||||
game.setGameName(gameIdKey.getLocale().getCn());
|
||||
game.setCreateBy(Constants.SYSTEM);
|
||||
|
||||
List<NameInfo> nameInfos = new ArrayList<>();
|
||||
nameInfos.add(NameInfo.builder().lang("zh-CN").name(gameIdKey.getLocale().getCn()).build());
|
||||
nameInfos.add(NameInfo.builder().lang("en-US").name(gameIdKey.getLocale().getEn()).build());
|
||||
nameInfos.add(NameInfo.builder().lang("th-TH").name(gameIdKey.getLocale().getTh()).build());
|
||||
game.setNameInfo(nameInfos);
|
||||
gameService.insertGame(game);
|
||||
} else {
|
||||
game = games.get(0);
|
||||
}
|
||||
gameIdKey.setSystemGameId(game.getId());
|
||||
}
|
||||
|
||||
|
||||
redisCache.deleteObject(CacheConstants.PGT_GAMES);
|
||||
redisCache.setCacheList(CacheConstants.PGT_GAMES, gameList.getData().getGames());
|
||||
redisCache.expire(CacheConstants.PGT_GAMES, 5L, TimeUnit.HOURS);
|
||||
} else {
|
||||
throw new ApiException(ErrorCode.ERROR.getCode());
|
||||
}
|
||||
return CacheConstants.PGT_GAMES;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -361,23 +417,31 @@ public class GamesPGTServiceImpl implements IGamesService {
|
|||
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
||||
//请求参数
|
||||
log.info("GamesPGTServiceImpl [getBetRecordByTime] 请求参数 {}", betRecordByTimeDTO);
|
||||
|
||||
String startTime = DateUtils.convertTimestampToFormattedDate(betRecordByTimeDTO.getStartTime(), DateUtils.ISO_8601_FORMAT_Z, "GMT+8");
|
||||
String endTime = DateUtils.convertTimestampToFormattedDate(betRecordByTimeDTO.getEndTime(), DateUtils.ISO_8601_FORMAT_Z, "GMT+8");
|
||||
|
||||
String nextId = redisCache.getCacheObject(CacheConstants.PGT_NEXT_ID);
|
||||
|
||||
|
||||
Map<String, Object> paramsMap = new LinkedHashMap<>();
|
||||
paramsMap.put("productId", productId);
|
||||
paramsMap.put("date", productId);
|
||||
paramsMap.put("startTime", productId);
|
||||
paramsMap.put("endTime", productId);
|
||||
paramsMap.put("nextId", productId);
|
||||
paramsMap.put("startTime", startTime);
|
||||
paramsMap.put("endTime", endTime);
|
||||
paramsMap.put("nextId", nextId);
|
||||
Map<String, String> key = this.getKey(betRecordByTimeDTO);
|
||||
|
||||
PGTTransactionDetailsResponse betRecordByTime = pgtClient.getBetRecordByTime(paramsMap, key);
|
||||
PGTTransactionDetailsResponse betRecordByTime = pgtClient.getBetRecordByTime(JsonUtil.mapToQueryString(paramsMap), key);
|
||||
|
||||
if (this.getIsSuccess(betRecordByTime.getCode())) {
|
||||
List<PGTTransactionDetailsResponse.Transaction> txns = betRecordByTime.getData().getTxns();
|
||||
this.batchInsert(txns, betRecordByTimeDTO);
|
||||
//保存本次请求的id
|
||||
redisCache.setCacheObject(CacheConstants.PGT_NEXT_ID, betRecordByTime.getData().getNextId());
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
log.error("GamesPGXServiceImpl [getBetRecordByTime] 获取投注记录失败,错误代码{},错误信息{}", betRecordByTime.getErrCode(), betRecordByTime.getErrMsg());
|
||||
throw new BaseException(betRecordByTime.getErrMsg());
|
||||
log.error("GamesPGXServiceImpl [getBetRecordByTime] 获取投注记录失败,错误代码{},错误信息{}", betRecordByTime.getCode(), betRecordByTime.getMessage());
|
||||
throw new BaseException(betRecordByTime.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -389,21 +453,7 @@ public class GamesPGTServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
||||
//请求参数
|
||||
log.info("GamesPGXServiceImpl [getBetRecordByHistoryTime] 请求参数 {}", betRecordByTimeDTO);
|
||||
Map<String, Object> paramsMap = new LinkedHashMap<>();
|
||||
paramsMap.put("operatorcode", betRecordByTimeDTO.getAgentId());
|
||||
paramsMap.put("versionkey", 0);
|
||||
PGXBetHistoryResponse betRecordByTime = pgtClient.getBetRecordByHistoryTime(JsonUtil.mapToQueryString(paramsMap));
|
||||
|
||||
if (this.getIsSuccess(betRecordByTime.getErrCode())) {
|
||||
List<PGXBetHistoryResponse.Result> results = JSON.parseArray(betRecordByTime.getResult(), PGXBetHistoryResponse.Result.class);
|
||||
this.batchInsert(results, betRecordByTimeDTO);
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
log.error("GamesPGXServiceImpl [getBetRecordByHistoryTime] 获取投注记录失败,错误代码{},错误信息{}", betRecordByTime.getErrCode(), betRecordByTime.getErrMsg());
|
||||
throw new BaseException(betRecordByTime.getErrMsg());
|
||||
}
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -436,7 +486,18 @@ public class GamesPGTServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean kickMember(KickMemberRequestDTO kickMemberRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
log.info("GamesPGTServiceImpl [kickMember] 请求参数 {}", kickMemberRequestDTO);
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("username", kickMemberRequestDTO.getAccount());
|
||||
paramsMap.put("productId", productId);
|
||||
Map<String, String> key = this.getKey(kickMemberRequestDTO);
|
||||
|
||||
PGTKickMemberResponse pgtKickMemberResponse = pgtClient.kickMember(paramsMap, key);
|
||||
if (this.getIsSuccess(pgtKickMemberResponse.getCode())&&"SUCCESS".equals(pgtKickMemberResponse.getData().getStatus())) {
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
throw new ApiException(ErrorCode.KICK_OUT_AILED.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -495,7 +556,9 @@ public class GamesPGTServiceImpl implements IGamesService {
|
|||
|
||||
//数据转化
|
||||
for (PGTTransactionDetailsResponse.Transaction bean : dataBean) {
|
||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().agentId(gamesBaseRequestDTO.getAgentId()).data(bean).build());
|
||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().agentId(gamesBaseRequestDTO.getAgentId())
|
||||
.platform(gamesBaseRequestDTO.getVendor())
|
||||
.data(bean).build());
|
||||
if (!ObjectUtils.isEmpty(bettingDetails)) {
|
||||
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
||||
gameBettingDetails.add(bettingDetails);
|
||||
|
|
@ -527,7 +590,51 @@ public class GamesPGTServiceImpl implements IGamesService {
|
|||
@Override
|
||||
public GameBettingDetails dataBuild(GamesDataBuildDTO gamesDataBuildDTO) {
|
||||
//转化类
|
||||
PGTTransactionDetailsResponse.Transaction resultBean = (PGTTransactionDetailsResponse.Transaction) gamesDataBuildDTO.getData();
|
||||
|
||||
return new GameBettingDetails();
|
||||
|
||||
//只要结算的数据
|
||||
if (!PGTBetStatus.SETTLED.getType().equals(resultBean.getBetStatus())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Member member = memberService.selectMemberByGameAccount(resultBean.getUsername());
|
||||
if (ObjectUtils.isEmpty(member)) {
|
||||
return null;
|
||||
}
|
||||
List<PGTGameListResponse.Game> gamesDatas = redisCache.getCacheList(CacheConstants.PGT_GAMES);
|
||||
Map<String, PGTGameListResponse.Game> dataDTOMap = gamesDatas.stream().collect(Collectors.toMap(PGTGameListResponse.Game::getCode, e -> e));
|
||||
PGTGameListResponse.Game gamesDataDTO = dataDTOMap.get(resultBean.getGameCode());
|
||||
|
||||
|
||||
//数据构造
|
||||
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
||||
.tenantKey(member.getTenantKey())
|
||||
//保存我们的币种id
|
||||
.currencyCode(gamesDataBuildDTO.getPlatform().getOurCurrency(resultBean.getCurrency()))
|
||||
.memberId(member.getId())
|
||||
.gameCode(resultBean.getGameCode())
|
||||
.gameType(PGTGameType.findSystemByCode(gamesDataDTO.getCategory()))
|
||||
.platformCode(GamePlatforms.PGT.getCode())
|
||||
.gameId(gamesDataDTO.getSystemGameId())
|
||||
.gameName(gamesDataDTO.getName())
|
||||
.gameStatus(PGTPayoutStatus.getByCode(resultBean.getPayoutStatus()).getSystemCode())
|
||||
.gameStatusType(1)
|
||||
.gameCurrencyCode(resultBean.getCurrency())
|
||||
.account(resultBean.getUsername())
|
||||
.wagersId(resultBean.getBetId())
|
||||
.wagersTime(resultBean.getAccountingDate().getTime())
|
||||
.betAmount(resultBean.getPayout())
|
||||
.payoffTime(resultBean.getAccountingDate().getTime())
|
||||
.payoffAmount(resultBean.getStake())
|
||||
.settlementTime(resultBean.getAccountingDate().getTime())
|
||||
.turnover(resultBean.getPayout())
|
||||
.orderNo(resultBean.getRoundId())
|
||||
.settlementStatus(SettlementStatusEnum.COMPLETED.getCode())
|
||||
.build();
|
||||
gameBettingDetails.setCreateBy(Constants.SYSTEM);
|
||||
gameBettingDetails.setCreateTime(DateUtils.getNowDate());
|
||||
return gameBettingDetails;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ public class GameBettingDetails extends BaseEntity
|
|||
@Excel(name = "游戏名称")
|
||||
private String gameName;
|
||||
|
||||
/** 注单状态 1: 赢 2: 输 3: 平局 */
|
||||
@Excel(name = "注单状态 1: 赢 2: 输 3: 平局")
|
||||
/** 注单状态 1: 赢 2: 输 3: 平局 4 未知 */
|
||||
@Excel(name = "注单状态 1: 赢 2: 输 3: 平局 4 未知")
|
||||
private Integer gameStatus;
|
||||
|
||||
/** 注单类型
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ public class Platform extends BaseEntity {
|
|||
return this.type == Type.MULTI.getCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我们货币
|
||||
*
|
||||
* @param currency 它们的货币
|
||||
* @return {@link String }
|
||||
*/
|
||||
public String getOurCurrency(String currency) {
|
||||
Set<Map.Entry<String, String>> entrySet= currencyInfo.entrySet();
|
||||
for (Map.Entry<String, String> entry : entrySet) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue