Browse Source

修改bug

yjp 1 year ago
parent
commit
01be5fd70c

+ 0 - 0
convenient/binding/request/dto.go → convenient/binding/request/params.go


+ 0 - 0
convenient/binding/request/dto_func.go → convenient/binding/request/params_bind_func.go


+ 14 - 8
framwork/infrastructure/database/sql/result.go

@@ -99,14 +99,20 @@ func (result Result) ColumnValueStringAsTime(columnName string) time.Time {
 		return time.Time{}
 	}
 
-	var layout string
-
-	if strings.HasSuffix(value, ".000000+08:00") {
-		layout = resultTimeMicroFormat
-	} else if strings.HasSuffix(value, ".000+08:00") {
-		layout = resultTimeMilliFormat
-	} else {
-		layout = resultTimeSecFormat
+	layout := resultTimeSecFormat
+
+	timeZoneIndex := strings.LastIndex(value, "+08:")
+	if timeZoneIndex != -1 {
+		value = value[:timeZoneIndex]
+
+		afterSecondIndex := strings.LastIndex(value, ".")
+		if afterSecondIndex != -1 {
+			if len(value)-afterSecondIndex-1 == 6 {
+				layout = resultTimeMicroFormat
+			} else if len(value)-afterSecondIndex-1 == 3 {
+				layout = resultTimeMilliFormat
+			}
+		}
 	}
 
 	t, err := time.ParseInLocation(layout, value, time.Local)