Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit. On branch develop Your branch is up to date with 'goflyapp/develop'. Changes to be committed: new file: zlt-business/order-center/src/main/java/com/central/order/config/AsyncConfig.java new file: zlt-business/order-center/src/main/java/com/central/order/controller/MessageController.java modified: zlt-business/order-center/src/main/java/com/central/order/controller/OrderController.java new file: zlt-business/order-center/src/main/java/com/central/order/enums/MessageTemplateEnum.java new file: zlt-business/order-center/src/main/java/com/central/order/enums/OrderStatusChangeEnum.java new file: zlt-business/order-center/src/main/java/com/central/order/event/OrderStatusChangeEvent.java new file: zlt-business/order-center/src/main/java/com/central/order/listener/OrderStatusChangeListener.java new file: zlt-business/order-center/src/main/java/com/central/order/mapper/MessageMapper.java new file: zlt-business/order-center/src/main/java/com/central/order/model/Message.java new file: zlt-business/order-center/src/main/java/com/central/order/service/IMessageService.java new file: zlt-business/order-center/src/main/java/com/central/order/service/impl/MessageServiceImpl.java modified: zlt-business/order-center/src/main/java/com/central/order/service/impl/OrderServiceImpl.java modified: zlt-business/order-center/src/main/resources/bootstrap.yml new file: zlt-business/order-center/src/main/resources/mapper/MessageMapper.xml modified: zlt-web/react-web/src/main/frontend/config/routes.ts modified: zlt-web/react-web/src/main/frontend/src/components/RightContent/index.tsx new file: zlt-web/react-web/src/main/frontend/src/models/useMessage.ts new file: zlt-web/react-web/src/main/frontend/src/pages/message/index.less new file: zlt-web/react-web/src/main/frontend/src/pages/message/index.tsx deleted: zlt-web/react-web/src/main/frontend/src/pages/system/Tenant/components/CreateForm.tsx deleted: zlt-web/react-web/src/main/frontend/src/pages/system/Tenant/components/UpdateForm.tsx deleted: zlt-web/react-web/src/main/frontend/src/pages/system/Tenant/index.tsx new file: zlt-web/react-web/src/main/frontend/src/services/message/api.ts new file: zlt-web/react-web/src/main/frontend/src/services/message/typings.d.ts modified: zlt-web/react-web/src/main/frontend/src/services/system/api.ts modified: zlt-web/react-web/src/main/frontend/src/services/system/typings.d.ts Changes not staged for commit: modified: zlt-business/order-center/src/main/java/com/central/order/controller/OrderController.java modified: zlt-business/order-center/src/main/java/com/central/order/enums/MessageTemplateEnum.java modified: zlt-business/order-center/src/main/java/com/central/order/enums/OrderStatusChangeEnum.java modified: zlt-business/order-center/src/main/java/com/central/order/event/OrderStatusChangeEvent.java modified: zlt-business/order-center/src/main/java/com/central/order/listener/OrderStatusChangeListener.java modified: zlt-business/order-center/src/main/java/com/central/order/mapper/MessageMapper.java modified: zlt-business/order-center/src/main/java/com/central/order/service/impl/MessageServiceImpl.java modified: zlt-business/order-center/src/main/java/com/central/order/service/impl/OrderServiceImpl.java modified: zlt-business/order-center/src/main/resources/mapper/MessageMapper.xml modified: zlt-business/order-center/src/main/resources/mapper/OrderMapper.xml modified: zlt-web/react-web/src/main/frontend/src/services/message/api.ts
This commit is contained in:
@@ -24,10 +24,6 @@
|
||||
path: '/system/role.html',
|
||||
component: './system/Role',
|
||||
},
|
||||
{
|
||||
path: '/system/tenant.html',
|
||||
component: './system/Tenant',
|
||||
},
|
||||
{
|
||||
path: '/system/tokens.html',
|
||||
component: './system/Token',
|
||||
@@ -64,6 +60,15 @@
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/message',
|
||||
routes: [
|
||||
{
|
||||
path: '/message/message.html',
|
||||
component: './message/index',
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/orders',
|
||||
routes: [
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { GithubOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { Space } from 'antd';
|
||||
import { GithubOutlined, QuestionCircleOutlined, BellOutlined } from '@ant-design/icons';
|
||||
import { Space, Badge } from 'antd';
|
||||
import React from 'react';
|
||||
import { useModel } from 'umi';
|
||||
import AvatarDropdown from './AvatarDropdown';
|
||||
import styles from './index.less';
|
||||
import { history } from 'umi';
|
||||
|
||||
export type SiderTheme = 'light' | 'dark';
|
||||
|
||||
const GlobalHeaderRight: React.FC = () => {
|
||||
const { initialState } = useModel('@@initialState');
|
||||
const { unreadCount } = useModel('useMessage');
|
||||
|
||||
if (!initialState || !initialState.settings) {
|
||||
return null;
|
||||
@@ -61,6 +63,14 @@ const GlobalHeaderRight: React.FC = () => {
|
||||
>
|
||||
<GithubOutlined />
|
||||
</span>
|
||||
<span
|
||||
className={styles.action}
|
||||
onClick={() => history.push('/message')}
|
||||
>
|
||||
<Badge count={unreadCount}>
|
||||
<BellOutlined className={styles.icon} />
|
||||
</Badge>
|
||||
</span>
|
||||
<AvatarDropdown menu />
|
||||
</Space>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { getMessages } from '@/services/message/api';
|
||||
|
||||
export default () => {
|
||||
const [unreadCount, setUnreadCount] = useState<number>(0);
|
||||
|
||||
const fetchUnreadCount = async () => {
|
||||
try {
|
||||
const response = await getMessages({ status: 0, pageSize: 1 });
|
||||
setUnreadCount(response.total || 0);
|
||||
} catch (error) {
|
||||
console.error('获取未读消息数量失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchUnreadCount();
|
||||
// 设置定时刷新
|
||||
const timer = setInterval(fetchUnreadCount, 60000); // 每分钟刷新一次
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
unreadCount,
|
||||
refreshUnreadCount: fetchUnreadCount,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
.unreadTitle {
|
||||
font-weight: 500;
|
||||
color: #1890ff;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -12px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background-color: #f5222d;
|
||||
}
|
||||
}
|
||||
|
||||
.messageContent {
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.messageTime {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
import { getMessages, markAsRead, markAllAsRead, deleteMessage } from '@/services/message/api';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
PageContainer,
|
||||
ProTable,
|
||||
ProFormSelect,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Button, message, Tag, Space, Modal, Typography } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { history } from 'umi';
|
||||
import styles from './index.less';
|
||||
|
||||
const { Link, Paragraph } = Typography;
|
||||
|
||||
// 消息类型配置
|
||||
const MESSAGE_TYPE = {
|
||||
1: { text: '退款订单', color: 'warning' },
|
||||
2: { text: '新增订单', color: 'success' },
|
||||
3: { text: '系统通知', color: 'info' },
|
||||
};
|
||||
|
||||
// 消息状态配置
|
||||
const MESSAGE_STATUS = {
|
||||
0: { text: '未读', color: 'processing' },
|
||||
1: { text: '已读', color: 'default' },
|
||||
};
|
||||
|
||||
const MessageList: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [selectedRows, setSelectedRows] = useState<MESSAGE.Message[]>([]);
|
||||
|
||||
// 处理消息点击
|
||||
const handleMessageClick = async (record: MESSAGE.Message) => {
|
||||
if (record.status === 0) {
|
||||
await markAsRead(record.id);
|
||||
actionRef.current?.reload();
|
||||
}
|
||||
|
||||
// 根据消息类型跳转到相应页面
|
||||
if (record.type === 1 && record.relatedId) {
|
||||
history.push(`/orders/refund?id=${record.relatedId}`);
|
||||
} else if (record.type === 2 && record.relatedId) {
|
||||
history.push(`/orders/order?id=${record.relatedId}`);
|
||||
}
|
||||
};
|
||||
|
||||
// 标记所有已读
|
||||
const handleMarkAllRead = async () => {
|
||||
try {
|
||||
await markAllAsRead();
|
||||
message.success('已全部标记为已读');
|
||||
actionRef.current?.reload();
|
||||
} catch (error) {
|
||||
message.error('操作失败');
|
||||
}
|
||||
};
|
||||
|
||||
const columns: ProColumns<MESSAGE.Message>[] = [
|
||||
{
|
||||
title: '消息类型',
|
||||
dataIndex: 'type',
|
||||
width: 100,
|
||||
render: (type) => {
|
||||
const typeInfo = MESSAGE_TYPE[type as keyof typeof MESSAGE_TYPE] ||
|
||||
{ text: '未知类型', color: 'default' };
|
||||
return <Tag color={typeInfo.color}>{typeInfo.text}</Tag>;
|
||||
},
|
||||
valueEnum: Object.entries(MESSAGE_TYPE).reduce((acc, [key, value]) => {
|
||||
acc[key] = { text: value.text };
|
||||
return acc;
|
||||
}, {} as Record<string, { text: string }>),
|
||||
},
|
||||
{
|
||||
title: '标题',
|
||||
dataIndex: 'title',
|
||||
render: (_, record) => (
|
||||
<Link
|
||||
className={record.status === 0 ? styles.unreadTitle : ''}
|
||||
onClick={() => handleMessageClick(record)}
|
||||
>
|
||||
{record.title}
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '内容',
|
||||
dataIndex: 'content',
|
||||
ellipsis: true,
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
width: 80,
|
||||
render: (status) => {
|
||||
const statusInfo = MESSAGE_STATUS[status as keyof typeof MESSAGE_STATUS];
|
||||
return <Tag color={statusInfo.color}>{statusInfo.text}</Tag>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '时间',
|
||||
dataIndex: 'createTime',
|
||||
valueType: 'dateTime',
|
||||
width: 180,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
{record.status === 0 && (
|
||||
<Link onClick={() => handleMessageClick(record)}>查看</Link>
|
||||
)}
|
||||
<Link
|
||||
onClick={() => {
|
||||
Modal.confirm({
|
||||
title: '确认删除该消息?',
|
||||
onOk: async () => {
|
||||
await deleteMessage(record.id);
|
||||
actionRef.current?.reload();
|
||||
message.success('删除成功');
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Link>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<ProTable<MESSAGE.Message>
|
||||
headerTitle="消息列表"
|
||||
actionRef={actionRef}
|
||||
rowKey="id"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button key="markAllRead" onClick={handleMarkAllRead}>
|
||||
全部标记已读
|
||||
</Button>,
|
||||
]}
|
||||
request={getMessages}
|
||||
columns={columns}
|
||||
rowSelection={{
|
||||
onChange: (_, selectedRows) => {
|
||||
setSelectedRows(selectedRows);
|
||||
},
|
||||
}}
|
||||
pagination={{
|
||||
showQuickJumper: true,
|
||||
showSizeChanger: true,
|
||||
}}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default MessageList;
|
||||
@@ -1,59 +0,0 @@
|
||||
import {
|
||||
ModalForm,
|
||||
ProForm,
|
||||
ProFormText,
|
||||
ProFormTextArea,
|
||||
} from '@ant-design/pro-components';
|
||||
import React from 'react';
|
||||
|
||||
interface CreateFormProps {
|
||||
visible: boolean;
|
||||
onVisibleChange: (visible: boolean) => void;
|
||||
onSubmit: (values: SYSTEM.Tenant) => Promise<void>;
|
||||
}
|
||||
|
||||
const CreateForm: React.FC<CreateFormProps> = (props) => {
|
||||
return (
|
||||
<ModalForm
|
||||
title="新增租户"
|
||||
visible={props.visible}
|
||||
onVisibleChange={props.onVisibleChange}
|
||||
onFinish={props.onSubmit}
|
||||
modalProps={{ destroyOnClose: true }}
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="name"
|
||||
label="租户名称"
|
||||
rules={[{ required: true, message: '请输入租户名称' }]}
|
||||
width="md"
|
||||
/>
|
||||
<ProFormText
|
||||
name="code"
|
||||
label="租户编码"
|
||||
rules={[{ required: true, message: '请输入租户编码' }]}
|
||||
width="md"
|
||||
/>
|
||||
<ProFormText
|
||||
name="contactPerson"
|
||||
label="联系人"
|
||||
rules={[{ required: true, message: '请输入联系人' }]}
|
||||
width="md"
|
||||
/>
|
||||
<ProFormText
|
||||
name="contactPhone"
|
||||
label="联系电话"
|
||||
rules={[{ required: true, message: '请输入联系电话' }]}
|
||||
width="md"
|
||||
/>
|
||||
<ProFormTextArea
|
||||
name="address"
|
||||
label="地址"
|
||||
width="md"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default CreateForm;
|
||||
@@ -1,61 +0,0 @@
|
||||
import {
|
||||
ModalForm,
|
||||
ProForm,
|
||||
ProFormText,
|
||||
ProFormTextArea,
|
||||
} from '@ant-design/pro-components';
|
||||
import React from 'react';
|
||||
|
||||
interface UpdateFormProps {
|
||||
visible: boolean;
|
||||
onVisibleChange: (visible: boolean) => void;
|
||||
onSubmit: (values: SYSTEM.Tenant) => Promise<void>;
|
||||
values?: SYSTEM.Tenant;
|
||||
}
|
||||
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
return (
|
||||
<ModalForm
|
||||
title="修改租户"
|
||||
visible={props.visible}
|
||||
onVisibleChange={props.onVisibleChange}
|
||||
onFinish={props.onSubmit}
|
||||
initialValues={props.values}
|
||||
modalProps={{ destroyOnClose: true }}
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="name"
|
||||
label="租户名称"
|
||||
rules={[{ required: true, message: '请输入租户名称' }]}
|
||||
width="md"
|
||||
/>
|
||||
<ProFormText
|
||||
name="code"
|
||||
label="租户编码"
|
||||
rules={[{ required: true, message: '请输入租户编码' }]}
|
||||
width="md"
|
||||
/>
|
||||
<ProFormText
|
||||
name="contactPerson"
|
||||
label="联系人"
|
||||
rules={[{ required: true, message: '请输入联系人' }]}
|
||||
width="md"
|
||||
/>
|
||||
<ProFormText
|
||||
name="contactPhone"
|
||||
label="联系电话"
|
||||
rules={[{ required: true, message: '请输入联系电话' }]}
|
||||
width="md"
|
||||
/>
|
||||
<ProFormTextArea
|
||||
name="address"
|
||||
label="地址"
|
||||
width="md"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default UpdateForm;
|
||||
@@ -1,213 +0,0 @@
|
||||
import {
|
||||
getTenantList,
|
||||
saveOrUpdateTenant,
|
||||
deleteTenant,
|
||||
updateTenantStatus
|
||||
} from '@/services/system/api';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import { PageContainer, ProFormText, ProTable, QueryFilter } from '@ant-design/pro-components';
|
||||
import { Typography, message, Popconfirm, Button, Space, Switch } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import CreateForm from './components/CreateForm';
|
||||
import UpdateForm from './components/UpdateForm';
|
||||
|
||||
const { Link } = Typography;
|
||||
|
||||
// 统一的错误处理
|
||||
const handleApiRequest = async (
|
||||
apiCall: () => Promise<any>,
|
||||
loadingMessage: string,
|
||||
successMessage: string,
|
||||
) => {
|
||||
const hide = message.loading(loadingMessage);
|
||||
try {
|
||||
const result = await apiCall();
|
||||
hide();
|
||||
if (result.code === 0) {
|
||||
message.success(successMessage);
|
||||
return true;
|
||||
}
|
||||
message.error(result.message || '操作失败');
|
||||
return false;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('操作失败');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const TenantList: React.FC = () => {
|
||||
const [params, setParams] = useState<Record<string, string | number>>({});
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [createModalVisible, handleCreateModalVisible] = useState<boolean>(false);
|
||||
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
||||
const [currentRow, setCurrentRow] = useState<any>();
|
||||
|
||||
// 处理状态切换
|
||||
const handleStatusChange = async (checked: boolean, record: SYSTEM.Tenant) => {
|
||||
const success = await handleApiRequest(
|
||||
() => updateTenantStatus(record.id!, checked ? 1 : 0),
|
||||
'正在更新状态',
|
||||
'状态更新成功'
|
||||
);
|
||||
if (success && actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
};
|
||||
|
||||
const columns: ProColumns<SYSTEM.Tenant>[] = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
valueType: 'indexBorder',
|
||||
width: 48,
|
||||
},
|
||||
{
|
||||
title: '租户名称',
|
||||
dataIndex: 'name',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '租户编码',
|
||||
dataIndex: 'code',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '联系人',
|
||||
dataIndex: 'contactPerson',
|
||||
},
|
||||
{
|
||||
title: '联系电话',
|
||||
dataIndex: 'contactPhone',
|
||||
},
|
||||
{
|
||||
title: '地址',
|
||||
dataIndex: 'address',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
width: 100,
|
||||
render: (_, record) => (
|
||||
<Switch
|
||||
checked={record.status === 1}
|
||||
onChange={(checked) => handleStatusChange(checked, record)}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
valueType: 'dateTime',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
width: 180,
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
<Link
|
||||
onClick={() => {
|
||||
setCurrentRow(record);
|
||||
handleUpdateModalVisible(true);
|
||||
}}
|
||||
>
|
||||
修改
|
||||
</Link>
|
||||
<Popconfirm
|
||||
title={`确认删除租户[${record.name}]?`}
|
||||
onConfirm={async () => {
|
||||
const success = await handleApiRequest(
|
||||
() => deleteTenant(record.id!),
|
||||
'正在删除',
|
||||
'删除成功'
|
||||
);
|
||||
if (success && actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Link>删除</Link>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ title: '租户管理' }}>
|
||||
<QueryFilter
|
||||
defaultCollapsed
|
||||
split
|
||||
span={6}
|
||||
className="query-filter"
|
||||
onFinish={async (values) => setParams(values)}
|
||||
>
|
||||
<ProFormText name="name" label="租户名称" placeholder="请输入租户名称" />
|
||||
<ProFormText name="code" label="租户编码" placeholder="请输入租户编码" />
|
||||
</QueryFilter>
|
||||
|
||||
<ProTable
|
||||
rowKey="id"
|
||||
headerTitle="租户列表"
|
||||
actionRef={actionRef}
|
||||
request={getTenantList}
|
||||
columns={columns}
|
||||
search={false}
|
||||
params={params}
|
||||
pagination={{
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
key="add"
|
||||
type="primary"
|
||||
onClick={() => handleCreateModalVisible(true)}
|
||||
>
|
||||
<PlusOutlined /> 新增租户
|
||||
</Button>,
|
||||
]}
|
||||
/>
|
||||
|
||||
<CreateForm
|
||||
visible={createModalVisible}
|
||||
onVisibleChange={handleCreateModalVisible}
|
||||
onSubmit={async (values) => {
|
||||
const success = await handleApiRequest(
|
||||
() => saveOrUpdateTenant(values),
|
||||
'正在添加',
|
||||
'添加成功'
|
||||
);
|
||||
if (success) {
|
||||
handleCreateModalVisible(false);
|
||||
actionRef.current?.reload();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<UpdateForm
|
||||
visible={updateModalVisible}
|
||||
onVisibleChange={handleUpdateModalVisible}
|
||||
values={currentRow}
|
||||
onSubmit={async (values) => {
|
||||
const success = await handleApiRequest(
|
||||
() => saveOrUpdateTenant({ ...currentRow, ...values }),
|
||||
'正在更新',
|
||||
'更新成功'
|
||||
);
|
||||
if (success) {
|
||||
handleUpdateModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
actionRef.current?.reload();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default TenantList;
|
||||
@@ -0,0 +1,34 @@
|
||||
import { request } from 'umi';
|
||||
|
||||
/** 获取消息列表 */
|
||||
export async function getMessages(params: any) {
|
||||
return request<API.Response<MESSAGE.Message[]>>('/api-order/messages', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
page: params.current,
|
||||
limit: params.pageSize,
|
||||
...params
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 标记消息已读 */
|
||||
export async function markAsRead(id: number) {
|
||||
return request<API.Response<any>>(`/api-order/messages/${id}/read`, {
|
||||
method: 'PUT',
|
||||
});
|
||||
}
|
||||
|
||||
/** 标记所有消息已读 */
|
||||
export async function markAllAsRead() {
|
||||
return request<API.Response<any>>('/api-order/messages/read/all', {
|
||||
method: 'PUT',
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除消息 */
|
||||
export async function deleteMessage(id: number) {
|
||||
return request<API.Response<any>>(`/api-order/messages/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
declare namespace MESSAGE {
|
||||
interface Message {
|
||||
id: number;
|
||||
title: string;
|
||||
content: string;
|
||||
type: number; // 消息类型:1-退款订单 2-新增订单 等
|
||||
status: number; // 消息状态:0-未读 1-已读
|
||||
createTime: string;
|
||||
readTime?: string;
|
||||
relatedId?: string | number; // 关联ID(如订单ID)
|
||||
extra?: any; // 额外信息
|
||||
}
|
||||
}
|
||||
@@ -248,41 +248,3 @@ export async function deleteToken(token: string) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 获取租户列表
|
||||
export async function getTenantList(params?: { [key: string]: string | number }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
const result = await request<SYSTEM.Page<SYSTEM.Tenant>>('/api-user/tenant/list', {
|
||||
method: 'GET',
|
||||
params: { page: current, limit: pageSize, ...rest },
|
||||
});
|
||||
return { data: result.data, total: result.count };
|
||||
}
|
||||
|
||||
// 获取租户详情
|
||||
export async function getTenantDetail(id: string) {
|
||||
return request<API.Result<SYSTEM.Tenant>>(`/api-user/tenant/${id}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
// 保存或更新租户
|
||||
export async function saveOrUpdateTenant(data: SYSTEM.Tenant): Promise<API.Result<SYSTEM.Tenant>> {
|
||||
return request<API.Result<SYSTEM.Tenant>>('/api-user/tenant/save', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除租户
|
||||
export async function deleteTenant(id: string) {
|
||||
return request<API.Result<void>>(`/api-user/tenant/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
// 更新租户状态
|
||||
export async function updateTenantStatus(id: string, status: number) {
|
||||
return request<API.Result<void>>(`/api-user/tenant/status/${id}/${status}`, {
|
||||
method: 'PUT',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,16 +101,4 @@ declare namespace SYSTEM {
|
||||
tenantId?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
type Tenant = {
|
||||
id?: number;
|
||||
name: string; // 租户名称
|
||||
code: string; // 租户编码
|
||||
contactPerson: string; // 联系人
|
||||
contactPhone: string; // 联系电话
|
||||
address?: string; // 地址
|
||||
status: number; // 状态:0-禁用,1-启用
|
||||
createTime?: Date; // 创建时间
|
||||
updateTime?: Date; // 更新时间
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user