no message
parent
0c8de11e3e
commit
c11a88e9f2
|
@ -1,5 +1,7 @@
|
|||
package model
|
||||
|
||||
import "background/utils"
|
||||
|
||||
// Book sss
|
||||
type Book struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;default:0" sql:"id" json:"id"`
|
||||
|
|
|
@ -3,6 +3,7 @@ package utils
|
|||
import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
@ -18,7 +19,8 @@ func (t OrmTime) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
//JSON中解析到程序中
|
||||
func (t *OrmTime) UnmarshalJSON(data []byte) (err error) {
|
||||
now, err := time.ParseInLocation(`"`+"2006-01-02 15:04:05"+`"`, string(data), time.Local)
|
||||
log.Print(string(data))
|
||||
now, err := time.ParseInLocation(`"2006-01-02 15:04:05"`, string(data), time.Local)
|
||||
*t = OrmTime{Time: now}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue