mirror of
https://github.com/wgh136/nysoure.git
synced 2025-12-16 15:51:14 +00:00
Add statistic api
This commit is contained in:
@@ -239,3 +239,11 @@ func ListUserFiles(userID uint, page, pageSize int) ([]*model.File, int64, error
|
||||
}
|
||||
return files, count, nil
|
||||
}
|
||||
|
||||
func CountFiles() (int64, error) {
|
||||
var count int64
|
||||
if err := db.Model(&model.File{}).Count(&count).Error; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
@@ -461,3 +461,11 @@ func BatchGetResources(ids []uint) ([]model.Resource, error) {
|
||||
|
||||
return resources, nil
|
||||
}
|
||||
|
||||
func CountResources() (int64, error) {
|
||||
var count int64
|
||||
if err := db.Model(&model.Resource{}).Count(&count).Error; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user