Add statistic api

This commit is contained in:
2025-10-02 21:34:35 +08:00
parent 17026a74c5
commit aac1992dba
5 changed files with 120 additions and 0 deletions

View File

@@ -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
}

View File

@@ -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
}