feat(core): 完成 Phase 2 核心功能开发

- 实现查询API (query.py): 支持star_id/unique_id/nickname三种查询方式
- 实现计算模块 (calculator.py): CPM/自然搜索UV/搜索成本计算
- 实现品牌API集成 (brand_api.py): 批量并发调用,10并发限制
- 实现导出服务 (export_service.py): Excel/CSV导出
- 前端组件: QueryForm/ResultTable/ExportButton
- 主页面集成: 支持6种页面状态
- 测试: 44个测试全部通过,覆盖率88%

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
zfc
2026-01-28 14:38:38 +08:00
co-authored by Claude Opus 4.5
parent ac0f086821
commit 8fbcb72a3f
21 changed files with 1677 additions and 100 deletions
+63
View File
@@ -0,0 +1,63 @@
// 查询类型
export type QueryType = 'star_id' | 'unique_id' | 'nickname';
// 查询请求
export interface QueryRequest {
type: QueryType;
values: string[];
}
// 视频数据
export interface VideoData {
item_id: string;
title: string | null;
viral_type: string | null;
video_url: string | null;
star_id: string;
star_unique_id: string;
star_nickname: string;
publish_time: string | null;
natural_play_cnt: number;
heated_play_cnt: number;
total_play_cnt: number;
total_interact: number;
like_cnt: number;
share_cnt: number;
comment_cnt: number;
new_a3_rate: number | null;
after_view_search_uv: number;
return_search_cnt: number;
industry_id: string | null;
industry_name: string | null;
brand_id: string | null;
brand_name: string | null;
estimated_video_cost: number;
estimated_natural_cpm: number | null;
estimated_natural_search_uv: number | null;
estimated_natural_search_cost: number | null;
}
// 查询响应
export interface QueryResponse {
success: boolean;
data: VideoData[];
total: number;
error?: string;
}
// 页面状态
export type PageState = 'default' | 'input' | 'loading' | 'result' | 'empty' | 'error';
// 查询方式选项
export const QUERY_TYPE_OPTIONS = [
{ value: 'star_id' as QueryType, label: '星图ID' },
{ value: 'unique_id' as QueryType, label: '达人unique_id' },
{ value: 'nickname' as QueryType, label: '达人昵称' },
];
// 查询方式对应的提示文本
export const QUERY_PLACEHOLDER: Record<QueryType, string> = {
star_id: '请输入星图ID,每行一个...',
unique_id: '请输入达人unique_id,每行一个...',
nickname: '请输入达人昵称关键词...',
};