Modify: clean modals

This commit is contained in:
HFO4
2020-03-11 15:22:21 +08:00
parent 4d70f9fa3e
commit 4ba24e0cf1
30 changed files with 22 additions and 598 deletions

View File

@@ -16,7 +16,6 @@ type ShareCreateService struct {
Password string `json:"password" binding:"max=255"`
RemainDownloads int `json:"downloads"`
Expire int `json:"expire"`
Score int `json:"score" binding:"gte=0"`
Preview bool `json:"preview"`
}
@@ -117,7 +116,6 @@ func (service *ShareCreateService) Create(c *gin.Context) serializer.Response {
IsDir: service.IsDir,
UserID: user.ID,
SourceID: sourceID,
Score: service.Score,
RemainDownloads: -1,
PreviewEnabled: service.Preview,
SourceName: sourceName,

View File

@@ -117,8 +117,6 @@ func (service *ShareListService) List(c *gin.Context, user *model.User) serializ
func (service *ShareGetService) Get(c *gin.Context) serializer.Response {
shareCtx, _ := c.Get("share")
share := shareCtx.(*model.Share)
userCtx, _ := c.Get("user")
user := userCtx.(*model.User)
// 是否已解锁
unlocked := true
@@ -138,11 +136,6 @@ func (service *ShareGetService) Get(c *gin.Context) serializer.Response {
share.Viewed()
}
// 如果已经下载过或者是自己的分享,不需要付积分
if share.UserID == user.ID || share.WasDownloadedBy(user, c) {
share.Score = 0
}
return serializer.Response{
Code: 0,
Data: serializer.BuildShareResponse(share, unlocked),