feat():learning后台管理项目初始化
This commit is contained in:
65
internal/models/quota_models.go
Normal file
65
internal/models/quota_models.go
Normal file
@@ -0,0 +1,65 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user