feat(api): 添加游戏兑换余额状态接口
- 新增 exchangeState 方法处理游戏兑换余额状态请求 - 添加 GameExchangeStateRequest 类用于请求参数 - 更新 GameExchangeBalanceResponse 类,修改状态字段含义 - 在 ErrorCode 枚举中添加 ORDER_NOT_EXIST 错误码main-p
parent
707d5cdee9
commit
c91fa58672
|
@ -23,6 +23,7 @@ public enum ErrorCode {
|
||||||
FREQUENT_INTERFACE_REQUESTS (1007, "接口请求频繁"),
|
FREQUENT_INTERFACE_REQUESTS (1007, "接口请求频繁"),
|
||||||
BALANCE_TRANSFER_FAILED (1008, "余额转移失败"),
|
BALANCE_TRANSFER_FAILED (1008, "余额转移失败"),
|
||||||
LANG_NOT_EXIST(1009, "游戏平台不支持的语言"),
|
LANG_NOT_EXIST(1009, "游戏平台不支持的语言"),
|
||||||
|
ORDER_NOT_EXIST(1010, "订单不存在")
|
||||||
;
|
;
|
||||||
|
|
||||||
// 获取错误码
|
// 获取错误码
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
@ -236,6 +237,29 @@ public class ApiGameController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交换状态
|
||||||
|
*
|
||||||
|
* @param gameExchangeStateRequest 游戏兑换余额状态请求
|
||||||
|
* @return {@link AjaxResult }
|
||||||
|
*/
|
||||||
|
@PostMapping("/exchange/state")
|
||||||
|
@Transactional
|
||||||
|
public AjaxResult exchangeState(@Validated @RequestBody GameExchangeStateRequest gameExchangeStateRequest) {
|
||||||
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
|
GameExchangeMoney gameExchangeMoney = GameExchangeMoney.builder()
|
||||||
|
.tenantKey(tenantSecretKey.getTenantKey())
|
||||||
|
.orderId(gameExchangeStateRequest.getOrderId())
|
||||||
|
.build();
|
||||||
|
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(gameExchangeMoney);
|
||||||
|
ApiException.isTrue(!CollectionUtils.isEmpty(gameExchangeMonies), ErrorCode.ORDER_NOT_EXIST.getCode());
|
||||||
|
GameExchangeBalanceResponse gameExchangeBalanceResponse = new GameExchangeBalanceResponse();
|
||||||
|
BeanUtils.copyProperties(gameExchangeMonies.get(0), gameExchangeBalanceResponse);
|
||||||
|
return AjaxResult.success(gameExchangeBalanceResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 赠送免费局数
|
* 赠送免费局数
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ff.api.request;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏交换状态请求
|
||||||
|
*
|
||||||
|
* @author shi
|
||||||
|
* @date 2025/03/14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GameExchangeStateRequest implements Serializable {
|
||||||
|
private final static long serialVersionUID = 5862750025968209889L;
|
||||||
|
/**
|
||||||
|
* 交易编号
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
}
|
|
@ -62,8 +62,9 @@ public class GameExchangeBalanceResponse implements Serializable
|
||||||
/** 转出类型 1游戏商转入到用户全部转出 2 用户转移到游戏商 */
|
/** 转出类型 1游戏商转入到用户全部转出 2 用户转移到游戏商 */
|
||||||
private Integer exchangeType;
|
private Integer exchangeType;
|
||||||
|
|
||||||
/** 状态 1 成功 2失败 */
|
/** 状态,0:进行中、1:成功、2:失败 */
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue