package models import ( "github.com/beego/beego/v2/client/orm" ) type UserTemplateRecord struct { Id int `orm:"column(id);pk"` UserId int OpenId string Resource string SendData string Result string CreateDate string CreateTime string SendStatus int SendType int UniqueCode string WxAppId string } //添加banner func AddUserTemplateRecord(item *UserTemplateRecord) (err error) { o := orm.NewOrm() _, err = o.Insert(item) return } func GetTemplateRecordByUniqueCode(uniqueCode string) (list []*UserTemplateRecord, err error) { o := orm.NewOrm() sql := `SELECT open_id FROM user_template_record WHERE unique_code<>'' AND unique_code=? GROUP BY open_id` _, err = o.Raw(sql, uniqueCode).QueryRows(&list) return }