mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
fix(backend): update DownloadShare to decrement view count in Redis before returning file
This commit is contained in:
@@ -42,9 +42,14 @@ func DownloadShare(c echo.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
models.SetRedisShareInfo(claims.ShareId, models.RedisShareInfo{
|
||||
ViewNum: shareInfo.ViewNum - 1,
|
||||
})
|
||||
return cc.Attachment(fmt.Sprintf("%s/%s", uploadPath, utils.GetFileId(fileInfo.FileHash, fileInfo.FileSize)), shareInfo.FileName)
|
||||
}
|
||||
|
||||
models.SetRedisShareInfo(claims.ShareId, models.RedisShareInfo{
|
||||
ViewNum: shareInfo.ViewNum - 1,
|
||||
})
|
||||
return utils.HTTPSuccessHandler(c, map[string]any{
|
||||
"data": shareInfo.Data,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user