fix: update mock interfaces and fix gofmt issues for CI
- Update mockGatewayCacheForPlatform and mockGatewayCacheForGemini to match new GatewayCache interface with groupID parameter - Fix gofmt formatting in group_handler.go and admin_service.go
This commit is contained in:
@@ -34,11 +34,11 @@ type CreateGroupRequest struct {
|
|||||||
WeeklyLimitUSD *float64 `json:"weekly_limit_usd"`
|
WeeklyLimitUSD *float64 `json:"weekly_limit_usd"`
|
||||||
MonthlyLimitUSD *float64 `json:"monthly_limit_usd"`
|
MonthlyLimitUSD *float64 `json:"monthly_limit_usd"`
|
||||||
// 图片生成计费配置(antigravity 和 gemini 平台使用,负数表示清除配置)
|
// 图片生成计费配置(antigravity 和 gemini 平台使用,负数表示清除配置)
|
||||||
ImagePrice1K *float64 `json:"image_price_1k"`
|
ImagePrice1K *float64 `json:"image_price_1k"`
|
||||||
ImagePrice2K *float64 `json:"image_price_2k"`
|
ImagePrice2K *float64 `json:"image_price_2k"`
|
||||||
ImagePrice4K *float64 `json:"image_price_4k"`
|
ImagePrice4K *float64 `json:"image_price_4k"`
|
||||||
ClaudeCodeOnly bool `json:"claude_code_only"`
|
ClaudeCodeOnly bool `json:"claude_code_only"`
|
||||||
FallbackGroupID *int64 `json:"fallback_group_id"`
|
FallbackGroupID *int64 `json:"fallback_group_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateGroupRequest represents update group request
|
// UpdateGroupRequest represents update group request
|
||||||
@@ -54,11 +54,11 @@ type UpdateGroupRequest struct {
|
|||||||
WeeklyLimitUSD *float64 `json:"weekly_limit_usd"`
|
WeeklyLimitUSD *float64 `json:"weekly_limit_usd"`
|
||||||
MonthlyLimitUSD *float64 `json:"monthly_limit_usd"`
|
MonthlyLimitUSD *float64 `json:"monthly_limit_usd"`
|
||||||
// 图片生成计费配置(antigravity 和 gemini 平台使用,负数表示清除配置)
|
// 图片生成计费配置(antigravity 和 gemini 平台使用,负数表示清除配置)
|
||||||
ImagePrice1K *float64 `json:"image_price_1k"`
|
ImagePrice1K *float64 `json:"image_price_1k"`
|
||||||
ImagePrice2K *float64 `json:"image_price_2k"`
|
ImagePrice2K *float64 `json:"image_price_2k"`
|
||||||
ImagePrice4K *float64 `json:"image_price_4k"`
|
ImagePrice4K *float64 `json:"image_price_4k"`
|
||||||
ClaudeCodeOnly *bool `json:"claude_code_only"`
|
ClaudeCodeOnly *bool `json:"claude_code_only"`
|
||||||
FallbackGroupID *int64 `json:"fallback_group_id"`
|
FallbackGroupID *int64 `json:"fallback_group_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List handles listing all groups with pagination
|
// List handles listing all groups with pagination
|
||||||
|
|||||||
@@ -100,11 +100,11 @@ type CreateGroupInput struct {
|
|||||||
WeeklyLimitUSD *float64 // 周限额 (USD)
|
WeeklyLimitUSD *float64 // 周限额 (USD)
|
||||||
MonthlyLimitUSD *float64 // 月限额 (USD)
|
MonthlyLimitUSD *float64 // 月限额 (USD)
|
||||||
// 图片生成计费配置(仅 antigravity 平台使用)
|
// 图片生成计费配置(仅 antigravity 平台使用)
|
||||||
ImagePrice1K *float64
|
ImagePrice1K *float64
|
||||||
ImagePrice2K *float64
|
ImagePrice2K *float64
|
||||||
ImagePrice4K *float64
|
ImagePrice4K *float64
|
||||||
ClaudeCodeOnly bool // 仅允许 Claude Code 客户端
|
ClaudeCodeOnly bool // 仅允许 Claude Code 客户端
|
||||||
FallbackGroupID *int64 // 降级分组 ID
|
FallbackGroupID *int64 // 降级分组 ID
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateGroupInput struct {
|
type UpdateGroupInput struct {
|
||||||
@@ -119,11 +119,11 @@ type UpdateGroupInput struct {
|
|||||||
WeeklyLimitUSD *float64 // 周限额 (USD)
|
WeeklyLimitUSD *float64 // 周限额 (USD)
|
||||||
MonthlyLimitUSD *float64 // 月限额 (USD)
|
MonthlyLimitUSD *float64 // 月限额 (USD)
|
||||||
// 图片生成计费配置(仅 antigravity 平台使用)
|
// 图片生成计费配置(仅 antigravity 平台使用)
|
||||||
ImagePrice1K *float64
|
ImagePrice1K *float64
|
||||||
ImagePrice2K *float64
|
ImagePrice2K *float64
|
||||||
ImagePrice4K *float64
|
ImagePrice4K *float64
|
||||||
ClaudeCodeOnly *bool // 仅允许 Claude Code 客户端
|
ClaudeCodeOnly *bool // 仅允许 Claude Code 客户端
|
||||||
FallbackGroupID *int64 // 降级分组 ID
|
FallbackGroupID *int64 // 降级分组 ID
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateAccountInput struct {
|
type CreateAccountInput struct {
|
||||||
|
|||||||
@@ -166,14 +166,14 @@ type mockGatewayCacheForPlatform struct {
|
|||||||
sessionBindings map[string]int64
|
sessionBindings map[string]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockGatewayCacheForPlatform) GetSessionAccountID(ctx context.Context, sessionHash string) (int64, error) {
|
func (m *mockGatewayCacheForPlatform) GetSessionAccountID(ctx context.Context, groupID int64, sessionHash string) (int64, error) {
|
||||||
if id, ok := m.sessionBindings[sessionHash]; ok {
|
if id, ok := m.sessionBindings[sessionHash]; ok {
|
||||||
return id, nil
|
return id, nil
|
||||||
}
|
}
|
||||||
return 0, errors.New("not found")
|
return 0, errors.New("not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockGatewayCacheForPlatform) SetSessionAccountID(ctx context.Context, sessionHash string, accountID int64, ttl time.Duration) error {
|
func (m *mockGatewayCacheForPlatform) SetSessionAccountID(ctx context.Context, groupID int64, sessionHash string, accountID int64, ttl time.Duration) error {
|
||||||
if m.sessionBindings == nil {
|
if m.sessionBindings == nil {
|
||||||
m.sessionBindings = make(map[string]int64)
|
m.sessionBindings = make(map[string]int64)
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ func (m *mockGatewayCacheForPlatform) SetSessionAccountID(ctx context.Context, s
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockGatewayCacheForPlatform) RefreshSessionTTL(ctx context.Context, sessionHash string, ttl time.Duration) error {
|
func (m *mockGatewayCacheForPlatform) RefreshSessionTTL(ctx context.Context, groupID int64, sessionHash string, ttl time.Duration) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,14 +190,14 @@ type mockGatewayCacheForGemini struct {
|
|||||||
sessionBindings map[string]int64
|
sessionBindings map[string]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockGatewayCacheForGemini) GetSessionAccountID(ctx context.Context, sessionHash string) (int64, error) {
|
func (m *mockGatewayCacheForGemini) GetSessionAccountID(ctx context.Context, groupID int64, sessionHash string) (int64, error) {
|
||||||
if id, ok := m.sessionBindings[sessionHash]; ok {
|
if id, ok := m.sessionBindings[sessionHash]; ok {
|
||||||
return id, nil
|
return id, nil
|
||||||
}
|
}
|
||||||
return 0, errors.New("not found")
|
return 0, errors.New("not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockGatewayCacheForGemini) SetSessionAccountID(ctx context.Context, sessionHash string, accountID int64, ttl time.Duration) error {
|
func (m *mockGatewayCacheForGemini) SetSessionAccountID(ctx context.Context, groupID int64, sessionHash string, accountID int64, ttl time.Duration) error {
|
||||||
if m.sessionBindings == nil {
|
if m.sessionBindings == nil {
|
||||||
m.sessionBindings = make(map[string]int64)
|
m.sessionBindings = make(map[string]int64)
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ func (m *mockGatewayCacheForGemini) SetSessionAccountID(ctx context.Context, ses
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockGatewayCacheForGemini) RefreshSessionTTL(ctx context.Context, sessionHash string, ttl time.Duration) error {
|
func (m *mockGatewayCacheForGemini) RefreshSessionTTL(ctx context.Context, groupID int64, sessionHash string, ttl time.Duration) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user