From 73d4d34af93d8c0ea5f22e908c761256e85aa516 Mon Sep 17 00:00:00 2001 From: ZJY <764763903@qq.com> Date: Mon, 27 Sep 2021 16:07:15 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E9=99=90=E5=88=B6=E7=AD=89=E5=90=84=E7=A7=8D?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/SendLimit.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/models/SendLimit.go b/models/SendLimit.go index faf86d5..aa219ca 100644 --- a/models/SendLimit.go +++ b/models/SendLimit.go @@ -1,6 +1,9 @@ package models -import "time" +import ( + "github.com/beego/beego/v2/core/logs" + "time" +) type Limit struct { ID int `gorm:"column:ID;primaryKey"` @@ -26,13 +29,15 @@ func getLimit(uid int, typ int) bool { return false } } else { - db.Begin() - u.ActiveAt = time.Now().Format("2006-01-02") - u.Typ = typ - u.Number = uid - u.Num = 1 - db.Create(u) - db.Commit() + logs.Info("开始进入创建") + begin := db.Begin() + begin.Create(&Limit{ + ActiveAt: time.Now().Format("2006-01-02"), + Typ: typ, + Number: uid, + Num: 1, + }) + begin.Commit() return true } }