cygx_user_record.go 784 B

12345678910111213141516171819202122232425262728
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxUserRecord struct {
  7. UserRecordId int `orm:"column(user_record_id);pk" description:"id"`
  8. OpenId string `description:"用户openid,最大长度:32"`
  9. UnionId string `description:"用户unionid,最大长度:64"`
  10. CreateTime time.Time `description:"提交建议时间"`
  11. }
  12. //添加优化建议
  13. func AddCygxUserRecord(item *CygxUserRecord) (lastId int64, err error) {
  14. o := orm.NewOrm()
  15. lastId, err = o.Insert(item)
  16. return
  17. }
  18. //获取数量
  19. func GetCygxUserRecordCount(openId string) (count int, err error) {
  20. o := orm.NewOrm()
  21. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_user_record WHERE open_id=? `
  22. err = o.Raw(sqlCount, openId).QueryRow(&count)
  23. return
  24. }