- 对于外卖管家打印机ESCAPE *
This commit is contained in:
@@ -89,7 +89,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
|
|||||||
`
|
`
|
||||||
// <QR>http://weixin.qq.com/r/tkkDGzTERmk5rXB49xyk</QR>
|
// <QR>http://weixin.qq.com/r/tkkDGzTERmk5rXB49xyk</QR>
|
||||||
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, order.StoreName, storeTel)
|
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, order.StoreName, storeTel)
|
||||||
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...)
|
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), escapeString4Printer(orderParams)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PrinterHandler) GetVendorID() int {
|
func (c *PrinterHandler) GetVendorID() int {
|
||||||
@@ -148,3 +148,12 @@ func (c *PrinterHandler) UnregisterPrinter(ctx *jxcontext.Context, printerNumber
|
|||||||
err = api.XiaoWMAPI.DelPrinter(printerNumber, printerToken)
|
err = api.XiaoWMAPI.DelPrinter(printerNumber, printerToken)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func escapeString4Printer(params []interface{}) []interface{} {
|
||||||
|
for k, v := range params {
|
||||||
|
if vStr, ok := v.(string); ok {
|
||||||
|
params[k] = strings.Replace(vStr, "*", "\\*", -1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user