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