Browse Source

feat: fix

gemercheung 6 months ago
parent
commit
0a46dd6c42

+ 1 - 1
packages/backend/src/modules/article/article.service.ts

@@ -18,7 +18,7 @@ export class ArticleService {
 
     @InjectRepository(ArticleTranslation)
     private articleTranslationRepo: Repository<ArticleTranslation>,
-  ) { }
+  ) {}
   async create(createArticleDto: CreateArticleDto) {
     const article = this.articleRepo.create(createArticleDto);
     return this.articleRepo.save(article);

+ 1 - 2
packages/backend/src/modules/article/dto.ts

@@ -104,5 +104,4 @@ export class GetArticleDto {
 
 export class QueryArticleDto extends GetArticleDto {}
 
-export class UpdateArticleDto extends CreateArticleDto {
-}
+export class UpdateArticleDto extends CreateArticleDto {}

+ 1 - 1
packages/backend/src/modules/web/web.controller.ts

@@ -5,7 +5,7 @@ import { ApiTags } from '@nestjs/swagger';
 @ApiTags('website(展示端)')
 @Controller('web')
 export class WebController {
-  constructor(private readonly webService: WebService) { }
+  constructor(private readonly webService: WebService) {}
 
   @Get('menu')
   getMenus(@Headers('locale') locale?: string) {

+ 5 - 5
packages/backend/src/modules/web/web.service.ts

@@ -94,16 +94,16 @@ export class WebService {
     // 递归查找顶层父分类
     while (currentCategory.parent) {
       currentCategory = await this.categoryRepo.findOne({
-        where: { id: currentCategory.parent.id },
+        where: { id: currentCategory.parent.id, enable: true },
         relations: { parent: true },
       });
     }
     console.log('currentCategory', currentCategory);
     return currentCategory.id
       ? this.categoryRepo.findOne({
-        where: { id: currentCategory.id, enable: true },
-        relations: { children: true },
-      })
+          where: { id: currentCategory.id, enable: true },
+          relations: { children: true },
+        })
       : null;
   }
 
@@ -162,7 +162,7 @@ export class WebService {
 
     // 保留
     const category = await this.categoryRepo.findOne({
-      where: { id: id },
+      where: { id: id, enable: true },
       relations: { children: true },
     });
     const ids = await this.findCateAllChildIds(category.id);