refactor(admin): 支付调试页改为直调 unipay 模拟商户 API

新增无鉴权 unipay 客户端;组参补齐 reqTime/nonceStr 后签名并 POST /unipay/pay。
移除 develop:trade:pay 后门依赖,结果展示完整 DaxResult。
This commit is contained in:
DaxPay Dev
2026-07-13 09:41:46 +08:00
parent b3dd7b963c
commit 0d61a3c5ea
7 changed files with 233 additions and 64 deletions

View File

@@ -5,6 +5,8 @@ import { defHttp } from '#/api/request';
/**
* 交易开发调试 API
*
* 仅组参辅助与签名, 真实支付见 unipay-trade.api (POST /unipay/pay)
*/
export const DevelopTradeApi = {
/**
@@ -14,13 +16,6 @@ export const DevelopTradeApi = {
return defHttp.post({ url: '/admin/develop/trade/sign', data });
},
/**
* 支付调试(真实发起)
*/
pay(data: DevelopParam): Promise<Result<DevelopPayResult>> {
return defHttp.post({ url: '/admin/develop/trade/pay', data });
},
/**
* 已启用渠道支付方式目录(供调试页支付方式下拉)
*/
@@ -57,7 +52,7 @@ export interface DevelopParam {
privateKey?: string;
}
/** 支付参数 */
/** 支付参数(与 unipay NormalPayParam 对齐) */
export interface PayParam {
/** 商户号 */
mchNo: string;
@@ -89,6 +84,14 @@ export interface PayParam {
returnUrl?: string;
/** 过期时间(北京时间 yyyy-MM-dd HH:mm:ss) */
expiredTime?: string;
/** 客户端 IP(可选, 未传时由 unipay 从 HTTP 请求提取) */
clientIp?: string;
/** 随机串 */
nonceStr?: string;
/** 请求时间(北京时间 yyyy-MM-dd HH:mm:ss) */
reqTime?: string;
/** 签名 */
sign?: string;
}
/** 支付结果 */
@@ -114,11 +117,3 @@ export interface DevelopSignResult {
/** 签名值 */
sign?: string;
}
/** 支付调试结果 */
export interface DevelopPayResult {
/** 支付结果 */
payResult?: PayResult;
/** 响应签名(平台私钥签名) */
sign?: string;
}