Files
goalfylearning-admin/internal/models/quota_models.go

66 lines
2.2 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package models
import (
"encoding/json"
"time"
)
// QuotaHistoryRequest 配额历史查询请求
type QuotaHistoryRequest struct {
StartDate string `json:"start_date" binding:"required"` // 开始日期 (YYYY-MM-DD)
EndDate string `json:"end_date" binding:"required"` // 结束日期 (YYYY-MM-DD)
UserID string `json:"user_id"` // 用户ID (可选)
ApiGroup string `json:"api_group"` // API组 (可选)
ProjectID string `json:"project_id"` // 项目ID (可选)
Period string `json:"period"` // 周期: daily, monthly
GroupBy []string `json:"group_by"` // 分组维度
}
// QuotaHistoryItem 配额历史数据项
//
// type QuotaHistoryItem struct {
// ID uint `json:"id"`
// UserID string `json:"user_id"`
// ApiGroup string `json:"api_group"`
// ProjectID string `json:"project_id"`
// Day string `json:"day"`
// Account string `json:"account"`
// Model string `json:"model"`
// QuotaUsed float64 `json:"quota_used"`
// CreatedAt time.Time `json:"created_at"`
// }
type QuotaHistoryItem struct {
ID uint `json:"ID"`
UserID string `json:"UserID"`
ApiGroup string `json:"ApiGroup"`
ProjectID string `json:"ProjectID"`
Day string `json:"Day"`
Account string `json:"Account"`
Model string `json:"Model"`
QuotaUsed float64 `json:"QuotaUsed"`
CreatedAt time.Time `json:"CreatedAt"`
}
// QuotaHistoryResponse 配额历史查询响应
type QuotaHistoryResponse struct {
Success bool `json:"success"`
Data []QuotaHistoryItem `json:"data"`
Message string `json:"message,omitempty"`
}
// GatewayConfig 网关配置
type GatewayConfig struct {
BaseURL string `json:"base_url"`
Timeout int `json:"timeout"` // 超时时间(秒)
}
// QuotaRule 透传结构(保持与网关一致,不强约束字段)
type QuotaRule map[string]interface{}
// QuotaRulesResponse 配额规则列表响应与网关一致Data透传
type QuotaRulesResponse struct {
Success bool `json:"success"`
Data json.RawMessage `json:"data"`
Message string `json:"message,omitempty"`
}