1 Star 0 Fork 708

兴博软件 / DocHub

forked from 进击的皇虫 / DocHub 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
SearchLogModel.go 759 Bytes
一键复制 编辑 原始数据 按行查看 历史
TruthHun 提交于 2018-08-09 22:49 . model层代码优化
package models
import "github.com/astaxie/beego/orm"
//搜索记录表
type SearchLog struct {
Id int `orm:"column(Id)"` //自增主键
Wd string `orm:"column(Wd);size(20);unique"` //用户搜索的关键字
}
func NewSearchLog() *SearchLog {
return &SearchLog{}
}
func GetTableSearchLog() string {
return getTable("search_log")
}
//获取最新的搜索关键字。这里的查询error可以忽略
//@param p 页面
//@param listRows 每页显示记录
//@return rows 查询到的记录
func (this *SearchLog) List(p, listRows int) (rows []SearchLog) {
orm.NewOrm().QueryTable(GetTableSearchLog()).Limit(listRows).Offset((p - 1) * listRows).OrderBy("-Id").All(&rows)
return
}
Go
1
https://gitee.com/lalbe/DocHub.git
git@gitee.com:lalbe/DocHub.git
lalbe
DocHub
DocHub
dd28a31bcdb3

搜索帮助