Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangmitiao committed Jun 20, 2017
1 parent 56a9e3f commit e2ee2a0
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions app/interceptor/Interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,20 @@ func downloadLimitInterceptor(c *revel.Controller) revel.Result {
if takeAvailable("common", int64(limitConfig)) <= 0 {
return c.RenderJSONP(c.Request.FormValue("callback"), models.NewErrorApiWithMessageAndInfo(c.Message("limitdownload"), nil))
}
// add status to sys status
key := time.Now().Format("20060102") + "-downnum"
if status := sysStatusService.Get(key); status.Key != "" {
value, _ := strconv.ParseInt(status.Value, 10, 0)
value += 1
status.Value = strconv.FormatInt(value, 10)
sysStatusService.UpdateStatus(status)
} else {
status = models.SysStatus{Key: key, Value: strconv.FormatInt(1, 10)}
sysStatusService.AddSysStatus(status)
}
}

// add status to sys status
key := time.Now().Format("20060102") + "-downnum"
if status := sysStatusService.Get(key); status.Key != "" {
value, _ := strconv.ParseInt(status.Value, 10, 0)
value += 1
status.Value = strconv.FormatInt(value, 10)
sysStatusService.UpdateStatus(status)
} else {
status = models.SysStatus{Key: key, Value: strconv.FormatInt(1, 10)}
sysStatusService.AddSysStatus(status)
}

return nil
}

Expand Down

0 comments on commit e2ee2a0

Please sign in to comment.