xzs_choose_category_zhouqi.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxXzsChooseCategoryZhouqi 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. CategoryId int `description:"cygx_zhouqi_article_map 表主键"`
  15. CreateTime time.Time `description:"创建时间"`
  16. ModifyTime time.Time `description:"更新时间"`
  17. FollowType int `description:"1,重点关注,3不感兴趣,0默认接受推送"`
  18. }
  19. // 根据手机号获取用户关注的产业
  20. func GetCygxXzsChooseCategoryZhouqiList(mobile string) (items []*CygxXzsChooseCategoryZhouqi, err error) {
  21. o := orm.NewOrm()
  22. sql := `SELECT * FROM cygx_xzs_choose_category_zhouqi WHERE mobile = ?`
  23. _, err = o.Raw(sql, mobile).QueryRows(&items)
  24. return
  25. }
  26. // 列表
  27. func GetCygxXzsChooseCategoryZhouqiListFollowType(categoryName, seriesName string, followType int) (items []*CygxXzsChooseCategoryZhouqi, err error) {
  28. o := orm.NewOrm()
  29. sql := `SELECT
  30. f.*
  31. FROM
  32. cygx_zhouqi_article_map AS m
  33. INNER JOIN cygx_xzs_choose_category_zhouqi AS f ON f.category_id = m.category_id
  34. WHERE
  35. 1 = 1
  36. AND ( m.match_type_name = ? OR m.series_name = ? )
  37. AND follow_type = ? `
  38. _, err = o.Raw(sql, categoryName, seriesName, followType).QueryRows(&items)
  39. return
  40. }