Explorar o código

设置null时间值为1970-01-01

huangrf %!s(int64=5) %!d(string=hai) anos
pai
achega
2e97f84486
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      models/LocalTime.go

+ 2 - 2
models/LocalTime.go

@@ -13,7 +13,7 @@ func init() {
 
 const (
 	timeFormat = "2006-01-02 15:04:05"
-	zeroTime   = "0001-01-01 00:00:00"
+	zeroTime   = "1970-01-01 00:00:00"
 )
 
 func NowLocal() LocalTime {
@@ -42,7 +42,7 @@ func (t *LocalTime) UnmarshalJSON(data []byte) error {
 
 	if len(dataStr) > 19 {
 		dataStr = dataStr[0:19]
-		if dataStr == "0001-01-01 00:00:00" {
+		if dataStr == "1970-01-01 00:00:00" {
 			dataStr = timeFormat
 		}
 	} else if len(dataStr) == 10 {