- 在发送微信消息的时,发送打印机语音消息
This commit is contained in:
@@ -348,7 +348,6 @@ func (s *DefScheduler) OnOrderStatusChanged(order *model.GoodsOrder, status *mod
|
||||
if status.Status == model.OrderStatusApplyCancel {
|
||||
utils.CallFuncAsync(func() {
|
||||
weixinmsg.NotifyUserApplyCancel(savedOrderInfo.order, status.Remark)
|
||||
netprinter.NofityOrderStatus(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, netprinter.PrinterNotifyUserApplyCancel)
|
||||
})
|
||||
}
|
||||
msghub.OnKeyOrderStatusChanged(savedOrderInfo.order)
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package defsch
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/msghub"
|
||||
@@ -14,7 +11,6 @@ func (s *DefScheduler) OnAfsOrderNew(order *model.AfsOrder, isPending bool) (err
|
||||
if !isPending {
|
||||
msghub.OnNewWait4ApproveAfsOrder(order)
|
||||
weixinmsg.NotifyAfsOrderStatus(order)
|
||||
netprinter.NofityOrderStatus(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromAfsOrder(order), order.VendorOrderID, netprinter.PrinterNotifyNewAfsOrder)
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -211,7 +214,7 @@ func NotifyNewOrder(order *model.GoodsOrder) (err error) {
|
||||
return SendMsgToStore(storeID, WX_NEWORDER_TEMPLATE_ID, globals.WxBackstageHost+fmt.Sprintf("%s%d", WX_TO_ORDER_PAGE_URL, storeID), WX_MINI_TO_ORDER_PAGE_URL, data)
|
||||
}
|
||||
|
||||
func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder, isBillAlreadyCandidate bool) error {
|
||||
func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder, isBillAlreadyCandidate bool) (err error) {
|
||||
globals.SugarLogger.Debugf("NotifyWaybillStatus orderID:%s bill:%v", order.VendorOrderID, bill)
|
||||
if order.VendorID == model.VendorIDELM {
|
||||
return nil
|
||||
@@ -272,9 +275,10 @@ func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder, isBillAlr
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
}
|
||||
return SendMsgToStore(jxutils.GetSaleStoreIDFromOrder(order), templateID, "", "", data)
|
||||
err = SendMsgToStore(jxutils.GetSaleStoreIDFromOrder(order), templateID, "", "", data)
|
||||
netprinter.NofityOrderMsg(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, title)
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err error) {
|
||||
@@ -287,9 +291,10 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er
|
||||
globals.SugarLogger.Infof("NotifyUserApplyCancel orderID:%s is not solid", order.VendorOrderID)
|
||||
return nil
|
||||
}
|
||||
title := "老板,您有订单申请取消!请及时联系客户处理!"
|
||||
data := map[string]interface{}{
|
||||
"first": map[string]interface{}{
|
||||
"value": "老板,您有订单申请取消!请及时联系客户处理!",
|
||||
"value": title,
|
||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword1": map[string]interface{}{
|
||||
@@ -310,8 +315,9 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er
|
||||
},
|
||||
}
|
||||
storeID := jxutils.GetSaleStoreIDFromOrder(order)
|
||||
return SendMsgToStore(storeID, WX_ORDER_CANCLED_TEMPLATE_ID, "", "", data)
|
||||
|
||||
err = SendMsgToStore(storeID, WX_ORDER_CANCLED_TEMPLATE_ID, "", "", data)
|
||||
netprinter.NofityOrderMsg(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, title)
|
||||
return err
|
||||
}
|
||||
|
||||
func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments) (err error) {
|
||||
@@ -323,10 +329,10 @@ func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments) (err error) {
|
||||
sb.WriteString(")的一条")
|
||||
sb.WriteString(utils.Int2Str(comment.Score))
|
||||
sb.WriteString("星差评,请商家在1小时内及时联系客户处理!")
|
||||
|
||||
title := sb.String()
|
||||
data := map[string]interface{}{
|
||||
"first": map[string]interface{}{
|
||||
"value": sb.String(),
|
||||
"value": title,
|
||||
"color": WX_HIGHLEVEL_TEMPLATE_COLOR,
|
||||
},
|
||||
"keyword1": map[string]interface{}{
|
||||
@@ -343,7 +349,9 @@ func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments) (err error) {
|
||||
},
|
||||
}
|
||||
storeID := int(utils.Str2Int64(comment.Jxstoreid))
|
||||
return SendMsgToStore(storeID, WX_BAD_COMMENT_PUSH_TEMPLATE_ID, globals.WxBackstageHost+fmt.Sprintf("%s%d", WX_TO_SHOW_COMMENTS_DETAIL_URL, storeID), WX_MINI_TO_SHOW_COMMENTS_DETAIL_URL, data)
|
||||
err = SendMsgToStore(storeID, WX_BAD_COMMENT_PUSH_TEMPLATE_ID, globals.WxBackstageHost+fmt.Sprintf("%s%d", WX_TO_SHOW_COMMENTS_DETAIL_URL, storeID), WX_MINI_TO_SHOW_COMMENTS_DETAIL_URL, data)
|
||||
netprinter.NofityOrderMsg(jxcontext.AdminCtx, int(utils.Str2Int64(comment.Jxstoreid)), comment.OrderId, title)
|
||||
return err
|
||||
}
|
||||
|
||||
func NotifySaleBill(storeID int, title, shopName, fileURL string) (err error) {
|
||||
@@ -499,6 +507,7 @@ func NotifyAfsOrderStatus(afsOrder *model.AfsOrder) (err error) {
|
||||
}
|
||||
storeID := jxutils.GetSaleStoreIDFromAfsOrder(afsOrder)
|
||||
err = SendMsgToStore(storeID, templateID, globals.WxBackstageHost+fmt.Sprintf("%s%d", WX_TO_ORDER_PAGE_URL, storeID), WX_MINI_TO_ORDER_PAGE_URL, data)
|
||||
netprinter.NofityOrderMsg(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromAfsOrder(afsOrder), afsOrder.VendorOrderID, comment)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user