MCPcopy Index your code
hub / github.com/TruthHun/BookStack / Increase

Method Increase

models/download_counter.go:25–39  ·  view source on GitHub ↗
(uid int)

Source from the content-addressed store, hash-verified

23}
24
25func (m *DownloadCounter) Increase(uid int) (err error) {
26 now, _ := strconv.Atoi(time.Now().Format("20060102"))
27 o := orm.NewOrm()
28 o.QueryTable(m).Filter("uid", uid).Filter("date", now).One(m)
29 if m.Id == 0 {
30 m.Total = 1
31 m.Uid = uid
32 m.Date = now
33 _, err = o.Insert(m)
34 } else {
35 m.Total = m.Total + 1
36 _, err = o.Update(m)
37 }
38 return
39}
40
41// DoesICanDownload 用户是否可以下载电子书
42// availableTimes 表示剩余可下载次数。负数表示不限制,否则表示限制可下载的次数

Callers 2

ExportOldMethod · 0.95
ExportMethod · 0.95

Calls 2

InsertMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected