feat(admin): 资源与策略 - 后台统一维护账号配额与运行时请求限制 (#37)
Fixes #35 Co-authored-by: ddCat <ddcat666@88.com>
This commit is contained in:
1 parent
78e27507c4
commit
d3dfede48f
40 files changed
+1202
-488
No files matched your search
@@ -18,15 +18,15 @@ type Repository struct {
|
||||
}
|
||||
|
||||
type UserStorageUsage struct {
|
||||
AssetCount int64
|
||||
AssetBytes int64
|
||||
CanvasCount int64
|
||||
CanvasBytes int64
|
||||
SessionCount int64
|
||||
SessionBytes int64
|
||||
TaskCount int64
|
||||
TaskBytes int64
|
||||
APICallCount int64
|
||||
AssetCount int64 `json:"assetCount"`
|
||||
AssetBytes int64 `json:"assetBytes"`
|
||||
CanvasCount int64 `json:"canvasCount"`
|
||||
CanvasBytes int64 `json:"canvasBytes"`
|
||||
SessionCount int64 `json:"sessionCount"`
|
||||
SessionBytes int64 `json:"sessionBytes"`
|
||||
TaskCount int64 `json:"taskCount"`
|
||||
TaskBytes int64 `json:"taskBytes"`
|
||||
APICallCount int64 `json:"apiCallCount"`
|
||||
}
|
||||
|
||||
func New(db *gorm.DB) *Repository {
|
||||
@@ -532,6 +532,10 @@ func (r *Repository) SaveSystemSetting(setting *model.SystemSetting) error {
|
||||
return r.db.Save(setting).Error
|
||||
}
|
||||
|
||||
func (r *Repository) DeleteSystemSetting(key string) error {
|
||||
return r.db.Delete(&model.SystemSetting{}, "key = ?", key).Error
|
||||
}
|
||||
|
||||
func (r *Repository) LatestUserOSSSetting(userID string) (*model.UserOSSSetting, error) {
|
||||
var setting model.UserOSSSetting
|
||||
if err := r.db.Where("user_id = ?", userID).Order("created_at desc, id desc").First(&setting).Error; err != nil {
|
||||
|
||||
Reference in new issue
Block a user