mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-20 15:06:36 +00:00
feat(channel): 渠道管理系统 — 多模式定价 + 统一计费解析
新增渠道管理功能,支持三种计费模式(Token 区间/按次/图片), 统一定价解析链(Channel → LiteLLM → Fallback), 无渠道配置时保持原有计费逻辑不变。 Backend: - 新增 channels/channel_groups/channel_model_pricing/channel_pricing_intervals 表 - ChannelService: atomic.Value + singleflight 缓存,通配符模型匹配 - ModelPricingResolver: 统一定价解析器 - BillingService: CalculateCostUnified 统一计费入口 - 完整输入验证(BillingMode/价格非负/名称长度) - 33 个单元测试覆盖核心路径 Frontend: - ChannelsView.vue: 渠道 CRUD 列表页 - PricingEntryCard.vue + IntervalRow.vue: 定价编辑组件 - 支持三种计费模式切换 + 区间编辑
This commit is contained in:
1 parent
9398ea7af5
commit
a9117600a5
27 files changed
+3682
-8
No files matched your search
@@ -33,6 +33,7 @@ func ProvideAdminHandlers(
|
||||
tlsFingerprintProfileHandler *admin.TLSFingerprintProfileHandler,
|
||||
apiKeyHandler *admin.AdminAPIKeyHandler,
|
||||
scheduledTestHandler *admin.ScheduledTestHandler,
|
||||
channelHandler *admin.ChannelHandler,
|
||||
) *AdminHandlers {
|
||||
return &AdminHandlers{
|
||||
Dashboard: dashboardHandler,
|
||||
@@ -59,6 +60,7 @@ func ProvideAdminHandlers(
|
||||
TLSFingerprintProfile: tlsFingerprintProfileHandler,
|
||||
APIKey: apiKeyHandler,
|
||||
ScheduledTest: scheduledTestHandler,
|
||||
Channel: channelHandler,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +152,7 @@ var ProviderSet = wire.NewSet(
|
||||
admin.NewTLSFingerprintProfileHandler,
|
||||
admin.NewAdminAPIKeyHandler,
|
||||
admin.NewScheduledTestHandler,
|
||||
admin.NewChannelHandler,
|
||||
|
||||
// AdminHandlers and Handlers constructors
|
||||
ProvideAdminHandlers,
|
||||
|
||||
Reference in new issue
Block a user