fengsilin
d8272e7707
feat(channel): 添加渠道"对外名称"(public_name)字段
为 Channel 模型新增 public_name 字段,让管理员可以为每个渠道
设置用户可见的友好名称(如"标准通道"、"高速通道"),替代前端
硬编码的"通道一/二/三"。Playground 通道选择器展示对外名称,
"渠道"统一改为"通道"。新建渠道时对外名称必填,编辑时可选。
Co-Authored-By: Claude <noreply@anthropic.com>
1 tydzień temu
fengsilin
967309fb56
feat: 添加邮箱后缀注册额度规则功能
管理员可在用户管理页面配置「邮箱后缀→初始额度」映射规则,
用户注册时根据邮箱后缀自动匹配并发放对应额度(替代默认额度)。
- 新增 email_quota_rule 数据表 + CRUD API(管理员权限)
- 内存缓存匹配,启动时加载,增删改时刷新
- 注册流程 Insert/InsertWithTx/FinalizeOAuthUserCreation 同步支持
- 前端用户管理页新增 Tab 展示规则管理卡片
- 含 24 个测试(model 16 + controller 8)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 tydzień temu
fengsilin
54e53108ec
fix(sort): sort_order 默认值改为 999999,简化排序逻辑
未设置排序的记录 sort_order=999999 自然排在后面,无需 CASE WHEN。
- GORM 默认值 default:0 → default:999999
- 数据库迁移:将现有 sort_order=0 的记录更新为 999999
- 回退 CASE WHEN 排序逻辑,恢复简单的 sort_order ASC, id ASC
- 前端编辑弹窗默认值同步改为 999999
- 表格列中 999999 显示为空(表示未设置)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2 tygodni temu
fengsilin
e5f029f91e
feat(channel-pricing): InitDB 启动时全量加载渠道定价缓存
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tygodni temu
fengsilin
1cecd5349d
feat: 跨区域配额同步(Master-Slave Region Sync)
实现 Master-Slave 架构的跨区域用户和配额同步功能,支持国内主节点与
海外从节点之间的用户创建推送、余额同步、预扣费批量回传。
主要变更:
- 新增 region_sync 服务层(SyncManager/SyncClient/推送逻辑)
- User 模型扩展 Source/RemoteUserId/SyncedQuota/LastSyncAt 字段
- BillingSession 支持 SyncedUserFunding 资金来源
- 新增 SyncAuth 中间件(X-Sync-API-Key + 常量时间比较)
- 新增 PendingSyncRecord/QuotaSyncLog 数据模型
- 前端新增区域同步配置面板
- 支持 SESSION_NAME 环境变量避免多节点 cookie 冲突
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 tygodni temu
fengsilin
c58d01f628
refactor: improve code quality for token dynamic channel feature
1. Extract parseTokenKey helper function to eliminate code duplication
2. Add channelId validation to prevent invalid formats like sk-abc:def:ghi
3. Add database migration to drop deprecated bound_channel_id column
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 miesiąc temu
fengsilin
2331fbb4f1
feat: add ChannelPricing and PricingTag to database migration
Add the new pricing models to both migrateDB() and migrateDBFast()
functions to enable automatic table creation on database initialization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 miesiąc temu
winter
08164cd0ae
fix
2 miesięcy temu