search_key_word.go 1.4 KB

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