12345678910111213141516171819202122232425262728 |
- package models
- import (
- "rdluck_tools/orm"
- "time"
- )
- type CygxSearchKeyWord struct {
- Id int `orm:"column(id);" description:"id"`
- KeyWord string
- UserId int
- CreateTime time.Time
- }
- //新增文章
- func AddSearchKeyWord(item *CygxSearchKeyWord) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- //获取用户搜索这个关键词的最新时间
- func GetNewSearchKeyWordByThisUser(uid int, keyWord string) (item *CygxSearchKeyWord, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_search_key_word WHERE user_id = ? AND key_word = ? ORDER BY id DESC LIMIT 1 `
- err = o.Raw(sql, uid, keyWord).QueryRow(&item)
- return
- }
|