From 89b37a73c42ff56d418c23c3eddc6544a437e1ee Mon Sep 17 00:00:00 2001 From: wolter Date: Wed, 21 Aug 2024 15:19:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=EF=BC=9A=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/entities/backend/app.go | 9 ++++++++- app/http/entities/backend/merchant.go | 5 ++++- app/http/entities/backend/order.go | 20 +++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/http/entities/backend/app.go b/app/http/entities/backend/app.go index b3b1939..e4652f6 100644 --- a/app/http/entities/backend/app.go +++ b/app/http/entities/backend/app.go @@ -25,6 +25,7 @@ type AppResponse struct { PrivateKey string `json:"private_key"` MerchantPublicKey string `json:"merchant_public_key"` CreateTime string `json:"create_time"` + UpdateTime string `json:"update_time"` WhiteIp string `json:"white_ip"` NotifyUrl string `json:"notify_url"` } @@ -39,7 +40,13 @@ func (a *AppResponse) ResponseFromDb(db appmodel.App) { a.PublicKey = db.PublicKey a.PrivateKey = db.PrivateKey a.MerchantPublicKey = db.MerchantPublicKey - a.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + if !db.CreateTime.IsZero() { + a.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + } + if !db.UpdateTime.IsZero() { + a.UpdateTime = db.UpdateTime.Format("2006-01-02 15:04:05") + } + a.WhiteIp = db.WhiteIp a.NotifyUrl = db.NotifyUrl } diff --git a/app/http/entities/backend/merchant.go b/app/http/entities/backend/merchant.go index 5ad7883..5eb285a 100644 --- a/app/http/entities/backend/merchant.go +++ b/app/http/entities/backend/merchant.go @@ -28,7 +28,10 @@ func (m *MerchantResponse) ResponseFromDb(db merchantmodel.Merchant) { m.Contact = db.Contact m.Phone = db.Phone m.Remark = db.Remark - m.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + if !db.CreateTime.IsZero() { + m.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + } + } type MerchantCreateRequest struct { diff --git a/app/http/entities/backend/order.go b/app/http/entities/backend/order.go index 64a479f..c06c0e5 100644 --- a/app/http/entities/backend/order.go +++ b/app/http/entities/backend/order.go @@ -94,8 +94,12 @@ func (o *OrdersResponse) ResponseFromDb(db ordersmodel.OrdersBackendList) { o.Amount = db.Amount o.PayerTotal = db.PayerTotal o.ExtJson = db.ExtJson - o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") - o.UpdateTime = db.UpdateTime.Format("2006-01-02 15:04:05") + if !db.CreateTime.IsZero() { + o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + } + if !db.UpdateTime.IsZero() { + o.UpdateTime = db.UpdateTime.Format("2006-01-02 15:04:05") + } o.MerchantName = db.MerchantName o.PayName = db.PayName o.AppName = db.AppName @@ -130,7 +134,9 @@ func (o *OrderRequestLogResponse) ResponseFromDb(db orderrequestlogmodel.OrderRe o.Status = db.Status o.MerchantRequest = db.MerchantRequest o.MerchantResponse = db.MerchantResponse - o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + if !db.CreateTime.IsZero() { + o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + } } type OrderThirdLogResponse struct { @@ -151,7 +157,9 @@ func (o *OrderThirdLogResponse) ResponseFromDb(db orderthirdpaylogmodel.OrderThi o.Status = db.Status o.PayParam = db.PayParam o.MerchantCallback = db.MerchantCallback - o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + if !db.CreateTime.IsZero() { + o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + } } type OrderCallbackLogResponse struct { @@ -169,5 +177,7 @@ func (o *OrderCallbackLogResponse) ResponseFromDb(db ordercallbacklogmodel.Order o.MerchantRequest = db.MerchantRequest o.Status = db.Status o.MerchantResponse = db.MerchantResponse - o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + if !db.CreateTime.IsZero() { + o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + } }