Skip to content

Commit 141b824

Browse files
committed
feat: 完善账号共享、活动、发票与风控能力
- 新增用户活动中心与管理端活动管理能力,补齐活动处理器、服务层、路由、前端 API、类型定义以及用户端/管理端页面,让活动配置、参与记录和自动抽奖流程形成完整闭环。 - 新增发票管理模块,补齐用户发票申请、管理端发票处理、发票资料默认值约束、退款与发票关联校验,并新增对应仓储、服务、处理器、路由和前端页面。 - 扩展账号共享模式能力,支持 Anthropic 账号共享、账号共享预约队列、评论审核、绑定与选择逻辑增强,并完善管理端和用户端账号共享交互。 - 强化用户自有 OpenAI Pro 账号的代理容量校验,增加代理满载拦截、容量可用性判断、原子创建路径和前端满载禁用逻辑,避免超出代理绑定限制。 - 完善内容安全与风险控制能力,新增评论审核服务、动态抽样配置、用户信任状态处理、风险控制设置项和管理端配置入口。 - 优化网关与用量统计链路,补充 OpenAI 兼容网关用量记录、请求类型归类、模型价格上下文数据、按账号/分组/模型的统计展示和账单聚合逻辑。 - 增强后台运营与清理能力,补充系统日志仓储测试、运维清理保留期配置、归档任务参数和相关服务接口,提升运行数据治理能力。 - 完善提现、系统通知、余额账本、API Key 删除、OAuth 邮箱流程、认证服务和设置服务的边界处理与测试覆盖,降低资金和账号状态变更风险。 - 更新前端导航、路由元信息、侧边栏、功能开关、设置页、用量页、个人资料页、账号页、密钥页、仪表盘卡片与中英文文案,使新增模块入口和状态展示保持一致。 - 增加活动、发票、账号共享、内容安全、功能开关、时区、用量统计、代理容量、系统通知、退款发票关联等后端与前端测试,覆盖关键业务分支。 - 补充项目审查材料与问题分组记录,沉淀后续安全、数据、前端体验、测试覆盖和工程质量改进项。 - 更新服务版本标识到 1.1.50,并同步 Wire 注入代码、接口契约测试、配置示例和模型定价资源,保证新增模块在现有架构中可被正确装配。
1 parent 2ad6808 commit 141b824

173 files changed

Lines changed: 50553 additions & 20884 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/cmd/server/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.27
1+
1.1.50

backend/cmd/server/wire.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ func provideCleanup(
9595
openaiOAuth *service.OpenAIOAuthService,
9696
geminiOAuth *service.GeminiOAuthService,
9797
antigravityOAuth *service.AntigravityOAuthService,
98+
accountShareMode *service.AccountShareModeService,
9899
openAIGateway *service.OpenAIGatewayService,
99100
scheduledTestRunner *service.ScheduledTestRunnerService,
100101
backupSvc *service.BackupService,
102+
activityAutoDraw *service.ActivityAutoDrawService,
101103
paymentOrderExpiry *service.PaymentOrderExpiryService,
102104
channelMonitorRunner *service.ChannelMonitorRunner,
103105
) func() {
@@ -230,6 +232,13 @@ func provideCleanup(
230232
antigravityOAuth.Stop()
231233
return nil
232234
}},
235+
{"AccountShareModeService", func() error {
236+
if accountShareMode != nil {
237+
accountShareMode.StopReviewModerationWorker()
238+
accountShareMode.StopSeatBillingWorker()
239+
}
240+
return nil
241+
}},
233242
{"OpenAIWSPool", func() error {
234243
if openAIGateway != nil {
235244
openAIGateway.CloseOpenAIWSPool()
@@ -248,6 +257,12 @@ func provideCleanup(
248257
}
249258
return nil
250259
}},
260+
{"ActivityAutoDrawService", func() error {
261+
if activityAutoDraw != nil {
262+
activityAutoDraw.Stop()
263+
}
264+
return nil
265+
}},
251266
{"PaymentOrderExpiryService", func() error {
252267
if paymentOrderExpiry != nil {
253268
paymentOrderExpiry.Stop()

backend/cmd/server/wire_gen.go

Lines changed: 86 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/cmd/server/wire_gen_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ func TestProvideCleanup_WithMinimalDependencies_NoPanic(t *testing.T) {
6262
nil, // affiliateCodeCycle
6363
tokenRefreshSvc,
6464
accountExpirySvc,
65-
nil, // accountErrorCleanup
6665
subscriptionExpirySvc,
6766
&service.UsageCleanupService{},
6867
idempotencyCleanupSvc,
@@ -75,9 +74,11 @@ func TestProvideCleanup_WithMinimalDependencies_NoPanic(t *testing.T) {
7574
openAIOAuthSvc,
7675
geminiOAuthSvc,
7776
antigravityOAuthSvc,
77+
nil, // accountShareMode
7878
nil, // openAIGateway
7979
nil, // scheduledTestRunner
8080
nil, // backupSvc
81+
nil, // activityAutoDraw
8182
nil, // paymentOrderExpiry
8283
nil, // channelMonitorRunner
8384
)

backend/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17
162162
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
163163
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
164164
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
165+
github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE=
166+
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
165167
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
166168
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
167169
github.com/google/wire v0.7.0 h1:JxUKI6+CVBgCO2WToKy/nQk0sS+amI9z9EjVmdaocj4=

backend/internal/config/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,8 @@ type OpsConfig struct {
12911291
type OpsCleanupConfig struct {
12921292
Enabled bool `mapstructure:"enabled"`
12931293
Schedule string `mapstructure:"schedule"`
1294+
// ArchiveExpireDays controls backup record/object expiry for ops log archives. 0 means never expire.
1295+
ArchiveExpireDays int `mapstructure:"archive_expire_days"`
12941296

12951297
// Retention days (0 disables that cleanup target).
12961298
//
@@ -1795,6 +1797,7 @@ func setDefaults() {
17951797
viper.SetDefault("ops.use_preaggregated_tables", true)
17961798
viper.SetDefault("ops.cleanup.enabled", true)
17971799
viper.SetDefault("ops.cleanup.schedule", "0 2 * * *")
1800+
viper.SetDefault("ops.cleanup.archive_expire_days", 14)
17981801
// Retention days: vNext defaults to 30 days across ops datasets.
17991802
viper.SetDefault("ops.cleanup.error_log_retention_days", 30)
18001803
viper.SetDefault("ops.cleanup.minute_metrics_retention_days", 30)
@@ -2903,6 +2906,9 @@ func (c *Config) Validate() error {
29032906
if c.Ops.MetricsCollectorCache.TTL < 0 {
29042907
return fmt.Errorf("ops.metrics_collector_cache.ttl must be non-negative")
29052908
}
2909+
if c.Ops.Cleanup.ArchiveExpireDays < 0 {
2910+
return fmt.Errorf("ops.cleanup.archive_expire_days must be non-negative")
2911+
}
29062912
if c.Ops.Cleanup.ErrorLogRetentionDays < 0 {
29072913
return fmt.Errorf("ops.cleanup.error_log_retention_days must be non-negative")
29082914
}

0 commit comments

Comments
 (0)