- 在发送微信消息的时,发送打印机语音消息

This commit is contained in:
gazebo
2019-07-22 16:28:40 +08:00
parent 8406359a7c
commit eab2c1045f
4 changed files with 23 additions and 24 deletions

View File

@@ -2,6 +2,7 @@ package netprinter
import (
"fmt"
"strings"
"time"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
@@ -27,13 +28,6 @@ const (
PrinterNotifyNewAfsOrder = 2
)
var (
printerMsgMap = map[int]string{
PrinterNotifyUserApplyCancel: "用户申请取消订单请注意查看",
PrinterNotifyNewAfsOrder: "收到新的售后单请查看",
}
)
func PrintOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (printResult *partner.PrinterStatus, err error) {
storeID := vendorID
if vendorOrderID == testVendorOrderID {
@@ -195,8 +189,9 @@ func RebindAllPrinters(ctx *jxcontext.Context, isForce, isAsync bool) (hint stri
return hint, err
}
func NofityOrderStatus(ctx *jxcontext.Context, storeID int, orderID string, notifyID int) (err error) {
if printerMsgMap[notifyID] != "" {
func NofityOrderMsg(ctx *jxcontext.Context, storeID int, orderID, notifyMsg string) (err error) {
if notifyMsg != "" {
notifyMsg = strings.ReplaceAll(notifyMsg, ",", "")
db := dao.GetDB()
store := &model.Store{}
store.ID = storeID
@@ -204,7 +199,7 @@ func NofityOrderStatus(ctx *jxcontext.Context, storeID int, orderID string, noti
handler, err := GetHandlerFromStore(store)
if err == nil {
if globals.EnableStoreWrite {
_, err = handler.PlayText(ctx, store.PrinterSN, store.PrinterKey, orderID, printerMsgMap[notifyID])
_, err = handler.PlayText(ctx, store.PrinterSN, store.PrinterKey, orderID, notifyMsg)
}
}
}