From 34600c43073b6f19d848404a01e34f570c2d1c07 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 6 Dec 2024 09:30:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=89=93=E5=8D=B03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/service/export.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/service/export.go b/api/service/export.go index 38b79aa..2870f13 100644 --- a/api/service/export.go +++ b/api/service/export.go @@ -1,6 +1,7 @@ package service import ( + "encoding/json" "fmt" "github.com/shopspring/decimal" "hospital-admin-api/api/dao" @@ -1656,7 +1657,14 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) { dataSlice = append(dataSlice, data) } - utils.LogJsonInfo("打印数据:", dataSlice) + // 转为 JSON + jsonData, err := json.Marshal(dataSlice) + if err != nil { + fmt.Println("Error converting to JSON:", err) + return "", err + } + + utils.LogJsonInfo("打印数据:", string(jsonData)) file, err := utils.Export(header, dataSlice) if err != nil {