user_label.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxUserLabelLogRedis struct {
  7. UserId int `description:"用户ID"`
  8. SourceId int `description:"资源ID"`
  9. SourceType int `description:"1:文章阅读、 2产业关注、3:活动到会、4系列关注、5专项调研活动到会。"`
  10. IsFllow int `description:"1关注、0取消关注"`
  11. CreateTime time.Time `description:"创建时间"`
  12. }
  13. type CygxUserLabel struct {
  14. Id int `orm:"column(id);pk"`
  15. UserId int `description:"用户ID"`
  16. CompanyId int `description:"公司id"`
  17. RealName string `description:"用户实际名称"`
  18. Mobile string `description:"手机号"`
  19. Email string `description:"邮箱"`
  20. Label string `description:"标签内容"`
  21. Weight int `description:"权重"`
  22. SourceId int `description:"来源ID(产业ID,系列ID)"`
  23. Source int `description:"来源1:产业、2:系列"`
  24. IsFollow int `description:"是否关注,1是,0否"`
  25. CreateTime time.Time `description:"创建时间"`
  26. ModifyTime time.Time `description:"更新时间"`
  27. }
  28. // UpdateCygxUserLabelNofollow 全部取消关注
  29. func UpdateCygxUserLabelNofollow(userId int) (err error) {
  30. o := orm.NewOrmUsingDB("hz_cygx")
  31. sql := `UPDATE cygx_user_label SET is_follow = 0 , modify_time=NOW() WHERE user_id = ? `
  32. _, err = o.Raw(sql, userId).Exec()
  33. return
  34. }
  35. // 列表
  36. func GetCygxUserLabelList(condition string, pars []interface{}) (items []*CygxUserLabel, err error) {
  37. o := orm.NewOrmUsingDB("hz_cygx")
  38. sql := `SELECT * FROM cygx_user_label as art WHERE 1= 1 `
  39. if condition != "" {
  40. sql += condition
  41. }
  42. _, err = o.Raw(sql, pars).QueryRows(&items)
  43. return
  44. }