docs: 更新 CLAUDE.md 添加本次会话的学习点

- 前后端数据结构一致性要求
- 云图 API 和品牌 API 参数格式
- 前端常见问题解决方案

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
zfc 2026-01-28 22:08:11 +08:00
parent 3ae63ff27a
commit 137e6dd23c

View File

@ -485,3 +485,27 @@ export async function queryVideos(request: QueryRequest): Promise<QueryResponse>
\d kol_videos
-- 应该看到 idx_star_id, idx_star_unique_id, idx_star_nickname
```
## 前后端数据结构一致性
**重要**:后端返回的 JSON 字段名必须与前端 TypeScript 类型定义完全匹配。
- 前端类型定义位置:`frontend/src/types/index.ts`
- 修改后端响应结构时,务必同步检查前端类型定义
- 常见错误:`Cannot read properties of undefined` 通常是字段名不匹配
## 外部 API 参数格式
### 云图 API (GetContentMaterialAnalysisInfo)
- 日期格式:`YYYYMMDD`(不是 `YYYY-MM-DD`
- industry_id数组格式 `["20"]`(不是字符串)
- Cookie直接使用 `sessionid=xxx` 格式
### 品牌 API
- URL 格式:`/v1/yuntu/brands?brand_id=xxx`(查询参数,非路径参数)
- 认证:`Authorization: Bearer {token}`
## 前端常见问题
- **Next.js 模块错误**:清理缓存 `rm -rf .next node_modules/.cache && pnpm build`
- **Ant Design Modal 文字无法复制**:添加 `styles={{ body: { userSelect: 'text' } }}`
- **CORS 400 错误**:检查后端 `CORSMiddleware` 配置的 `allow_origins`