🎨 重构用户端前端为vue开发,完善基础类和角色相关接口

This commit is contained in:
2026-02-10 21:55:45 +08:00
parent db934ebed7
commit 56e821b222
92 changed files with 18377 additions and 21 deletions

View File

@@ -0,0 +1,25 @@
package app
import (
"git.echol.cn/loser/st/server/global"
"time"
)
// AIUsageStat AI 使用统计表
type AIUsageStat struct {
global.GVA_MODEL
UserID uint `json:"userId" gorm:"not null;index:idx_user_stat,unique;comment:用户ID"`
User *AppUser `json:"user" gorm:"foreignKey:UserID"`
StatDate time.Time `json:"statDate" gorm:"type:date;not null;index:idx_user_stat,unique;comment:统计日期"`
ProviderName string `json:"providerName" gorm:"type:varchar(100);index:idx_user_stat,unique;comment:AI提供商"`
ModelName string `json:"modelName" gorm:"type:varchar(200);index:idx_user_stat,unique;comment:模型名称"`
RequestCount int `json:"requestCount" gorm:"default:0;comment:请求次数"`
TotalTokens int64 `json:"totalTokens" gorm:"default:0;comment:总Token使用量"`
PromptTokens int64 `json:"promptTokens" gorm:"default:0;comment:提示词Token使用量"`
CompletionTokens int64 `json:"completionTokens" gorm:"default:0;comment:补全Token使用量"`
Cost float64 `json:"cost" gorm:"type:decimal(10,4);default:0;comment:费用"`
}
func (AIUsageStat) TableName() string {
return "ai_usage_stats"
}