diff --git a/api/service/export.go b/api/service/export.go index 93a8878..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,6 +1657,15 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) { dataSlice = append(dataSlice, data) } + // 转为 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 { return "", err