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); } }