This commit is contained in:
richboo111
2023-03-20 15:51:36 +08:00
parent 660ba5e09b
commit ba5bc7d34d

View File

@@ -31,7 +31,7 @@ func init() {
func (c *PrinterHandler) GetVendorID() int { func (c *PrinterHandler) GetVendorID() int {
return model.VendorIDXpYun 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 sn != "" {
if globals.EnableStoreWrite { if globals.EnableStoreWrite {
if utils.Str2Int(copies) < 0 || utils.Str2Int(copies) > 3 { 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, Sn: sn,
Content: msgContent, Content: msgContent,
Copies: utils.Str2Int(copies), Copies: utils.Str2Int(copies),
Voice: xpyunapi.VoicePlayOrder, Voice: utils.Str2Int(voiceType),
Mode: xpyunapi.ModeCheckYes, Mode: xpyunapi.ModeCheckYes,
ExpiresIn: xpyunapi.ExpiresInDefault, ExpiresIn: xpyunapi.ExpiresInDefault,
}) })
@@ -115,7 +115,7 @@ func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store,
} }
count := 0 count := 0
for { 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 { if (store.PrinterFontSize == partner.PrinterFontSizeBig2 || store.PrinterFontSize == partner.PrinterFontSizeNormal2) && count < 1 {
count += 1 count += 1
continue continue
@@ -134,6 +134,12 @@ func (c *PrinterHandler) PrintCancelOrRefundOrder(ctx *jxcontext.Context, printT
return return
} }
content := "" 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 { if store.PrinterFontSize == partner.PrinterFontSizeBig || store.PrinterFontSize == partner.PrinterFontSizeBig2 {
content = c.getCancelOrRefundOrderContent(order, printType, storeDetail) content = c.getCancelOrRefundOrderContent(order, printType, storeDetail)
} else { } else {
@@ -144,7 +150,7 @@ func (c *PrinterHandler) PrintCancelOrRefundOrder(ctx *jxcontext.Context, printT
return nil, nil 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) { func (c *PrinterHandler) EmptyPrintList(ctx *jxcontext.Context, sn, id2 string) (err error) {