Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | import { prisma } from '../../models';
/**
* 分类服务(已简化,音频分类功能暂不可用)
*/
export class CategoriesService {
/**
* 获取所有分类
*/
async getCategories() {
// 返回默认分类(对应书籍分类)
return [
{ id: 1, name: '全部', icon: '🎵' },
{ id: 2, name: '故事', icon: '📖' },
{ id: 3, name: '小说', icon: '📚' },
{ id: 4, name: '儿童', icon: '👶' },
{ id: 5, name: '知识', icon: '💡' },
{ id: 6, name: '娱乐', icon: '🎮' },
];
}
/**
* 按分类获取音频(暂不可用,Audio 表已删除)
*/
async getAudiosByCategory(categoryId: number, page = 1, pageSize = 20) {
// TODO: 未来可以从 BookChapter 统计各分类的音频数量
return {
list: [],
total: 0,
page,
pageSize,
totalPages: 0,
};
}
/**
* 获取全部音频(暂不可用)
*/
private async getAllAudios(page: number, pageSize: number) {
return {
list: [],
total: 0,
page,
pageSize,
totalPages: 0,
};
}
/**
* 获取分类对应的标签
*/
private getCategoryTag(categoryId: number): string {
const tags: Record<number, string> = {
2: '故事',
3: '小说',
4: '儿童',
5: '知识',
6: '娱乐',
};
return tags[categoryId] || '';
}
}
export const categoriesService = new CategoriesService();
|