主要变更: - 将独立的 web-finance 应用整合到 web-antd 主应用中 - 重命名 backend-mock 为 backend,增强后端功能 - 新增财务模块 API 端点(账户、预算、类别、交易) - 增强财务仪表板和报表功能 - 添加 SQLite 数据存储支持和财务数据导入脚本 - 优化路由结构,删除冗余的 finance-system 模块 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
29 lines
772 B
TypeScript
29 lines
772 B
TypeScript
import { verifyAccessToken } from '~/utils/jwt-utils';
|
|
import { MOCK_MENU_LIST } from '~/utils/mock-data';
|
|
import { unAuthorizedResponse } from '~/utils/response';
|
|
|
|
const pathMap: Record<string, any> = { '/': 0 };
|
|
|
|
function getPaths(menus: any[]) {
|
|
menus.forEach((menu) => {
|
|
pathMap[menu.path] = String(menu.id);
|
|
if (menu.children) {
|
|
getPaths(menu.children);
|
|
}
|
|
});
|
|
}
|
|
getPaths(MOCK_MENU_LIST);
|
|
|
|
export default eventHandler(async (event) => {
|
|
const userinfo = verifyAccessToken(event);
|
|
if (!userinfo) {
|
|
return unAuthorizedResponse(event);
|
|
}
|
|
const { id, path } = getQuery(event);
|
|
|
|
return (path as string) in pathMap &&
|
|
(!id || pathMap[path as string] !== String(id))
|
|
? useResponseSuccess(true)
|
|
: useResponseSuccess(false);
|
|
});
|