123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- 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"`
- }
- type SapApiLog struct {
- ID int `gorm:"column:id" `
- Flag int `gorm:"column:flag"`
- Name string `gorm:"column:name"`
- Request string `gorm:"column:request"`
- Response string `gorm:"column:response"`
- 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"`
- }
- 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
- }
|