From 460e591f215fe64d6a097ff4b1ee836d181298ac Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 11 八月 2023 16:12:38 +0800
Subject: [PATCH] fix

---
 api/v1/followRecord.go |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/api/v1/followRecord.go b/api/v1/followRecord.go
index fef5098..0960dcf 100644
--- a/api/v1/followRecord.go
+++ b/api/v1/followRecord.go
@@ -6,6 +6,7 @@
 	"aps_crm/model/response"
 	"aps_crm/pkg/contextx"
 	"aps_crm/pkg/ecode"
+	"errors"
 	"github.com/gin-gonic/gin"
 	"time"
 )
@@ -172,25 +173,37 @@
 
 // checkTimeFormat
 // 妫�鏌ユ椂闂存牸寮�
-func checkTimeFormat(t string) (*time.Time, error) {
+func checkTimeFormat(t string) (*model.CustomTime, error) {
+	if t == "" {
+		return nil, nil
+	}
+
 	location, err := time.LoadLocation("Asia/Shanghai")
 	if err != nil {
 		return nil, err
 	}
 
-	tt, err := time.Parse("2006-01-02T15:04:05.000Z", t)
+	tt, err := time.Parse("2006-01-02", t)
 	if err == nil {
 		ret := tt.In(location)
-		return &ret, nil
+		tmp := model.CustomTime(ret)
+		return &tmp, nil
 	}
 
-	tt, err = time.Parse("2006-01-02T15:04:05-07:00", t)
+	tt, err = time.Parse("2006-01-02 15:04:05", t)
 	if err == nil {
 		ret := tt.In(location)
-		return &ret, nil
+		tmp := model.CustomTime(ret)
+		return &tmp, nil
 	}
 
-	return nil, err
+	//tt, err = time.Parse("2006-01-02T15:04:05-07:00", t)
+	//if err == nil {
+	//	ret := tt.In(location)
+	//	return &ret, nil
+	//}
+
+	return nil, errors.New("invalid time format")
 }
 
 // List

--
Gitblit v1.8.0