user_template_record.go 762 B

12345678910111213141516171819202122232425262728293031323334
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. type UserTemplateRecord struct {
  6. Id int `orm:"column(id);pk"`
  7. UserId int
  8. OpenId string
  9. Resource string
  10. SendData string
  11. Result string
  12. CreateDate string
  13. CreateTime string
  14. SendStatus int
  15. SendType int
  16. UniqueCode string
  17. WxAppId string
  18. }
  19. //添加banner
  20. func AddUserTemplateRecord(item *UserTemplateRecord) (err error) {
  21. o := orm.NewOrm()
  22. _, err = o.Insert(item)
  23. return
  24. }
  25. func GetTemplateRecordByUniqueCode(uniqueCode string) (list []*UserTemplateRecord, err error) {
  26. o := orm.NewOrm()
  27. sql := `SELECT open_id FROM user_template_record WHERE unique_code<>'' AND unique_code=? GROUP BY open_id`
  28. _, err = o.Raw(sql, uniqueCode).QueryRows(&list)
  29. return
  30. }