feat(notify): 新增站内消息通知中心(订阅消息兜底)+ 清理后台伪造数据

- 新表 user_notifications + 仓储方法(创建/列表/未读数/标记已读)
- 用户接口 GET /api/notifications、POST /api/notifications/read(生产需登录)
- 关键节点落库:订单开始服务/接单/拒单/申请完成/完成结算/提现到账/报名成功/退款受理
- 小程序新增「消息通知」页(pages/user/notifications) + 个人中心入口与未读角标;api.js 增加 getNotifications/markNotificationsRead
- 清理后台伪造数据:/api/user/certification 改空态、/api/user/my-project/list 改空数组、/api/user/info 去掉编造邮箱/电话/网址
- 更新 pages 数量断言(26→27);新增回归护栏 notification-center.spec.ts(92 套件/658 用例全绿);冒烟 9/9
这个提交包含在:
xcbyy
2026-10-19 14:31:11 +08:00
父节点 12bbf4fc6b
当前提交 ca7f849b14
共有 10 个文件被更改,包括 598 次插入 和 43 次删除

查看文件

@@ -1212,6 +1212,30 @@ export async function getSubscribeTemplates() {
}
}
/**
* 获取站内消息通知列表与未读数
*/
export async function getNotifications(userId, limit = 50) {
const uid = normalizeUserId(userId);
try {
const res = await http.get(`/notifications?userId=${uid}&limit=${Number(limit) || 50}`);
return res || { list: [], unread: 0 };
} catch (err) {
throw err;
}
}
/**
* 标记站内消息为已读(不传 ids 表示全部已读)
*/
export async function markNotificationsRead(userId, ids) {
const uid = normalizeUserId(userId);
const payload = { userId: uid };
if (Array.isArray(ids) && ids.length > 0) payload.ids = ids;
const res = await http.post('/notifications/read', payload);
return res;
}
/**
* 保存用户隐私与通知订阅设置 (同步落盘服务端与本地存储)
*/