From 1db60a0e4fee569b9cba5fc1a59f7616fbaf6e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Tue, 27 Jun 2023 16:48:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(topup):=E4=BF=AE=E5=A4=8D=E5=95=86=E6=88=B7?= =?UTF-8?q?=E5=85=85=E5=80=BC=E4=B8=AD=E7=9A=84=E8=87=AA=E5=8A=A8=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E5=AF=B9=E5=BA=94=E5=85=B3=E7=B3=BB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/top_up.go | 4 +++- vo/top_up.go | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/controller/top_up.go b/controller/top_up.go index 092d62a..60bd017 100644 --- a/controller/top_up.go +++ b/controller/top_up.go @@ -51,8 +51,10 @@ func listTopUps(c *fiber.Ctx) error { topUpLog.Error("查询符合条件的商户充值记录,查询失败", zap.Error(err)) return result.Error(fiber.StatusInternalServerError, "商户充值记录查询不成功") } - var topUpDetails []*vo.TopUpDetailQueryResponse + topUpLog.Debug("检查获取到的数据", zap.Any("topUps", topUps), zap.Int64("total", total)) + topUpDetails := make([]*vo.TopUpDetailQueryResponse, 0) copier.Copy(&topUpDetails, &topUps) + topUpLog.Debug("检查转换后的数据", zap.Any("topUpDetails", topUpDetails)) return result.Success( "已经获取到符合条件的商户充值记录", response.NewPagedResponse(page, total).ToMap(), diff --git a/vo/top_up.go b/vo/top_up.go index c1c8f39..5138de3 100644 --- a/vo/top_up.go +++ b/vo/top_up.go @@ -1,6 +1,10 @@ package vo -import "github.com/shopspring/decimal" +import ( + "electricity_bill_calc/types" + + "github.com/shopspring/decimal" +) type TopUpCreationForm struct { Tenement string `json:"tenement"` @@ -9,12 +13,12 @@ type TopUpCreationForm struct { } type TopUpDetailQueryResponse struct { - Id string `json:"id" copier:"topUpCode"` + Id string `json:"id" copier:"TopUpCode"` Tenement string `json:"tenement"` TenementName string `json:"tenementName"` Meter string `json:"meter"` MeterAddress string `json:"meterAddress"` - ToppedUpAt string `json:"toppedUpAt"` + ToppedUpAt types.DateTime `json:"toppedUpAt"` Amount decimal.Decimal `json:"amount"` PaymentType int16 `json:"paymentType"` SyncStatus int16 `json:"syncStatus" copier:"SyncStatus"`