feat(subscription): 新增总额度订阅类型支持#1904
Open
MoRan23 wants to merge 41 commits into
Open
Conversation
# Conflicts: # backend/internal/service/openai_images.go # frontend/src/views/admin/GroupsView.vue
# Conflicts: # backend/ent/client.go # backend/ent/ent.go # backend/ent/mutation.go
# Conflicts: # backend/ent/group.go # backend/ent/migrate/schema.go # backend/ent/mutation.go # backend/ent/runtime/runtime.go # backend/internal/handler/admin/group_handler.go # backend/internal/handler/dto/mappers.go # backend/internal/repository/api_key_repo.go # backend/internal/repository/group_repo.go # backend/internal/service/admin_service.go # frontend/src/types/index.ts # frontend/src/views/admin/GroupsView.vue
# Conflicts: # backend/ent/client.go
# Conflicts: # backend/internal/repository/user_subscription_repo.go
# Conflicts: # backend/ent/group.go # backend/ent/migrate/schema.go # backend/ent/runtime/runtime.go # backend/internal/handler/admin/group_handler.go # backend/internal/service/admin_service.go # backend/internal/service/subscription_expiry_service_test.go # backend/internal/service/subscription_service.go # frontend/src/views/admin/GroupsView.vue
# Conflicts: # backend/ent/client.go # backend/ent/group.go # backend/ent/migrate/schema.go # backend/ent/mutation.go # backend/ent/runtime/runtime.go # backend/internal/service/admin_service.go # backend/internal/service/gateway_service.go # backend/internal/service/setting_service.go # frontend/src/i18n/locales/en.ts # frontend/src/i18n/locales/zh.ts # frontend/src/views/admin/GroupsView.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
本 PR 主要新增了 总额度订阅类型(
total_quota) 的支持,覆盖了数据库结构、订阅分配、额度消费、请求校验、事件清理以及前端展示链路。和现有按日 / 周 / 月窗口累计的订阅模式不同,
total_quota通过 quota event 记录和管理一笔或多笔可累计的总额度,并在请求生命周期中按事件顺序消费额度。目的
为 Sub2API 添加在指定订阅时间内,可用的总额度类型的订阅支持,如24h内总额100$,将不随窗口刷新。
本次改动
新增
total_quota订阅类型total_quotatotal_limit_usd新增总额度事件模型
user_subscription_quota_events表支持总额度订阅的创建与追加
接入总额度消费链路
完善 quota event 生命周期管理
修复 total quota 相关边界问题
补充前端支持
total_quotatotal_quota分组展示行为
创建
分配
计费
ui
测试
已执行:
且在自建中转已稳定运行一段时间