feat(api): API优化开发 - 缓存、错误处理、日志、性能测试
## 优化内容
### 1. 统一错误处理 (app/core/errors.py)
- 定义统一错误码 (E1xxx-E5xxx)
- 统一错误响应格式
- 自定义异常类 (APIException, NotFoundError, AlreadyExistsError等)
- HTTP异常处理器
### 2. API日志记录 (app/core/logging_middleware.py)
- 请求日志: trace_id, method, path, params, client_ip
- 响应日志: status_code, response_time_ms, size
- 慢请求检测 (threshold: 200ms)
- 敏感数据脱敏 (password, token等)
### 3. 缓存支持 (app/core/cache.py)
- Redis缓存客户端 (降级到本地缓存)
- 缓存装饰器 @cached, @cache_invalidate
- 产品列表/详情缓存 (5-10分钟)
- 统计数据缓存 (1分钟)
### 4. 性能测试脚本 (scripts/performance_test.py)
- 并发测试支持
- 统计指标: avg, p50, p95, p99
- 性能报告生成 (JSON)
- 优化建议生成
### 5. Products API优化 (app/api/products.py)
- 列表/详情端点添加缓存
- 统一错误处理集成
- 缓存失效机制
## 测试结果
- 55 passed, 19 skipped, 0 failed
- 所有核心API测试通过
## 性能目标
- API响应时间 < 200ms ✅
- 统一错误处理机制 ✅
- API日志记录实现 ✅
- 性能测试脚本 ✅