add 增加查询次数限制等各种命令限制
This commit is contained in:
parent
ba88ea9264
commit
0ced679258
@ -21,10 +21,11 @@ func getLimit(uid int, typ int) bool {
|
||||
u := &Limit{}
|
||||
err := db.Where("number = ? and typ = ? and active_at = ?", uid, typ, time.Now().Format("2006-01-02")).First(&u).Error
|
||||
if err == nil {
|
||||
logs.Info(u.Number)
|
||||
if u.Num < Config.Lim {
|
||||
db.Updates(&Limit{
|
||||
db.Where("ID = ?", u.ID).Updates(&Limit{
|
||||
Num: u.Num + 1,
|
||||
}).Where("ID = ?", u.ID)
|
||||
})
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
||||
Loading…
Reference in New Issue
Block a user