package model import ( "time" "kpt.xdmy/pkg/util" ) type SapLog struct { ID int `gorm:"column:id" ` Flag int `gorm:"column:Flag"` SysName string `gorm:"column:SysName"` Name string `gorm:"column:Name"` Url string `gorm:"column:Url"` Status string `gorm:"column:Status"` MsgText string `gorm:"column:MsgText"` Param string `gorm:"column:Param"` CreatedAt time.Time `gorm:"column:Created_At"` } type SapDetailLog struct { ID int `gorm:"column:id " ` Name string `gorm:"column:name"` Code string `gorm:"column:code"` ErrorText string `gorm:"column:error_text"` CreatedAt time.Time `gorm:"column:created_at"` } func SapLogTime(name string) time.Time { sql := "select created_at from saplog where name=@name and flag=1 order by id desc limit 1" c := util.NewMap("name", name) var t time.Time d.Raw(sql, c, &t) if t.IsZero() { return time.Now().Add(-24 * time.Hour) } return t }