1
This commit is contained in:
@@ -825,9 +825,6 @@ func PrintMsg(ctx *jxcontext.Context, vendorID int, id1, id2, msgTitle, msgConte
|
|||||||
if handler == nil {
|
if handler == nil {
|
||||||
return nil, fmt.Errorf("打印机厂商:%d当前不被支持,请检查vendorID", vendorID)
|
return nil, fmt.Errorf("打印机厂商:%d当前不被支持,请检查vendorID", vendorID)
|
||||||
}
|
}
|
||||||
if vendorID == model.VendorIDXpYun {
|
|
||||||
id2 = "1" //id2传打印份数
|
|
||||||
}
|
|
||||||
return handler.PrintMsg(ctx, id1, id2, msgTitle, msgContent)
|
return handler.PrintMsg(ctx, id1, id2, msgTitle, msgContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,11 @@ func (c *PrinterHandler) GetVendorID() int {
|
|||||||
func (c *PrinterHandler) PrintMsg(ctx *jxcontext.Context, sn, copies, voiceType, 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 {
|
|
||||||
copies = "1"
|
|
||||||
}
|
|
||||||
globals.SugarLogger.Debugf("printMsg voiceType====%s", voiceType)
|
globals.SugarLogger.Debugf("printMsg voiceType====%s", voiceType)
|
||||||
printOrderID, err1 := api.XpyunAPI.Print(&xpyunapi.PrintRequest{
|
printOrderID, err1 := api.XpyunAPI.Print(&xpyunapi.PrintRequest{
|
||||||
Sn: sn,
|
Sn: sn,
|
||||||
Content: msgContent,
|
Content: msgContent,
|
||||||
Copies: utils.Str2Int(copies),
|
Copies: 1,
|
||||||
Voice: utils.Str2Int(voiceType),
|
Voice: utils.Str2Int(voiceType),
|
||||||
Mode: xpyunapi.ModeCheckYes,
|
Mode: xpyunapi.ModeCheckYes,
|
||||||
ExpiresIn: xpyunapi.ExpiresInDefault,
|
ExpiresIn: xpyunapi.ExpiresInDefault,
|
||||||
@@ -116,7 +113,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, utils.Int2Str(xpyunapi.VoicePlayOrder), content)
|
printerStatus, err := c.PrintMsg(ctx, store.PrinterSN, "1", 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
|
||||||
|
|||||||
Reference in New Issue
Block a user