diff --git a/src/modules/comment/comment.service.ts b/src/modules/comment/comment.service.ts index 6a4c4de39..3d8d6680b 100644 --- a/src/modules/comment/comment.service.ts +++ b/src/modules/comment/comment.service.ts @@ -179,7 +179,7 @@ export class CommentService { { page, // 当前页 limit: size, // 每页显示条数 - select: isMaster ? "+ip +agent -children" : "", + select: "+ip +agent -children", // 查询字段 sort: { created: -1 }, // 排序 populate: [ // 关联查询 diff --git a/src/modules/post/post.controller.ts b/src/modules/post/post.controller.ts index caaeabf87..fbc542a25 100644 --- a/src/modules/post/post.controller.ts +++ b/src/modules/post/post.controller.ts @@ -174,7 +174,7 @@ export class PostController { async getByCategoryAndSlug( @Param() params: CategoryAndSlugDto, @IsMaster() isMaster: boolean, - @Cookies("password") password: any + @Query("password") password: any ) { const { category, slug } = params; const categoryDocument = await this.postService.getCategoryBySlug(category); @@ -199,7 +199,12 @@ export class PostController { // 将text, summary改为"内容已被隐藏" postDocument.text = "内容已被隐藏,请输入密码"; postDocument.summary = "内容已被隐藏,请输入密码"; + + } else { + postDocument.password = null; } + } else { + postDocument.password = null; } return postDocument; })