feat(*): 功能开放与页面布局 - 新增运维开关并优化后台及创作界面空间利用
This commit is contained in:
1 parent
8f7c492b70
commit
f439d600ba
36 files changed
+723
-86
No files matched your search
@@ -107,6 +107,9 @@ func (s *Service) Wallet(user *model.User, entryType string, page int, limit int
|
||||
if user == nil {
|
||||
return nil, Unauthorized("请先登录")
|
||||
}
|
||||
if err := s.RequireFeature(FeatureCredits); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if page <= 0 {
|
||||
page = 1
|
||||
}
|
||||
@@ -132,6 +135,9 @@ func (s *Service) RedeemCredits(user *model.User, code string, redeemedIP string
|
||||
if user == nil {
|
||||
return nil, Unauthorized("请先登录")
|
||||
}
|
||||
if err := s.RequireFeature(FeatureCredits); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
code = strings.ToLower(strings.TrimSpace(code))
|
||||
if len(code) != 32 {
|
||||
return nil, BadAuthRequest("兑换码无效或已使用")
|
||||
@@ -414,6 +420,13 @@ func (s *Service) AdminDisableRedeemCode(actor *model.User, batchID string, code
|
||||
}
|
||||
|
||||
func (s *Service) taskBillingOrder(userID string, task *model.Task, input map[string]any) (*model.BillingOrder, error) {
|
||||
enabled, err := s.FeatureEnabled(FeatureCredits)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !enabled {
|
||||
return nil, nil
|
||||
}
|
||||
config, _ := input["config"].(map[string]any)
|
||||
if config == nil {
|
||||
return nil, nil
|
||||
@@ -435,6 +448,13 @@ func (s *Service) taskBillingOrder(userID string, task *model.Task, input map[st
|
||||
}
|
||||
|
||||
func (s *Service) ReserveProxyBilling(userID string, channelID string, modelKey string, capability string, scene string, idempotencyKey string, quantity int64) (*model.BillingOrder, error) {
|
||||
enabled, err := s.FeatureEnabled(FeatureCredits)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !enabled {
|
||||
return nil, nil
|
||||
}
|
||||
if strings.TrimSpace(idempotencyKey) == "" {
|
||||
idempotencyKey = newID()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user