From ba5bc7d34ddd2215216c6376dc9c9778a2742875 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Mon, 20 Mar 2023 15:51:36 +0800 Subject: [PATCH] 1 --- business/partner/printer/xpyun/xpyun.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/business/partner/printer/xpyun/xpyun.go b/business/partner/printer/xpyun/xpyun.go index 4f9c13136..e79434097 100644 --- a/business/partner/printer/xpyun/xpyun.go +++ b/business/partner/printer/xpyun/xpyun.go @@ -31,7 +31,7 @@ func init() { func (c *PrinterHandler) GetVendorID() int { return model.VendorIDXpYun } -func (c *PrinterHandler) PrintMsg(ctx *jxcontext.Context, sn, copies, msgTitle, msgContent string) (printerStatus *partner.PrinterStatus, err error) { +func (c *PrinterHandler) PrintMsg(ctx *jxcontext.Context, sn, copies, voiceType, msgContent string) (printerStatus *partner.PrinterStatus, err error) { if sn != "" { if globals.EnableStoreWrite { if utils.Str2Int(copies) < 0 || utils.Str2Int(copies) > 3 { @@ -41,7 +41,7 @@ func (c *PrinterHandler) PrintMsg(ctx *jxcontext.Context, sn, copies, msgTitle, Sn: sn, Content: msgContent, Copies: utils.Str2Int(copies), - Voice: xpyunapi.VoicePlayOrder, + Voice: utils.Str2Int(voiceType), Mode: xpyunapi.ModeCheckYes, ExpiresIn: xpyunapi.ExpiresInDefault, }) @@ -115,7 +115,7 @@ func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, } count := 0 for { - printerStatus, err := c.PrintMsg(ctx, store.PrinterSN, store.PrinterKey, order.VendorOrderID, content) + printerStatus, err := c.PrintMsg(ctx, store.PrinterSN, store.PrinterKey, utils.Int2Str(xpyunapi.VoicePlayOrder), content) if (store.PrinterFontSize == partner.PrinterFontSizeBig2 || store.PrinterFontSize == partner.PrinterFontSizeNormal2) && count < 1 { count += 1 continue @@ -134,6 +134,12 @@ func (c *PrinterHandler) PrintCancelOrRefundOrder(ctx *jxcontext.Context, printT return } content := "" + voiceType := "" + if printType == model.YES { // 取消订单 + voiceType = utils.Int2Str(xpyunapi.VoiceCancelOrder) + } else { // 售后订单 + voiceType = utils.Int2Str(xpyunapi.VoiceUserChargeback) + } if store.PrinterFontSize == partner.PrinterFontSizeBig || store.PrinterFontSize == partner.PrinterFontSizeBig2 { content = c.getCancelOrRefundOrderContent(order, printType, storeDetail) } else { @@ -144,7 +150,7 @@ func (c *PrinterHandler) PrintCancelOrRefundOrder(ctx *jxcontext.Context, printT return nil, nil } - return c.PrintMsg(ctx, store.PrinterSN, store.PrinterKey, order.VendorOrderID, content) + return c.PrintMsg(ctx, store.PrinterSN, store.PrinterKey, voiceType, content) } func (c *PrinterHandler) EmptyPrintList(ctx *jxcontext.Context, sn, id2 string) (err error) {