feat: 新增可配置通知中心,支持扫描式/埋点式通知规则与手动群发

新增通知规则实体、扫描任务、API与管理界面,重构站内通知支持用户/电工双类型,移除硬编码的证照到期提醒,新增工单派单、电工审核结果等通知触发场景,调整菜单与数据库结构适配新通知体系。
This commit is contained in:
andyesfly committed 2026-10-06 11:53:02 +08:00
1 parent 91aa3c06f0
commit 6cf6a3d5b9
36 files changed
+3309 -246

No files matched your search

+22 -3
View File
@@ -1,6 +1,7 @@
import { Controller, Get, Post, Put, Del, Inject, Body, Param, Query } from "@midwayjs/core";
import { Context } from "@midwayjs/koa";
import { WorkerAppService } from "../service/worker_app.service";
import { NoticeService } from "../service/notice.service";
import {
WorkerRegisterDTO,
WorkerLoginDTO,
@@ -16,6 +17,9 @@ export class WorkerAppController {
@Inject()
workerAppService!: WorkerAppService;
@Inject()
noticeService!: NoticeService;
// 注册(匿名)
@Post("/auth/register")
async register(@Body() body: WorkerRegisterDTO) {
@@ -66,10 +70,25 @@ export class WorkerAppController {
return this.workerAppService.resubmit(this.currentWorkerId());
}
// 证照到期提醒
// 站内消息中心:静态路径必须声明在动态路径 /notices/:id/read 之前
@Get("/notices")
async listNotices() {
return this.workerAppService.listNotices(this.currentWorkerId());
async listNotices(@Query() query: any) {
return this.noticeService.listMy("worker", this.currentWorkerId(), query);
}
@Get("/notices/unread-count")
async noticeUnreadCount() {
return this.noticeService.unreadCount("worker", this.currentWorkerId());
}
@Put("/notices/read-all")
async markAllNoticesRead() {
return this.noticeService.markAllRead("worker", this.currentWorkerId());
}
@Put("/notices/:id/read")
async markNoticeRead(@Param("id") id: string) {
return this.noticeService.markRead("worker", this.currentWorkerId(), Number(id));
}
// 订单池:静态路径必须声明在动态路径 /orders/:source/:id 之前