From 2fbcae626316f3cdbfa03a898aceff2d05991c04 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Tue, 19 Oct 2021 18:46:17 +0800 Subject: [PATCH] aa --- business/partner/printer/jxprint/jxprint.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/business/partner/printer/jxprint/jxprint.go b/business/partner/printer/jxprint/jxprint.go index 66535590b..8a6b4db0d 100644 --- a/business/partner/printer/jxprint/jxprint.go +++ b/business/partner/printer/jxprint/jxprint.go @@ -176,15 +176,11 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin } func (c *PrinterHandler) getOrderContentByTemplate(order *model.GoodsOrder, storeTel string, storeDetail *dao.StoreDetail) (content string) { - orderParams := []interface{}{} orderFmt := "" if storeDetail != nil { //开头加上语音 if storeDetail.PrinterSound != "" { - orderFmt += ` - %s
- ` - orderParams = append(orderParams, storeDetail.PrinterSound) + orderFmt += "" + storeDetail.PrinterSound + "
" } } //把带有${}的变量换成实际值 @@ -233,11 +229,12 @@ func (c *PrinterHandler) getOrderContentByTemplate(order *model.GoodsOrder, stor skuParams = append(skuParams, jxutils.IntPrice2StandardCurrencyString(order.Skus[i].SalePrice)) skuParams = append(skuParams, jxutils.IntPrice2StandardCurrencyString(order.Skus[i].SalePrice*int64(order.Skus[i].Count))) } - template = strings.ReplaceAll(template, v[0], fmt.Sprintf(skus, skuParams)) + skus = fmt.Sprintf(skus, skuParams...) + template = strings.ReplaceAll(template, v[0], skus) } } orderFmt += template - return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...) + return strings.Replace(orderFmt, "\n", "", -1) } func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, storeDetail *dao.StoreDetail, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {