package models import ( "github.com/beego/beego/v2/client/orm" _ "github.com/go-sql-driver/mysql" "hongze/hongze_robot/utils" "time" ) func init() { _ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL) orm.SetMaxIdleConns("default", 50) orm.SetMaxOpenConns("default", 100) db, _ := orm.GetDB("default") db.SetConnMaxLifetime(10 * time.Minute) //注册对象 orm.RegisterModel( new(SmsRecord), ) }