feat: 新增电工APP端与定时任务管理功能
- 新增电工APP独立鉴权中间件与登录注册接口 - 新增定时任务管理模块,支持任务配置、执行日志与手动触发 - 新增运维费定价与电工派单成本价目管理 - 新增电工资质证照管理与到期提醒定时任务 - 完善数据库实体与DTO校验,优化权限控制
This commit is contained in:
1 parent
1803ad679c
commit
f4454ad014
57 files changed
+9388
-200
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { Controller, Get, Put, Inject, Query, Param } from "@midwayjs/core";
|
||||
import { Context } from "@midwayjs/koa";
|
||||
import { NoticeService } from "../service/notice.service";
|
||||
|
||||
@Controller("/api/notices")
|
||||
export class NoticeController {
|
||||
@Inject()
|
||||
ctx!: Context;
|
||||
|
||||
@Inject()
|
||||
noticeService!: NoticeService;
|
||||
|
||||
@Get("/")
|
||||
async list(@Query() query: any) {
|
||||
return await this.noticeService.listMy(this.currentUserId(), query);
|
||||
}
|
||||
|
||||
// 注意:静态路径必须注册在动态路径 /:id/read 之前
|
||||
@Get("/unread-count")
|
||||
async unreadCount() {
|
||||
return await this.noticeService.unreadCount(this.currentUserId());
|
||||
}
|
||||
|
||||
@Put("/read-all")
|
||||
async markAllRead() {
|
||||
return await this.noticeService.markAllRead(this.currentUserId());
|
||||
}
|
||||
|
||||
@Put("/:id/read")
|
||||
async markRead(@Param("id") id: string) {
|
||||
return await this.noticeService.markRead(this.currentUserId(), Number(id));
|
||||
}
|
||||
|
||||
private currentUserId(): number {
|
||||
return Number(this.ctx.state.user?.userId);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user