Files
wwjcloud/src/common/sys/controllers/adminapi/NoticeController.ts
万物街 7a20a0c50a feat: 完成PHP到NestJS的100%功能迁移
- 迁移25个模块,包含95个控制器和160个服务
- 新增验证码管理、登录配置、云编译等模块
- 完善认证授权、会员管理、支付系统等核心功能
- 实现完整的队列系统、配置管理、监控体系
- 确保100%功能对齐和命名一致性
- 支持生产环境部署
2025-09-10 08:04:28 +08:00

83 lines
2.8 KiB
TypeScript

import { Controller, Get, Post, Put, Delete, Body, Param, Query, UseGuards } from '@nestjs/common';
import { JwtAuthGuard } from '../../../auth/guards/jwt-auth.guard';
import { RolesGuard } from '../../../auth/guards/roles.guard';
import { NoticeAdminService } from '../../services/admin/NoticeAdminService';
import { NoticeLogAdminService } from '../../services/admin/NoticeLogAdminService';
import { NoticeSmsLogAdminService } from '../../services/admin/NoticeSmsLogAdminService';
import { NoticeNameDto, AddNoticeDto, EditNoticeDto, NoticeLogNameDto, NoticeSmsLogNameDto } from '../../dto/NoticeDto';
@Controller('adminapi/notice')
@UseGuards(JwtAuthGuard, RolesGuard)
export class NoticeController {
constructor(
private readonly noticeAdminService: NoticeAdminService,
private readonly noticeLogAdminService: NoticeLogAdminService,
private readonly noticeSmsLogAdminService: NoticeSmsLogAdminService,
) {}
// 通知配置管理
@Get('lists')
async getNoticeLists(@Query() query: NoticeNameDto) {
return await this.noticeAdminService.getNoticeLists(query);
}
@Get('info/:id')
async getNoticeInfo(@Param('id') id: number) {
return await this.noticeAdminService.getNoticeInfo(id);
}
@Post('add')
async addNotice(@Body() data: AddNoticeDto) {
return await this.noticeAdminService.addNotice(data);
}
@Put('edit/:id')
async editNotice(@Param('id') id: number, @Body() data: EditNoticeDto) {
return await this.noticeAdminService.editNotice(id, data);
}
@Delete('delete/:id')
async deleteNotice(@Param('id') id: number) {
return await this.noticeAdminService.deleteNotice(id);
}
// 通知日志管理
@Get('log/lists')
async getNoticeLogLists(@Query() query: NoticeLogNameDto) {
return await this.noticeLogAdminService.getNoticeLogLists(query);
}
@Get('log/info/:id')
async getNoticeLogInfo(@Param('id') id: number) {
return await this.noticeLogAdminService.getNoticeLogInfo(id);
}
@Delete('log/delete/:id')
async deleteNoticeLog(@Param('id') id: number) {
return await this.noticeLogAdminService.deleteNoticeLog(id);
}
// 短信日志管理
@Get('sms/log/lists')
async getNoticeSmsLogLists(@Query() query: NoticeSmsLogNameDto) {
return await this.noticeSmsLogAdminService.getNoticeSmsLogLists(query);
}
@Get('sms/log/info/:id')
async getNoticeSmsLogInfo(@Param('id') id: number) {
return await this.noticeSmsLogAdminService.getNoticeSmsLogInfo(id);
}
@Delete('sms/log/delete/:id')
async deleteNoticeSmsLog(@Param('id') id: number) {
return await this.noticeSmsLogAdminService.deleteNoticeSmsLog(id);
}
@Put('sms/log/status/:id')
async updateSmsLogStatus(
@Param('id') id: number,
@Body() data: { status: string; result?: string }
) {
return await this.noticeSmsLogAdminService.updateSendStatus(id, data.status, data.result);
}
}