package cygx import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxXzsChooseSend struct { Id int `orm:"column(id);pk"` UserId int `description:"用户ID"` Mobile string `description:"手机号"` Email string `description:"邮箱"` CompanyId int `description:"公司id"` CompanyName string `description:"公司名称"` RealName string `description:"用户实际名称"` IsRefuse int `description:"是否拒绝推送,0否、1是 如果为1 则不做任何推送"` IsSubjective int `description:"是否选择主观推送, 1 是 、 0否"` IsObjective int `description:"是否选择客观推送, 1 是 、 0否"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"更新时间"` } // 获取提交过推送规则用户的userId func GetCygxXzsChooseSend(condition string) (items []*CygxXzsChooseSend, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_xzs_choose_send WHERE 1 =1 ` + condition _, err = o.Raw(sql).QueryRows(&items) return } // 获取某个行业勾选全部赛道的用户 func GetCygxXzsChooseSendByAllIn(allIn string) (items []*CygxXzsChooseSend, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_xzs_choose_send WHERE ` + allIn + ` = 1 ` _, err = o.Raw(sql).QueryRows(&items) return } // 修改某个用户的行业是否勾选全部赛道 func UpdateCygxXzsChooseSendIsAllIn(allIn string, isAllIn, userId int) (err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `UPDATE cygx_xzs_choose_send SET ` + allIn + ` = ? WHERE user_id = ?` _, err = o.Raw(sql, isAllIn, userId).Exec() return }