search_key_word.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // SearchKeyWord 搜索关键词
  7. type SearchKeyWord struct {
  8. SearchKeyWordId int `orm:"column(search_key_word_id)" description:"主键ID"`
  9. KeyWord string `description:"关键词"`
  10. From string `description:"来源,在什么地方筛选"`
  11. CreatedTime time.Time `description:"创建时间"`
  12. LastUpdatedTime time.Time `description:"更新时间"`
  13. TeleconferenceImage string `description:"电话会对应的类型图片"`
  14. BannerImage string `description:"Banner图"`
  15. }
  16. // AddTrendTagKeyWord 新增趋势标签关键词
  17. func AddTrendTagKeyWord(trend string) (err error) {
  18. o := orm.NewOrm()
  19. sql := " REPLACE INTO search_key_word (`key_word`,`from`) values (?,'trend') "
  20. _, err = o.Raw(sql, trend).Exec()
  21. return
  22. }
  23. // GetKeyWordListByFrom 根据来源获取搜索关键词列表
  24. func GetKeyWordListByFrom(from string) (list []*SearchKeyWord, err error) {
  25. o := orm.NewOrm()
  26. sql := " SELECT * FROM search_key_word WHERE `from` = ? ORDER BY created_time ASC "
  27. _, err = o.Raw(sql, from).QueryRows(&list)
  28. return
  29. }