huangyh 6 rokov pred
rodič
commit
6ac9c6aa6e
2 zmenil súbory, kde vykonal 12 pridanie a 14 odobranie
  1. 4 6
      models/Local_date.go
  2. 8 8
      models/Local_datetime.go

+ 4 - 6
models/Local_date.go

@@ -9,8 +9,6 @@ import (
 	"fmt"
 	"strings"
 	"time"
-
-	"github.com/astaxie/beego/orm"
 )
 
 // datetime values like 2006-01-02 15:04:05
@@ -63,9 +61,9 @@ func (e *LocalDate) String() string {
 }
 
 // FieldType return enum type Date
-func (e *LocalDate) FieldType() int {
-	return orm.TypeDateField
-}
+//func (e *LocalDate) FieldType() int {
+//	return orm.TypeDateField
+//}
 
 // SetRaw convert the interface to time.Time. Allow string and time.Time
 func (e *LocalDate) SetRaw(value interface{}) error {
@@ -131,4 +129,4 @@ func (t LocalDate) MarshalJSON() ([]byte, error) {
 	return b, nil
 }
 
-var _ orm.Fielder = new(LocalDate)
+//var _ orm.Fielder = new(LocalDate)

+ 8 - 8
models/Local_datetime.go

@@ -9,8 +9,7 @@ import (
 	"fmt"
 	"strings"
 	"time"
-
-	"github.com/astaxie/beego/orm"
+	//	"github.com/astaxie/beego/orm"
 )
 
 // datetime values like 2006-01-02 15:04:05
@@ -54,9 +53,9 @@ func (e *LocalDateTime) String() string {
 }
 
 // FieldType return the enum TypeDateTimeField
-func (e *LocalDateTime) FieldType() int {
-	return orm.TypeDateTimeField
-}
+//func (e *LocalDateTime) FieldType() int {
+//	return orm.TypeDateTimeField
+//}
 
 // SetRaw convert the string or time.Time to DateTimeField
 func (e *LocalDateTime) SetRaw(value interface{}) error {
@@ -96,8 +95,9 @@ func (e *LocalDateTime) RawValue() interface{} {
 // parse time to string with location
 func timeParse(dateString, format string) (time.Time, error) {
 	// this
-	tp, err := time.ParseInLocation(format, dateString, orm.DefaultTimeLoc)
-	return tp, err
+	//tp, err := time.ParseInLocation(format, dateString, orm.DefaultTimeLoc)
+	//return tp, err
+	return time.Now(), nil
 }
 
 func (t *LocalDateTime) UnmarshalJSON(data []byte) (err error) {
@@ -158,4 +158,4 @@ func (t LocalDateTime) MarshalJSON() ([]byte, error) {
 	return b, nil
 }
 
-var _ orm.Fielder = new(LocalDateTime)
+//var _ orm.Fielder = new(LocalDateTime)