feat: 实现前端卡密管理界面
- 卡密列表展示与分页功能 - 单个/批量创建卡密 - 卡密删除与批量删除 - 卡密导出功能 (file-saver) - 启用/禁用状态切换 - 状态判断 (有效/已使用/已失效) - Toast 通知系统 (vue-sonner) - 登录页面错误提示优化 - 后端登录错误消息中文化
This commit is contained in:
25
backend/internal/models/api_key.go
Normal file
25
backend/internal/models/api_key.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
)
|
||||
|
||||
// APIKey API 密钥表
|
||||
type APIKey struct {
|
||||
ID int `json:"id"`
|
||||
Key string `json:"key"` // 格式: sk_live_xxx
|
||||
Name string `json:"name"`
|
||||
CreatedByID int `json:"created_by_id"`
|
||||
IsActive bool `json:"is_active"`
|
||||
RateLimit int `json:"rate_limit"` // 次/分钟
|
||||
AllowedIPs string `json:"allowed_ips"` // JSON 数组
|
||||
LastUsed sql.NullTime `json:"last_used"`
|
||||
RequestCount int `json:"request_count"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// TableName 返回表名
|
||||
func (APIKey) TableName() string {
|
||||
return "api_keys"
|
||||
}
|
||||
Reference in New Issue
Block a user