12345678910111213141516171819202122232425262728 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxUserRecord struct {
- UserRecordId int `orm:"column(user_record_id);pk" description:"id"`
- OpenId string `description:"用户openid,最大长度:32"`
- UnionId string `description:"用户unionid,最大长度:64"`
- CreateTime time.Time `description:"提交建议时间"`
- }
- //添加优化建议
- func AddCygxUserRecord(item *CygxUserRecord) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- //获取数量
- func GetCygxUserRecordCount(openId string) (count int, err error) {
- o := orm.NewOrm()
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_user_record WHERE open_id=? `
- err = o.Raw(sqlCount, openId).QueryRow(&count)
- return
- }
|