|
|
|
@ -1,7 +1,5 @@
|
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import "github.com/taoshihan1991/imaptool/config"
|
|
|
|
|
|
|
|
|
|
type Visitor struct {
|
|
|
|
|
Model
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
@ -39,13 +37,13 @@ func FindVisitorByVistorId(visitorId string)Visitor{
|
|
|
|
|
DB.Where("visitor_id = ?", visitorId).First(&v)
|
|
|
|
|
return v
|
|
|
|
|
}
|
|
|
|
|
func FindVisitors(page uint)[]Visitor{
|
|
|
|
|
offset:=(page-1)*config.PageSize
|
|
|
|
|
func FindVisitors(page uint,pagesize uint)[]Visitor{
|
|
|
|
|
offset:=(page-1)*pagesize
|
|
|
|
|
if offset<0{
|
|
|
|
|
offset=0
|
|
|
|
|
}
|
|
|
|
|
var visitors []Visitor
|
|
|
|
|
DB.Offset(offset).Limit(config.PageSize).Order("status desc, updated_at desc").Find(&visitors)
|
|
|
|
|
DB.Offset(offset).Limit(pagesize).Order("status desc, updated_at desc").Find(&visitors)
|
|
|
|
|
return visitors
|
|
|
|
|
}
|
|
|
|
|
func FindVisitorsOnline()[]Visitor{
|
|
|
|
|