mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Add statistics.
This commit is contained in:
@@ -379,6 +379,7 @@ func DownloadFile(fid string) (string, string, error) {
|
||||
|
||||
if file.StorageID == nil {
|
||||
if file.RedirectUrl != "" {
|
||||
_ = dao.AddResourceDownloadCount(file.ResourceID)
|
||||
return file.RedirectUrl, file.Filename, nil
|
||||
}
|
||||
return "", "", model.NewRequestError("file is not available")
|
||||
@@ -396,5 +397,7 @@ func DownloadFile(fid string) (string, string, error) {
|
||||
|
||||
path, err := iStorage.Download(file.StorageKey, file.Filename)
|
||||
|
||||
_ = dao.AddResourceDownloadCount(file.ResourceID)
|
||||
|
||||
return path, file.Filename, err
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ func CreateResource(uid uint, params *ResourceCreateParams) (uint, error) {
|
||||
|
||||
func GetResource(id uint) (*model.ResourceDetailView, error) {
|
||||
r, err := dao.GetResourceByID(id)
|
||||
_ = dao.AddResourceViewCount(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user