feat: 添加汇率服务和缓存服务,优化数据源和日志服务
refactor: 重构数据源工厂和类型定义,提升代码可维护性 fix: 修复类型转换和状态机文档中的错误 docs: 更新服务架构文档,添加新的服务闭环流程 test: 添加汇率服务单元测试 chore: 清理无用代码和注释,优化代码结构
This commit is contained in:
@@ -23,6 +23,9 @@ import {
|
||||
SafetyCertificateOutlined,
|
||||
GlobalOutlined,
|
||||
TrophyOutlined,
|
||||
RobotOutlined,
|
||||
SwapOutlined,
|
||||
ThunderboltOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { Link, useLocation, history, Outlet } from 'umi';
|
||||
|
||||
@@ -31,95 +34,149 @@ const { Title, Text } = Typography;
|
||||
|
||||
// 菜单项配置
|
||||
const menuItems = [
|
||||
// 首页
|
||||
{
|
||||
key: '/',
|
||||
icon: <DashboardOutlined />,
|
||||
label: <Link to="/">首页</Link>,
|
||||
},
|
||||
// 核心业务
|
||||
{
|
||||
key: '/Product',
|
||||
key: 'core',
|
||||
icon: <ShoppingOutlined />,
|
||||
label: <Link to="/Product">商品管理</Link>,
|
||||
label: '核心业务',
|
||||
children: [
|
||||
{
|
||||
key: '/Product',
|
||||
label: <Link to="/Product">商品管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Orders',
|
||||
label: <Link to="/Orders">订单管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Logistics',
|
||||
label: <Link to="/Logistics">物流管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/AfterSales',
|
||||
label: <Link to="/AfterSales">售后服务</Link>,
|
||||
},
|
||||
],
|
||||
},
|
||||
// 商户与贸易
|
||||
{
|
||||
key: '/Orders',
|
||||
icon: <FileTextOutlined />,
|
||||
label: <Link to="/Orders">订单管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Merchant',
|
||||
key: 'merchant',
|
||||
icon: <ShopOutlined />,
|
||||
label: <Link to="/Merchant">商户管理</Link>,
|
||||
label: '商户与贸易',
|
||||
children: [
|
||||
{
|
||||
key: '/Merchant',
|
||||
label: <Link to="/Merchant">商户管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/B2B',
|
||||
label: <Link to="/B2B">B2B贸易</Link>,
|
||||
},
|
||||
],
|
||||
},
|
||||
// 营销与增长
|
||||
{
|
||||
key: '/TaskCenter',
|
||||
icon: <ScheduleOutlined />,
|
||||
label: <Link to="/TaskCenter">任务中心</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Logistics',
|
||||
icon: <TruckOutlined />,
|
||||
label: <Link to="/Logistics">物流管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/AfterSales',
|
||||
icon: <AlertOutlined />,
|
||||
label: <Link to="/AfterSales">售后服务</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Compliance',
|
||||
icon: <SafetyCertificateOutlined />,
|
||||
label: <Link to="/Compliance">合规管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Blacklist',
|
||||
icon: <AuditOutlined />,
|
||||
label: <Link to="/Blacklist">黑名单管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/B2B',
|
||||
icon: <DollarOutlined />,
|
||||
label: <Link to="/B2B">B2B贸易</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Ad',
|
||||
key: 'marketing',
|
||||
icon: <BarChartOutlined />,
|
||||
label: <Link to="/Ad">广告管理</Link>,
|
||||
label: '营销与增长',
|
||||
children: [
|
||||
{
|
||||
key: '/Ad',
|
||||
label: <Link to="/Ad">广告管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/DynamicPricing',
|
||||
label: <Link to="/DynamicPricing">动态定价</Link>,
|
||||
},
|
||||
{
|
||||
key: '/StrategyMarketplace',
|
||||
label: <Link to="/StrategyMarketplace">策略市场</Link>,
|
||||
},
|
||||
],
|
||||
},
|
||||
// 数据分析
|
||||
{
|
||||
key: '/Analytics',
|
||||
key: 'analytics',
|
||||
icon: <GlobalOutlined />,
|
||||
label: <Link to="/Analytics">数据分析</Link>,
|
||||
label: '数据分析',
|
||||
children: [
|
||||
{
|
||||
key: '/Analytics',
|
||||
label: <Link to="/Analytics">数据分析</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Leaderboard',
|
||||
label: <Link to="/Leaderboard">收益排行榜</Link>,
|
||||
},
|
||||
{
|
||||
key: '/ArbitrageMonitor',
|
||||
label: <Link to="/ArbitrageMonitor">套利监控</Link>,
|
||||
},
|
||||
],
|
||||
},
|
||||
// 智能运营
|
||||
{
|
||||
key: '/Leaderboard',
|
||||
icon: <TrophyOutlined />,
|
||||
label: <Link to="/Leaderboard">收益排行榜</Link>,
|
||||
key: 'ai',
|
||||
icon: <RobotOutlined />,
|
||||
label: '智能运营',
|
||||
children: [
|
||||
{
|
||||
key: '/AutoPilot',
|
||||
label: <Link to="/AutoPilot">AI托管</Link>,
|
||||
},
|
||||
{
|
||||
key: '/TaskCenter',
|
||||
label: <Link to="/TaskCenter">任务中心</Link>,
|
||||
},
|
||||
],
|
||||
},
|
||||
// 合规与安全
|
||||
{
|
||||
key: '/StrategyMarketplace',
|
||||
icon: <ShopOutlined />,
|
||||
label: <Link to="/StrategyMarketplace">策略市场</Link>,
|
||||
key: 'compliance',
|
||||
icon: <SafetyCertificateOutlined />,
|
||||
label: '合规与安全',
|
||||
children: [
|
||||
{
|
||||
key: '/Compliance',
|
||||
label: <Link to="/Compliance">合规管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Blacklist',
|
||||
label: <Link to="/Blacklist">黑名单管理</Link>,
|
||||
},
|
||||
],
|
||||
},
|
||||
// 财务管理
|
||||
{
|
||||
key: '/Finance',
|
||||
icon: <WalletOutlined />,
|
||||
label: <Link to="/Finance">财务管理</Link>,
|
||||
},
|
||||
// 系统管理
|
||||
{
|
||||
key: '/User',
|
||||
icon: <UserOutlined />,
|
||||
label: <Link to="/User">用户管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Role',
|
||||
icon: <TeamOutlined />,
|
||||
label: <Link to="/Role">角色管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Settings',
|
||||
key: 'system',
|
||||
icon: <SettingOutlined />,
|
||||
label: <Link to="/Settings">系统设置</Link>,
|
||||
label: '系统管理',
|
||||
children: [
|
||||
{
|
||||
key: '/User',
|
||||
label: <Link to="/User">用户管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Role',
|
||||
label: <Link to="/Role">角色管理</Link>,
|
||||
},
|
||||
{
|
||||
key: '/Settings',
|
||||
label: <Link to="/Settings">系统设置</Link>,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -151,14 +208,48 @@ const MainLayout: React.FC = () => {
|
||||
useEffect(() => {
|
||||
const pathname = location.pathname;
|
||||
// 找到匹配的菜单项
|
||||
const matchedItem = menuItems.find(item => {
|
||||
if (item.key === '/') {
|
||||
return pathname === '/';
|
||||
let matchedKey: string | undefined;
|
||||
|
||||
// 递归查找匹配的菜单项
|
||||
const findMatchedItem = (items: any[]) => {
|
||||
for (const item of items) {
|
||||
if (item.children) {
|
||||
// 检查子菜单项
|
||||
for (const child of item.children) {
|
||||
if (child.key === '/') {
|
||||
if (pathname === '/') {
|
||||
matchedKey = child.key;
|
||||
return true;
|
||||
}
|
||||
} else if (pathname.startsWith(child.key as string)) {
|
||||
matchedKey = child.key;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 递归检查子菜单
|
||||
if (findMatchedItem(item.children)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// 检查当前菜单项
|
||||
if (item.key === '/') {
|
||||
if (pathname === '/') {
|
||||
matchedKey = item.key;
|
||||
return true;
|
||||
}
|
||||
} else if (pathname.startsWith(item.key as string)) {
|
||||
matchedKey = item.key;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pathname.startsWith(item.key as string);
|
||||
});
|
||||
if (matchedItem) {
|
||||
setSelectedKeys([matchedItem.key as string]);
|
||||
return false;
|
||||
};
|
||||
|
||||
findMatchedItem(menuItems);
|
||||
|
||||
if (matchedKey) {
|
||||
setSelectedKeys([matchedKey]);
|
||||
}
|
||||
}, [location.pathname]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user