package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type WxUserCode struct { Id int `orm:"column(id);pk"` WxCode string UserId int Code int FirstLogin int Authorization string UserPermission int CreateTime time.Time } // 添加联系人日志信息 func AddWxUserCode(item *WxUserCode) (lastId int64, err error) { o := orm.NewOrmUsingDB("weekly_report") lastId, err = o.Insert(item) return } func GetWxUserCode(wxCode string) (item *WxUserCode, err error) { o := orm.NewOrmUsingDB("weekly_report") sql := `SELECT * FROM wx_user_code WHERE wx_code=? ` err = o.Raw(sql, wxCode).QueryRow(&item) return }