import { Controller , Get , Post , Body , Query , Next , Headers , UseGuards , ParseIntPipe , } from '@nestjs/common' ; import { CommentService } from '../service/comment.service' ; import { UserError } from '../../../common/filters/userError' ; @ Controller ( 'message/visitor' ) export class VisitorController { constructor ( private readonly commentService ) { } @ Get ( 'list' ) getList ( @ Query ( 'page' , new ParseIntPipe ( ) ) page , @ Query ( 'size' , new ParseIntPipe ( ) ) size , @ Query ( 'comment_id' , new ParseIntPipe ( ) ) commentId ) { return this . commentService . getList ( page , size , commentId ) ; } @ Get ( 'info' ) getComment ( @ Query ( 'article_id' ) articleId ? , @ Query ( 'blogger_id' ) bloggerId ? ) { if ( ! articleId && ! bloggerId ) { throw new UserError ( '参数错误' ) ; } return this . commentService . getComment ( articleId , bloggerId ) ; } }