From 839a4905337a92f43b8af23da11f439640b0d897 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 6 Dec 2024 09:06:50 +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=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/service/export.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/service/export.go b/api/service/export.go index 93a8878..c937298 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,6 +1657,15 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) { dataSlice = append(dataSlice, data) } + // 转为 JSON + jsonData, err := json.MarshalIndent(dataSlice, "", " ") + if err != nil { + fmt.Println("Error converting to JSON:", err) + return "", err + } + + utils.LogJsonInfo("打印数据:", jsonData) + file, err := utils.Export(header, dataSlice) if err != nil { return "", err