add 增加查询次数限制等各种命令限制
This commit is contained in:
parent
b830b2d8fd
commit
e0ed3bdf60
@ -11,12 +11,12 @@ type Limit struct {
|
||||
}
|
||||
|
||||
func getLimit(uid int, typ int) bool {
|
||||
u := &Limit{}
|
||||
db.Where("number = ? and typ = ? and active_at = ?", uid, typ, time.Now().Format("2006-01-02")).First(&u)
|
||||
if Config.Lim == 0 {
|
||||
return true
|
||||
}
|
||||
if u.ID != 0 {
|
||||
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 {
|
||||
if u.Num < Config.Lim {
|
||||
db.Updates(&Limit{
|
||||
Num: u.Num + 1,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user