xzs_choose_send.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxXzsChooseSend struct {
  7. Id int `orm:"column(id);pk"`
  8. UserId int `description:"用户ID"`
  9. Mobile string `description:"手机号"`
  10. Email string `description:"邮箱"`
  11. CompanyId int `description:"公司id"`
  12. CompanyName string `description:"公司名称"`
  13. RealName string `description:"用户实际名称"`
  14. IsRefuse int `description:"是否拒绝推送,0否、1是 如果为1 则不做任何推送"`
  15. IsSubjective int `description:"是否选择主观推送, 1 是 、 0否"`
  16. IsObjective int `description:"是否选择客观推送, 1 是 、 0否"`
  17. CreateTime time.Time `description:"创建时间"`
  18. ModifyTime time.Time `description:"更新时间"`
  19. }
  20. // 获取提交过推送规则用户的userId
  21. func GetCygxXzsChooseSend(condition string) (items []*CygxXzsChooseSend, err error) {
  22. o := orm.NewOrmUsingDB("hz_cygx")
  23. sql := `SELECT * FROM cygx_xzs_choose_send WHERE 1 =1 ` + condition
  24. _, err = o.Raw(sql).QueryRows(&items)
  25. return
  26. }
  27. // 获取某个行业勾选全部赛道的用户
  28. func GetCygxXzsChooseSendByAllIn(allIn string) (items []*CygxXzsChooseSend, err error) {
  29. o := orm.NewOrmUsingDB("hz_cygx")
  30. sql := `SELECT * FROM cygx_xzs_choose_send WHERE ` + allIn + ` = 1 `
  31. _, err = o.Raw(sql).QueryRows(&items)
  32. return
  33. }
  34. // 修改某个用户的行业是否勾选全部赛道
  35. func UpdateCygxXzsChooseSendIsAllIn(allIn string, isAllIn, userId int) (err error) {
  36. o := orm.NewOrmUsingDB("hz_cygx")
  37. sql := `UPDATE cygx_xzs_choose_send SET ` + allIn + ` = ? WHERE user_id = ?`
  38. _, err = o.Raw(sql, isAllIn, userId).Exec()
  39. return
  40. }