feat(admin): 方案A—消息铃铛接真实待办聚合 + 清理空壳接口与空卡片

【消息铃铛(真实数据)】
- POST /api/message/list 改为待办聚合:待接单订单/待审核大神/待审核提现/待处理举报/待仲裁工单(复用 getDashboardTodos + 新增 pendingOrdersCount)
- POST /api/message/read 持久化已读:新表 admin_message_reads 记录"已读时的数量",待办数量增加会重新变未读
- 两个接口均加 requireAdmin(待办数量属运营数据,不再匿名可见)

【删除空壳/死接口(前端已无调用方)】
- /api/user/save-info、/api/chat/list、/api/user/my-team/list、/api/user/latest-activity、/api/user/my-project/list

【后台页面清理】
- 「用户与个人中心 → 管理员资料」移除 我的项目/最近动态/我的团队/站内通知 四张空卡(保留真实的管理员资料头部)
- 删除对应 4 个组件;api/user-center.ts 移除 queryMyProjectList/queryMyTeamList/queryLatestActivity/saveUserInfo;api/message.ts 移除 queryChatList

【验证】
- 新增 admin-todo-bell.spec.ts;更新 admin-demo-data-cleanup.spec.ts
- 全量 101 套件 / 690 用例全绿;冒烟 8/8(未登录50008、待办数量、已读、新增后重新未读)
- 后台 pnpm build 通过
这个提交包含在:
xcbyy
2026-10-20 15:52:04 +08:00
父节点 05815b4708
当前提交 f3ea26d161
共有 16 个文件被更改,包括 250 次插入 和 455 次删除

查看文件

@@ -18,16 +18,21 @@ describe('第六十五批后台演示数据清理闸门', () => {
expect(indexCode).not.toContain('MySQL 数据库就绪');
});
it('相关接口返回空数组(由前端展示空态)', () => {
it('相关空壳接口已移除(后台不再展示演示卡片)', () => {
for (const marker of [
"app.all('/api/user/my-team/list'",
"app.all('/api/user/latest-activity'",
"app.all('/api/message/list'",
"app.all('/api/user/my-project/list'",
"app.all('/api/user/save-info'",
"app.all('/api/chat/list'",
]) {
const start = indexCode.indexOf(marker);
expect(start).toBeGreaterThan(-1);
const block = indexCode.slice(start, start + 220);
expect(block).toContain('data: []');
expect(indexCode).not.toContain(marker);
}
});
it('消息中心改为真实待办聚合', () => {
expect(indexCode).toContain("app.post('/api/message/list'");
expect(indexCode).toContain('buildAdminTodoItems');
expect(indexCode).toContain('pending_orders');
});
});

查看文件

@@ -0,0 +1,54 @@
// 已读取AGENTS.md
import * as fs from 'fs';
import * as path from 'path';
/**
* 第八十五批:后台消息铃铛接真实待办聚合 + 清理空壳接口与空卡片。
*/
describe('第八十五批后台待办消息闸门', () => {
const root = path.resolve(__dirname, '../../');
const read = (p: string) => fs.readFileSync(path.join(root, p), 'utf-8');
const exists = (p: string) => fs.existsSync(path.join(root, p));
const indexCode = read('server/src/index.ts');
const repoCode = read('server/src/db/repository.ts');
const mysqlCode = read('server/src/db/mysql.ts');
const admin = 'admin/arco-design-pro-vite/src';
it('空壳接口已删除(无调用方)', () => {
for (const m of [
"app.all('/api/user/save-info'",
"app.all('/api/chat/list'",
"app.all('/api/user/my-team/list'",
"app.all('/api/user/latest-activity'",
"app.all('/api/user/my-project/list'",
]) {
expect(indexCode).not.toContain(m);
}
});
it('消息铃铛改为真实待办聚合,且需管理员鉴权', () => {
expect(indexCode).toContain("app.post('/api/message/list', requireAdmin");
expect(indexCode).toContain("app.post('/api/message/read', requireAdmin");
expect(indexCode).toContain('buildAdminTodoItems');
for (const k of ['pending_orders', 'pending_audits', 'pending_withdrawals', 'pending_reports', 'pending_arbitrations']) {
expect(indexCode).toContain(k);
}
});
it('待办已读状态持久化(数量增加会重新变未读)', () => {
expect(mysqlCode).toContain('admin_message_reads');
expect(repoCode).toContain('async getAdminTodoReadCounts(');
expect(repoCode).toContain('async markAdminTodosRead(');
expect(repoCode).toContain('pendingOrdersCount');
});
it('后台移除空卡片与死函数', () => {
for (const f of ['my-team.vue', 'latest-activity.vue', 'my-project.vue', 'latest-notification.vue']) {
expect(exists(`${admin}/views/user/info/components/${f}`)).toBe(false);
}
expect(read(`${admin}/api/user-center.ts`)).not.toContain('queryMyTeamList');
expect(read(`${admin}/api/user-center.ts`)).not.toContain('queryLatestActivity');
expect(read(`${admin}/api/message.ts`)).not.toContain('queryChatList');
expect(read(`${admin}/views/user/info/index.vue`)).toContain('UserInfoHeader');
});
});