fix:完善后台管理页面wechat模块,修复自动配置类的加载条件等
This commit is contained in:
@@ -9,23 +9,23 @@
|
||||
export default {
|
||||
dev: {
|
||||
'/api-uaa/': {
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-user/': {
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-log/': {
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-search/': {
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-generator/': {
|
||||
@@ -34,18 +34,18 @@
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-file/': {
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-order/': {
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-device/': {
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
+96
-12
@@ -3,13 +3,21 @@ import {
|
||||
ProForm,
|
||||
ProFormText,
|
||||
ProFormSelect,
|
||||
ProFormSwitch,
|
||||
ProFormDigit,
|
||||
} from '@ant-design/pro-components';
|
||||
import React from 'react';
|
||||
|
||||
const STATUS_OPTIONS = [
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 },
|
||||
] as const;
|
||||
];
|
||||
|
||||
const TYPE_OPTIONS = [
|
||||
{ label: '公众号', value: 'MP' },
|
||||
{ label: '小程序', value: 'MINI' },
|
||||
{ label: '支付', value: 'PAY' },
|
||||
];
|
||||
|
||||
interface UpdateFormProps {
|
||||
onSubmit: (values: any) => Promise<void>;
|
||||
@@ -21,7 +29,7 @@ interface UpdateFormProps {
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
return (
|
||||
<ModalForm
|
||||
title="修改小程序"
|
||||
title="修改微信配置"
|
||||
width={600}
|
||||
visible={props.updateModalVisible}
|
||||
onVisibleChange={props.onVisibleChange}
|
||||
@@ -30,23 +38,94 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
modalProps={{ destroyOnClose: true }}
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '小程序名称不能为空' }]}
|
||||
<ProFormSelect
|
||||
rules={[{ required: true, message: '配置类型不能为空' }]}
|
||||
width="md"
|
||||
name="name"
|
||||
label="小程序名称"
|
||||
name="type"
|
||||
label="配置类型"
|
||||
options={TYPE_OPTIONS}
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: 'AppID不能为空' }]}
|
||||
rules={[{ required: true, message: '商户ID不能为空' }]}
|
||||
width="md"
|
||||
name="appid"
|
||||
label="AppID"
|
||||
name="merchantId"
|
||||
label="商户ID"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: 'Secret不能为空' }]}
|
||||
rules={[{ required: true, message: '应用ID不能为空' }]}
|
||||
width="md"
|
||||
name="secret"
|
||||
label="Secret"
|
||||
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: '状态不能为空' }]}
|
||||
@@ -55,6 +134,11 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
label="状态"
|
||||
options={STATUS_OPTIONS}
|
||||
/>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="remark"
|
||||
label="备注"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import {
|
||||
PlusOutlined,
|
||||
ExportOutlined,
|
||||
ImportOutlined,
|
||||
DownloadOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
@@ -11,18 +8,26 @@ import {
|
||||
ProForm,
|
||||
ProFormText,
|
||||
ProFormSelect,
|
||||
ProFormSwitch,
|
||||
ProFormDigit,
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Button, message, Space, Tag } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { getMiniAppList, saveOrUpdateMiniApp, deleteMiniApp } from '@/services/system/api';
|
||||
import { getMiniAppList, saveMiniApp, updateMiniApp, deleteMiniApp } from '@/services/system/api';
|
||||
import UpdateForm from './components/UpdateForm';
|
||||
|
||||
const STATUS_OPTIONS = [
|
||||
const STATUS_OPTIONS: { label: string; value: number }[] = [
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 },
|
||||
] as const;
|
||||
];
|
||||
|
||||
const TYPE_OPTIONS: { label: string; value: string }[] = [
|
||||
{ label: '公众号', value: 'MP' },
|
||||
{ label: '小程序', value: 'MINI' },
|
||||
{ label: '支付', value: 'PAY' },
|
||||
];
|
||||
|
||||
const TableList: React.FC = () => {
|
||||
const [searchParams, setSearchParams] = useState<Record<string, string | number>>({});
|
||||
@@ -62,18 +67,23 @@ const TableList: React.FC = () => {
|
||||
width: 48,
|
||||
},
|
||||
{
|
||||
title: '小程序名称',
|
||||
dataIndex: 'name',
|
||||
title: '配置类型',
|
||||
dataIndex: 'type',
|
||||
valueType: 'select',
|
||||
valueEnum: {
|
||||
MP: { text: '公众号' },
|
||||
MINI: { text: '小程序' },
|
||||
PAY: { text: '支付' },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '商户ID',
|
||||
dataIndex: 'merchantId',
|
||||
copyable: true,
|
||||
},
|
||||
{
|
||||
title: 'AppCode',
|
||||
dataIndex: 'appid',
|
||||
copyable: true,
|
||||
},
|
||||
{
|
||||
title: 'AppID',
|
||||
dataIndex: 'appid',
|
||||
title: '应用ID',
|
||||
dataIndex: 'appId',
|
||||
copyable: true,
|
||||
},
|
||||
{
|
||||
@@ -90,6 +100,16 @@ const TableList: React.FC = () => {
|
||||
</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '分账功能',
|
||||
dataIndex: 'profitSharingEnabled',
|
||||
valueType: 'switch',
|
||||
},
|
||||
{
|
||||
title: '异步处理',
|
||||
dataIndex: 'asyncEnabled',
|
||||
valueType: 'switch',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
@@ -141,23 +161,94 @@ const TableList: React.FC = () => {
|
||||
// 表单字段定义
|
||||
const renderModalContent = () => (
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '小程序名称不能为空' }]}
|
||||
<ProFormSelect
|
||||
rules={[{ required: true, message: '配置类型不能为空' }]}
|
||||
width="md"
|
||||
name="name"
|
||||
label="小程序名称"
|
||||
name="type"
|
||||
label="配置类型"
|
||||
options={TYPE_OPTIONS}
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: 'AppID不能为空' }]}
|
||||
rules={[{ required: true, message: '商户ID不能为空' }]}
|
||||
width="md"
|
||||
name="appid"
|
||||
label="AppID"
|
||||
name="merchantId"
|
||||
label="商户ID"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: 'Secret不能为空' }]}
|
||||
rules={[{ required: true, message: '应用ID不能为空' }]}
|
||||
width="md"
|
||||
name="secret"
|
||||
label="Secret"
|
||||
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: '状态不能为空' }]}
|
||||
@@ -167,11 +258,16 @@ const TableList: React.FC = () => {
|
||||
options={STATUS_OPTIONS}
|
||||
initialValue={1}
|
||||
/>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="remark"
|
||||
label="备注"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
);
|
||||
|
||||
return (
|
||||
<PageContainer header={{ subTitle: '管理系统中的小程序配置' }}>
|
||||
<PageContainer header={{ subTitle: '管理系统中的微信配置' }}>
|
||||
<QueryFilter
|
||||
defaultCollapsed
|
||||
split
|
||||
@@ -181,8 +277,9 @@ const TableList: React.FC = () => {
|
||||
name="searchKey"
|
||||
label="搜索"
|
||||
valueEnum={{
|
||||
name: '小程序名称',
|
||||
appid: 'AppID',
|
||||
type: '配置类型',
|
||||
merchantId: '商户ID',
|
||||
appId: '应用ID',
|
||||
}}
|
||||
/>
|
||||
<ProFormText name="searchValue" placeholder="请输入关键字" />
|
||||
@@ -190,15 +287,15 @@ const TableList: React.FC = () => {
|
||||
|
||||
<ProTable<SYSTEM.MiniApp>
|
||||
rowKey="id"
|
||||
headerTitle="小程序管理"
|
||||
headerTitle="微信配置管理"
|
||||
actionRef={actionRef}
|
||||
request={async (params, sorter, filter) => {
|
||||
const res = await getMiniAppList({
|
||||
page: params.current,
|
||||
limit: params.pageSize,
|
||||
page: params.current || 1,
|
||||
limit: params.pageSize || 10,
|
||||
searchKey: params.searchKey,
|
||||
searchValue: params.searchValue,
|
||||
});
|
||||
}) as any;
|
||||
|
||||
return {
|
||||
data: res.data || [],
|
||||
@@ -221,13 +318,19 @@ const TableList: React.FC = () => {
|
||||
/>
|
||||
|
||||
<ModalForm
|
||||
title="新增小程序"
|
||||
title="新增微信配置"
|
||||
visible={createModalVisible}
|
||||
onVisibleChange={handleModalVisible}
|
||||
modalProps={{ destroyOnClose: true }}
|
||||
onFinish={async (values) => {
|
||||
const success = await handleRequest(
|
||||
() => saveOrUpdateMiniApp(values),
|
||||
() => saveMiniApp({
|
||||
...values,
|
||||
id: currentRow?.id,
|
||||
appId: values.appId,
|
||||
appSecret: values.appSecret,
|
||||
status: values.status,
|
||||
} as SYSTEM.MiniApp),
|
||||
'正在添加',
|
||||
'添加成功'
|
||||
);
|
||||
@@ -245,7 +348,7 @@ const TableList: React.FC = () => {
|
||||
<UpdateForm
|
||||
onSubmit={async (values) => {
|
||||
const success = await handleRequest(
|
||||
() => saveOrUpdateMiniApp({ ...values, id: currentRow?.id }),
|
||||
() => updateMiniApp({ ...values, id: currentRow?.id }),
|
||||
'正在更新',
|
||||
'更新成功'
|
||||
);
|
||||
|
||||
@@ -254,21 +254,33 @@ export async function getMiniAppList(params: {
|
||||
searchKey?: string;
|
||||
searchValue?: string;
|
||||
}) {
|
||||
return request<API.OptionalResult<SYSTEM.MiniApp[]>>('/api-user/miniApp/list', {
|
||||
return request<{
|
||||
data: SYSTEM.MiniApp[];
|
||||
count: number;
|
||||
resp_code: number;
|
||||
resp_msg?: string;
|
||||
}>('/api-user/wechat/config', {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export async function saveOrUpdateMiniApp(data: SYSTEM.MiniApp) {
|
||||
return request<API.OptionalResult<any>>('/api-user/miniApp/saveOrUpdate', {
|
||||
export async function saveMiniApp(data: SYSTEM.MiniApp) {
|
||||
return request<API.OptionalResult<any>>('/api-user/wechat/config', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateMiniApp(data: SYSTEM.MiniApp) {
|
||||
return request<API.OptionalResult<any>>('/api-user/wechat/config', {
|
||||
method: 'PUT',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteMiniApp(id: number) {
|
||||
return request<API.OptionalResult<any>>(`/api-user/miniApp/delete/${id}`, {
|
||||
return request<API.OptionalResult<any>>(`/api-user/wechat/config/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -104,11 +104,36 @@ declare namespace SYSTEM {
|
||||
|
||||
interface MiniApp {
|
||||
id: number;
|
||||
appid: string;
|
||||
secret: string;
|
||||
name: string;
|
||||
tenantId?: string;
|
||||
type?: string;
|
||||
merchantId?: string;
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
mchKey?: string;
|
||||
mchSerialNo?: string;
|
||||
privateKeyPath?: string;
|
||||
apiV3Key?: string;
|
||||
notifyUrl?: string;
|
||||
token?: string;
|
||||
aesKey?: string;
|
||||
paymentSuccessTemplateId?: string;
|
||||
videoCompleteTemplateId?: string;
|
||||
videoFailTemplateId?: string;
|
||||
profitSharingEnabled?: boolean;
|
||||
asyncEnabled?: boolean;
|
||||
asyncPoolSize?: number;
|
||||
status: number;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
remark?: string;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace API {
|
||||
interface OptionalResult<T> {
|
||||
data: T;
|
||||
count: number;
|
||||
resp_code: number;
|
||||
resp_msg?: string;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user