fix(小程序配置):优化小程序地址管理

This commit is contained in:
2025-07-21 17:08:21 +08:00
parent 2d1484897d
commit 7572aea6b7
4 changed files with 217 additions and 112 deletions
@@ -20,7 +20,7 @@ public class WechatConfig {
private String tenantId;
/**
* 配置类型:MP-公众号,MINI-小程序,PAY-支付
* 配置类型:MP-公众号,MINI-小程序,PAY-支付,MA-小程序消息
*/
private String type;
@@ -74,8 +74,14 @@ const TableList: React.FC = () => {
MP: { text: '公众号' },
MINI: { text: '小程序' },
PAY: { text: '支付' },
MA: { text: '小程序消息' },
},
},
{
title: '租户ID',
dataIndex: 'tenantId',
copyable: true,
},
{
title: '商户ID',
dataIndex: 'merchantId',
@@ -86,6 +92,28 @@ const TableList: React.FC = () => {
dataIndex: 'appId',
copyable: true,
},
{
title: '服务商模式',
dataIndex: 'isServiceMode',
valueType: 'select',
valueEnum: {
true: { text: '服务商' },
false: { text: '普通商户' },
},
render: (_, record) => (
<Tag color={record.isServiceMode ? 'blue' : 'default'}>
{record.isServiceMode ? '服务商' : '普通商户'}
</Tag>
),
},
{
title: '服务商商户号',
dataIndex: 'serviceMchId',
},
{
title: '子商户号',
dataIndex: 'subMchId',
},
{
title: '状态',
dataIndex: 'status',
@@ -101,12 +129,12 @@ const TableList: React.FC = () => {
),
},
{
title: '分账功能',
title: '分账',
dataIndex: 'profitSharingEnabled',
valueType: 'switch',
},
{
title: '异步处理',
title: '异步',
dataIndex: 'asyncEnabled',
valueType: 'switch',
},
@@ -122,6 +150,11 @@ const TableList: React.FC = () => {
valueType: 'dateTime',
sorter: true,
},
{
title: '备注',
dataIndex: 'remark',
ellipsis: true,
},
{
title: '操作',
dataIndex: 'option',
@@ -160,110 +193,163 @@ const TableList: React.FC = () => {
// 表单字段定义
const renderModalContent = () => (
<ProForm.Group>
<ProFormSelect
rules={[{ required: true, message: '配置类型不能为空' }]}
width="md"
name="type"
label="配置类型"
options={TYPE_OPTIONS}
/>
<ProFormText
rules={[{ required: true, message: '商户ID不能为空' }]}
width="md"
name="merchantId"
label="商户ID"
/>
<ProFormText
rules={[{ required: true, message: '应用ID不能为空' }]}
width="md"
name="appId"
label="应用ID"
/>
<ProFormText
rules={[{ required: true, message: '应用密钥不能为空' }]}
width="md"
name="appSecret"
label="应用密钥"
/>
<ProFormText
width="md"
name="mchKey"
label="商户API密钥"
/>
<ProFormText
width="md"
name="mchSerialNo"
label="商户证书序列号"
/>
<ProFormText
width="md"
name="privateKeyPath"
label="商户私钥文件路径"
/>
<ProFormText
width="md"
name="apiV3Key"
label="APIv3密钥"
/>
<ProFormText
width="md"
name="notifyUrl"
label="支付回调地址"
/>
<ProFormText
width="md"
name="token"
label="微信公众号token"
/>
<ProFormText
width="md"
name="aesKey"
label="微信公众号aesKey"
/>
<ProFormText
width="md"
name="paymentSuccessTemplateId"
label="支付成功通知模板ID"
/>
<ProFormText
width="md"
name="videoCompleteTemplateId"
label="视频处理完成通知模板ID"
/>
<ProFormText
width="md"
name="videoFailTemplateId"
label="视频处理失败通知模板ID"
/>
<ProFormSwitch
name="profitSharingEnabled"
label="启用分账"
/>
<ProFormSwitch
name="asyncEnabled"
label="启用异步处理"
/>
<ProFormDigit
name="asyncPoolSize"
label="异步处理线程池大小"
min={1}
max={100}
/>
<ProFormSelect
rules={[{ required: true, message: '状态不能为空' }]}
width="md"
name="status"
label="状态"
options={STATUS_OPTIONS}
initialValue={1}
/>
<ProFormText
width="md"
name="remark"
label="备注"
/>
</ProForm.Group>
<>
<ProForm.Group>
<ProFormSelect
rules={[{ required: true, message: '配置类型不能为空' }]}
width="md"
name="type"
label="配置类型"
options={TYPE_OPTIONS}
/>
<ProFormText
width="md"
name="tenantId"
label="租户ID"
/>
<ProFormText
rules={[{ required: true, message: '商户ID不能为空' }]}
width="md"
name="merchantId"
label="商户ID"
/>
<ProFormText
rules={[{ required: true, message: '应用ID不能为空' }]}
width="md"
name="appId"
label="应用ID"
/>
<ProFormText
rules={[{ required: true, message: '应用密钥不能为空' }]}
width="md"
name="appSecret"
label="应用密钥"
/>
<ProFormText
width="md"
name="mchKey"
label="商户API密钥"
/>
<ProFormText
width="md"
name="mchSerialNo"
label="商户证书序列号"
/>
<ProFormText
width="md"
name="serialNumber"
label="微信平台证书序列号"
/>
<ProFormText
width="md"
name="privateKeyPath"
label="商户私钥文件路径"
/>
<ProFormText
width="md"
name="privateKey"
label="商户私钥"
/>
<ProFormText
width="md"
name="apiV3Key"
label="APIv3密钥"
/>
<ProFormText
width="md"
name="notifyUrl"
label="支付回调地址"
/>
<ProFormText
width="md"
name="token"
label="微信公众号token"
/>
<ProFormText
width="md"
name="aesKey"
label="微信公众号aesKey"
/>
<ProFormText
width="md"
name="paymentSuccessTemplateId"
label="支付成功通知模板ID"
/>
<ProFormText
width="md"
name="videoCompleteTemplateId"
label="视频处理完成通知模板ID"
/>
<ProFormText
width="md"
name="videoFailTemplateId"
label="视频处理失败通知模板ID"
/>
<ProFormSwitch
name="profitSharingEnabled"
label="启用分账"
/>
<ProFormSwitch
name="asyncEnabled"
label="启用异步处理"
/>
<ProFormDigit
name="asyncPoolSize"
label="异步处理线程池大小"
min={1}
max={100}
/>
<ProFormSelect
rules={[{ required: true, message: '状态不能为空' }]}
width="md"
name="status"
label="状态"
options={STATUS_OPTIONS}
initialValue={1}
/>
<ProFormText
width="md"
name="remark"
label="备注"
/>
</ProForm.Group>
<ProForm.Group title="服务商模式相关">
<ProFormSwitch
name="isServiceMode"
label="服务商模式"
/>
<ProFormText
width="md"
name="serviceAppId"
label="服务商应用ID"
/>
<ProFormText
width="md"
name="serviceMchId"
label="服务商商户号"
/>
<ProFormText
width="md"
name="subMchId"
label="子商户号"
/>
<ProFormText
width="md"
name="subAppId"
label="子商户应用ID"
/>
<ProFormText
width="md"
name="subMchName"
label="子商户名称"
/>
<ProFormText
width="md"
name="subMchDescription"
label="子商户描述"
/>
</ProForm.Group>
</>
);
return (
@@ -296,7 +382,6 @@ const TableList: React.FC = () => {
searchKey: params.searchKey,
searchValue: params.searchValue,
}) as any;
return {
data: res.data || [],
success: res.resp_code === 0,
@@ -254,15 +254,26 @@ export async function getMiniAppList(params: {
searchKey?: string;
searchValue?: string;
}) {
return request<{
data: SYSTEM.MiniApp[];
count: number;
// 适配微信配置管理后台接口
const res = await request<{
data: {
data: SYSTEM.MiniApp[];
count: number;
resp_code: number;
resp_msg?: string;
};
resp_code: number;
resp_msg?: string;
}>('/api-user/wechat/config', {
}>('/api-user/wechat/config/list', {
method: 'GET',
params,
});
return {
data: res.data?.data || [],
count: res.data?.count || 0,
resp_code: res.resp_code,
resp_msg: res.resp_msg,
};
}
export async function saveMiniApp(data: SYSTEM.MiniApp) {
@@ -111,7 +111,9 @@ declare namespace SYSTEM {
appSecret: string;
mchKey?: string;
mchSerialNo?: string;
serialNumber?: string;
privateKeyPath?: string;
privateKey?: string;
apiV3Key?: string;
notifyUrl?: string;
token?: string;
@@ -124,6 +126,13 @@ declare namespace SYSTEM {
asyncPoolSize?: number;
status: number;
remark?: string;
isServiceMode?: boolean;
serviceAppId?: string;
serviceMchId?: string;
subMchId?: string;
subAppId?: string;
subMchName?: string;
subMchDescription?: string;
createTime?: string;
updateTime?: string;
}