feat: add object storage and points leaderboard

This commit is contained in:
richjohnrambo
2026-10-18 18:11:34 +08:00
parent bce5edfaf5
commit b79b781f15
24 changed files with 359 additions and 212 deletions
+23 -2
View File
@@ -53,9 +53,30 @@ func New(cfg *config.Config) (*App, error) {
taskService := tasks.New(st)
mallService := mall.New(st)
financeService := finance.New(st, redisClient, cfg.Auth)
attachmentService := attachments.New(st, cfg.Upload)
uploadConfig := cfg.Upload
uploadCtx, uploadCancel := context.WithTimeout(context.Background(), 5*time.Second)
uploadValues, err := st.UploadConfigValues(uploadCtx)
uploadCancel()
if err != nil {
_ = redisClient.Close()
_ = st.Close()
return nil, err
}
config.ApplyUploadSystemConfig(&uploadConfig, uploadValues)
config.ApplyUploadEnv(&uploadConfig)
if err = config.ValidateUpload(uploadConfig); err != nil {
_ = redisClient.Close()
_ = st.Close()
return nil, err
}
attachmentService, err := attachments.New(st, uploadConfig)
if err != nil {
_ = redisClient.Close()
_ = st.Close()
return nil, err
}
supportService := support.New(st, imclient.New(cfg.IM), cfg.Auth)
return &App{store: st, redis: redisClient, api: httpapi.New(authenticator, accountService, portalService, taskService, mallService, financeService, attachmentService, supportService), frontendPath: cfg.FrontendDir, upload: cfg.Upload}, nil
return &App{store: st, redis: redisClient, api: httpapi.New(authenticator, accountService, portalService, taskService, mallService, financeService, attachmentService, supportService), frontendPath: cfg.FrontendDir, upload: uploadConfig}, nil
}
func (a *App) Handler() http.Handler {