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,6 +193,7 @@ const TableList: React.FC = () => {
// 表单字段定义 // 表单字段定义
const renderModalContent = () => ( const renderModalContent = () => (
<>
<ProForm.Group> <ProForm.Group>
<ProFormSelect <ProFormSelect
rules={[{ required: true, message: '配置类型不能为空' }]} rules={[{ required: true, message: '配置类型不能为空' }]}
@@ -168,6 +202,11 @@ const TableList: React.FC = () => {
label="配置类型" label="配置类型"
options={TYPE_OPTIONS} options={TYPE_OPTIONS}
/> />
<ProFormText
width="md"
name="tenantId"
label="租户ID"
/>
<ProFormText <ProFormText
rules={[{ required: true, message: '商户ID不能为空' }]} rules={[{ required: true, message: '商户ID不能为空' }]}
width="md" width="md"
@@ -196,11 +235,21 @@ const TableList: React.FC = () => {
name="mchSerialNo" name="mchSerialNo"
label="商户证书序列号" label="商户证书序列号"
/> />
<ProFormText
width="md"
name="serialNumber"
label="微信平台证书序列号"
/>
<ProFormText <ProFormText
width="md" width="md"
name="privateKeyPath" name="privateKeyPath"
label="商户私钥文件路径" label="商户私钥文件路径"
/> />
<ProFormText
width="md"
name="privateKey"
label="商户私钥"
/>
<ProFormText <ProFormText
width="md" width="md"
name="apiV3Key" name="apiV3Key"
@@ -264,6 +313,43 @@ const TableList: React.FC = () => {
label="备注" label="备注"
/> />
</ProForm.Group> </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<{ // 适配微信配置管理后台接口
const res = await request<{
data: {
data: SYSTEM.MiniApp[]; data: SYSTEM.MiniApp[];
count: number; count: number;
resp_code: number; resp_code: number;
resp_msg?: string; resp_msg?: string;
}>('/api-user/wechat/config', { };
resp_code: number;
resp_msg?: string;
}>('/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;
} }