36 lines
926 B
Go
36 lines
926 B
Go
package models
|
|
|
|
import "kefu/types"
|
|
|
|
//上下线表
|
|
type UpDownLine struct {
|
|
ID uint `gorm:"primary_key" json:"id"`
|
|
EntId string `json:"ent_id"`
|
|
KefuName string `json:"kefu_name"`
|
|
ClientIp string `json:"client_ip"`
|
|
OnlineStatus uint `json:"online_status"`
|
|
CreatedAt types.Time `json:"created_at"`
|
|
}
|
|
|
|
func (a *UpDownLine) AddUpDownLine() uint {
|
|
DB.Create(a)
|
|
return a.ID
|
|
}
|
|
func CountUpDownLineWhere(query interface{}, args ...interface{}) uint {
|
|
var v uint
|
|
DB.Model(&UpDownLine{}).Where(query, args...).Count(&v)
|
|
return v
|
|
}
|
|
func FindUpDownLineByWhere(page uint, pagesize uint, query interface{}, args ...interface{}) []UpDownLine {
|
|
if page <= 0 {
|
|
page = 1
|
|
}
|
|
offset := (page - 1) * pagesize
|
|
if offset <= 0 {
|
|
offset = 0
|
|
}
|
|
var v []UpDownLine
|
|
DB.Model(&UpDownLine{}).Where(query, args...).Order("id desc").Offset(offset).Limit(pagesize).Find(&v)
|
|
return v
|
|
}
|