search_key_word.go 1.6 KB

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