Feature/dynamic pricing - #4117
Conversation
- 后端: 配置结构 + 中间件 + 控制器 + 路由挂载 - 后端: 登录接口维护期间拦截普通用户 - 后端: GetStatus 接口联动 maintenance 字段 - 前端: 维护设置管理页面 (SettingsMaintenance) - 前端: 用户端 MaintenanceBanner (全屏遮挡/预告 Banner) - 前端: 中英文国际化翻译 - 权限: root 始终放行, admin 可配置, 普通用户拦截
# Conflicts: # controller/misc.go # controller/user.go # electron/build.sh # router/api-router.go # router/relay-router.go # router/video-router.go # web/src/components/layout/PageLayout.jsx # web/src/components/settings/OperationSetting.jsx # web/src/i18n/locales/en.json # web/src/i18n/locales/zh-CN.json
- 新增 setting/operation_setting/time_dynamic_ratio.go(规则引擎:支持时间段/星期/分组/模型维度匹配) - 新增 controller/time_dynamic_ratio.go(管理 API:CRUD + ConfigManager 前缀格式持久化) - 新增 web/src/pages/Setting/Operation/SettingsTimeDynamicRatio.jsx(运营管理界面) - 修改 relay/helper/price.go(注入 TimeDynamicMultiplier 到计费流程) - 修改 service/text_quota.go + task_billing.go(计费公式乘以时间倍率) - 修改 service/log_info_generate.go(日志 other 字段记录 time_dynamic_multiplier) - 修改 controller/relay.go(响应头 X-New-Api-Time-Dynamic-Multiplier + 异步任务快照) - 修改前端日志渲染(日志详情/计费过程/列表摘要三处显示时间倍率) - 修改 types/price_data.go + model/task.go(数据结构扩展) - 修改 router/api-router.go(注册管理路由)
|
Caution Review failedPull request was closed or merged during review WalkthroughThis PR introduces multiple interconnected features for New-API: maintenance mode with time windows and whitelist controls, time-based dynamic pricing multipliers for temporal pricing adjustments, token configuration export functionality, and comprehensive implementation documentation. Changes span documentation files, Go backend logic (controllers, middleware, settings), TypeScript/React frontend components, and i18n localization. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
根据时间动态调整倍率
Summary by CodeRabbit
Release Notes
New Features
Documentation