Skip to content

Commit da1059d

Browse files
committed
下载计数修正
1 parent 7a4fde4 commit da1059d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

models/download_counter.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
package models
33

44
import (
5-
"github.com/astaxie/beego/orm"
65
"strconv"
76
"time"
7+
8+
"github.com/astaxie/beego/orm"
89
)
910

1011
type DownloadCounter struct {
@@ -24,11 +25,11 @@ func (m *DownloadCounter) Increase(uid int) (err error) {
2425
o.QueryTable(m).Filter("uid", uid).Filter("date", now).One(m)
2526
if m.Id == 0 {
2627
m.Total = 1
27-
m.Uid = 1
28+
m.Uid = uid
2829
m.Date = now
2930
_, err = o.Insert(m)
3031
} else {
31-
m.Total += 1
32+
m.Total = m.Total + 1
3233
_, err = o.Update(m)
3334
}
3435
return

0 commit comments

Comments
 (0)