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