支付协议修改
This commit is contained in:
@@ -38,10 +38,10 @@ export class OrderData extends BaseData {
|
||||
wallet: res.wallet || "", // 充值钱包地址
|
||||
amount: res.amount || "", // 充值金额
|
||||
expire: res.Expire || 0, // 过期时间,单位: 秒
|
||||
expireUnix: res.ExpireUnix || "", // 过期时间戳
|
||||
expireUnix: res.ExpireUnix || "", // 过期时间戳,秒
|
||||
status: "CREATED" as OrderStatus, // 订单状态
|
||||
retCode: 0, // 失败时的原因码
|
||||
createdAt: Date.now(), // 订单创建时间
|
||||
createdAt: Date.now(), // 订单创建时间,毫秒
|
||||
};
|
||||
this._orders.set(orderId, vo);
|
||||
console.log("保存订单数据:", this._orders);
|
||||
@@ -83,6 +83,69 @@ export class OrderData extends BaseData {
|
||||
return ids;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取支付url */
|
||||
public getPayUrlById(id: string): string {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return "";
|
||||
return oneData.payUrl;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取支付类型 */
|
||||
public getPayTypeById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.payType;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取网络类型 */
|
||||
public getNetworkById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.network;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取充值钱包地址 */
|
||||
public getWalletById(id: string): string {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return "";
|
||||
return oneData.wallet;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取充值金额 */
|
||||
public getAmountById(id: string): string {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return "";
|
||||
return oneData.amount;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取过期时间,单位: 秒 */
|
||||
public getExpireById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.expire;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取过期时间戳,秒 */
|
||||
public getExpireUnixById(id: string): string {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return "";
|
||||
return oneData.expireUnix;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取订单失败时的原因码 */
|
||||
public getRetCodeById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.retCode;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取订单创建时间,毫秒 */
|
||||
public getCreatedAtById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.createdAt;
|
||||
}
|
||||
|
||||
/** --------------------------------------------------------- 缓存逻辑 --------------------------------------------------------- */
|
||||
|
||||
private ensureMap(): Map<string, OrderVO> {
|
||||
|
||||
Reference in New Issue
Block a user