package models import ( "github.com/beego/beego/v2/client/orm" "time" ) //活动音视频,首次播放扣点记录 type CygxActivityVivoPointRecord struct { RecordId int `orm:"column(record_id);pk";comment:"主键ID"` SourceId int `comment:"来源ID"` Source string `comment:"来源 activityvoice:活动音频、activityvideo:活动视频"` UserId int `comment:"用户ID"` Mobile string `comment:"手机号"` Email string `comment:"邮箱"` CompanyId int `comment:"公司ID"` CompanyName string `comment:"公司名称"` RealName string `comment:"用户实际名称"` SellerName string `comment:"所属销售"` CreateTime time.Time `comment:"创建时间"` ModifyTime time.Time `comment:"修改时间"` RegisterPlatform int `comment:"来源 1小程序,2:网页"` } // GetCygxActivityVivoPointRecordCount 查询用户是否扣过点 func GetCygxActivityVivoPointRecordCount(sourceId, userId int) (count int, err error) { o := orm.NewOrm() sql := `SELECT COUNT(1) count FROM cygx_activity_vivo_point_record WHERE source_id = ? AND user_id = ? ` err = o.Raw(sql, sourceId, userId).QueryRow(&count) return } // 添加 func AddCygxActivityVivoPointRecord(item *CygxActivityVivoPointRecord) (err error) { o := orm.NewOrm() _, err = o.Insert(item) return }