feat: 添加汇率服务和缓存服务,优化数据源和日志服务

refactor: 重构数据源工厂和类型定义,提升代码可维护性

fix: 修复类型转换和状态机文档中的错误

docs: 更新服务架构文档,添加新的服务闭环流程

test: 添加汇率服务单元测试

chore: 清理无用代码和注释,优化代码结构
This commit is contained in:
2026-03-19 14:19:01 +08:00
parent 0dac26d781
commit aa2cf560c6
120 changed files with 33383 additions and 4347 deletions

View File

@@ -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]);