|
|
@@ -1,6 +1,6 @@
|
|
|
// apps/box-app-api/src/feature/homepage/homepage.controller.ts
|
|
|
import { Controller, Get, Query } from '@nestjs/common';
|
|
|
-import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
|
|
+import { ApiOperation, ApiQuery, ApiResponse, ApiTags } from '@nestjs/swagger';
|
|
|
import { HomepageService } from './homepage.service';
|
|
|
import { HomeAdsDto, AnnouncementDto, CategoryDto } from './dto/homepage.dto';
|
|
|
import { RecommendedVideosDto } from '../video/dto';
|
|
|
@@ -39,13 +39,20 @@ export class HomepageController {
|
|
|
}
|
|
|
|
|
|
@Get('categorytags')
|
|
|
+ @ApiQuery({
|
|
|
+ name: 'channelId',
|
|
|
+ required: true,
|
|
|
+ description: '渠道ID',
|
|
|
+ })
|
|
|
@ApiOperation({
|
|
|
summary: '获取分类列表',
|
|
|
description:
|
|
|
- '返回 Redis 中的完整分类缓存(box:app:category:all),按 seq 升序。',
|
|
|
+ '返回 Redis 中的完整分类。',
|
|
|
})
|
|
|
- async getCategoryList(): Promise<HomeCategoryCacheItem[]> {
|
|
|
- return this.homepageService.getCategoryList();
|
|
|
+ async getCategoryList(
|
|
|
+ @Query('channelId') channelId: string,
|
|
|
+ ): Promise<any[]> {
|
|
|
+ return this.homepageService.getCategoryTags(channelId);
|
|
|
}
|
|
|
|
|
|
@Get('tags')
|
|
|
@@ -57,36 +64,4 @@ export class HomepageController {
|
|
|
async getTagList(): Promise<any> {
|
|
|
return this.homepageService.getTagList();
|
|
|
}
|
|
|
-
|
|
|
- // @Get('tags')
|
|
|
- // @ApiOperation({
|
|
|
- // summary: '获取标签列表',
|
|
|
- // description: '返回 Redis 中的完整标签缓存(box:app:tag:all)或对象数据。',
|
|
|
- // })
|
|
|
- // async getTagList(): Promise<HomeTagCacheItem[] | Record<string, unknown>> {
|
|
|
- // return this.homepageService.getTagList();
|
|
|
- // }
|
|
|
-
|
|
|
- // @Get('search/category')
|
|
|
- // @ApiOperation({
|
|
|
- // summary: '按分类名称搜索',
|
|
|
- // description: '按名称模糊匹配分类(大小写不敏感),q 为空返回空数组。',
|
|
|
- // })
|
|
|
- // async searchCategories(
|
|
|
- // @Query('q') query: string,
|
|
|
- // ): Promise<HomeCategoryCacheItem[]> {
|
|
|
- // return this.homepageService.searchByCategoryName(query);
|
|
|
- // }
|
|
|
-
|
|
|
- // @Get('search/tag')
|
|
|
- // @ApiOperation({
|
|
|
- // summary: '按标签名称搜索',
|
|
|
- // description:
|
|
|
- // '按标签名称模糊匹配分类 tags 字段(大小写不敏感),q 为空返回空数组。',
|
|
|
- // })
|
|
|
- // async searchTags(
|
|
|
- // @Query('q') query: string,
|
|
|
- // ): Promise<HomeCategoryCacheItem[]> {
|
|
|
- // return this.homepageService.searchByTagName(query);
|
|
|
- // }
|
|
|
}
|