search_key_word_log.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxSearchKeyWordLog struct {
  7. Id int `orm:"column(id);" description:"id"`
  8. KeyWord string `description:"搜索关键词"`
  9. UserId int `description:"用户ID"`
  10. CreateTime time.Time `description:"搜索时间"`
  11. Mobile string `description:"手机号"`
  12. Email string `description:"邮箱"`
  13. CompanyId int `description:"公司id"`
  14. CompanyName string `description:"公司名称"`
  15. RealName string `description:"用户实际名称"`
  16. Source int `description:"来源;1:纪要、2:图表、3:纪要/图表、4:产业资源包、5:报告、6:活动"`
  17. }
  18. type CygxSearchKeyWordLogRep struct {
  19. KeyWord string `description:"搜索关键词"`
  20. }
  21. //新增搜索
  22. func AddSearchKeyWordLog(item *CygxSearchKeyWordLog) (lastId int64, err error) {
  23. o := orm.NewOrm()
  24. lastId, err = o.Insert(item)
  25. return
  26. }
  27. //修改用户搜索的相关信息
  28. func UpdateCygxSearchKeyWordLog(wxUser *WxUserItem) (err error) {
  29. o := orm.NewOrm()
  30. var sql string
  31. if wxUser.Mobile != "" {
  32. sql = `UPDATE cygx_search_key_word SET email=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE mobile=? `
  33. _, err = o.Raw(sql, wxUser.Email, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Mobile).Exec()
  34. } else if wxUser.Email != "" {
  35. sql = `UPDATE cygx_search_key_word SET mobile=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE email=? `
  36. _, err = o.Raw(sql, wxUser.Mobile, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Email).Exec()
  37. }
  38. return
  39. }