- 在发送微信消息的时,发送打印机语音消息
This commit is contained in:
@@ -348,7 +348,6 @@ func (s *DefScheduler) OnOrderStatusChanged(order *model.GoodsOrder, status *mod
|
|||||||
if status.Status == model.OrderStatusApplyCancel {
|
if status.Status == model.OrderStatusApplyCancel {
|
||||||
utils.CallFuncAsync(func() {
|
utils.CallFuncAsync(func() {
|
||||||
weixinmsg.NotifyUserApplyCancel(savedOrderInfo.order, status.Remark)
|
weixinmsg.NotifyUserApplyCancel(savedOrderInfo.order, status.Remark)
|
||||||
netprinter.NofityOrderStatus(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, netprinter.PrinterNotifyUserApplyCancel)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
msghub.OnKeyOrderStatusChanged(savedOrderInfo.order)
|
msghub.OnKeyOrderStatusChanged(savedOrderInfo.order)
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package defsch
|
package defsch
|
||||||
|
|
||||||
import (
|
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/jxutils/weixinmsg"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/msghub"
|
"git.rosy.net.cn/jx-callback/business/msghub"
|
||||||
@@ -14,7 +11,6 @@ func (s *DefScheduler) OnAfsOrderNew(order *model.AfsOrder, isPending bool) (err
|
|||||||
if !isPending {
|
if !isPending {
|
||||||
msghub.OnNewWait4ApproveAfsOrder(order)
|
msghub.OnNewWait4ApproveAfsOrder(order)
|
||||||
weixinmsg.NotifyAfsOrderStatus(order)
|
weixinmsg.NotifyAfsOrderStatus(order)
|
||||||
netprinter.NofityOrderStatus(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromAfsOrder(order), order.VendorOrderID, netprinter.PrinterNotifyNewAfsOrder)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package netprinter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||||
@@ -27,13 +28,6 @@ const (
|
|||||||
PrinterNotifyNewAfsOrder = 2
|
PrinterNotifyNewAfsOrder = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
printerMsgMap = map[int]string{
|
|
||||||
PrinterNotifyUserApplyCancel: "用户申请取消订单请注意查看",
|
|
||||||
PrinterNotifyNewAfsOrder: "收到新的售后单请查看",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func PrintOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (printResult *partner.PrinterStatus, err error) {
|
func PrintOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (printResult *partner.PrinterStatus, err error) {
|
||||||
storeID := vendorID
|
storeID := vendorID
|
||||||
if vendorOrderID == testVendorOrderID {
|
if vendorOrderID == testVendorOrderID {
|
||||||
@@ -195,8 +189,9 @@ func RebindAllPrinters(ctx *jxcontext.Context, isForce, isAsync bool) (hint stri
|
|||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func NofityOrderStatus(ctx *jxcontext.Context, storeID int, orderID string, notifyID int) (err error) {
|
func NofityOrderMsg(ctx *jxcontext.Context, storeID int, orderID, notifyMsg string) (err error) {
|
||||||
if printerMsgMap[notifyID] != "" {
|
if notifyMsg != "" {
|
||||||
|
notifyMsg = strings.ReplaceAll(notifyMsg, ",", "")
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
store := &model.Store{}
|
store := &model.Store{}
|
||||||
store.ID = storeID
|
store.ID = storeID
|
||||||
@@ -204,7 +199,7 @@ func NofityOrderStatus(ctx *jxcontext.Context, storeID int, orderID string, noti
|
|||||||
handler, err := GetHandlerFromStore(store)
|
handler, err := GetHandlerFromStore(store)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if globals.EnableStoreWrite {
|
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"
|
"strings"
|
||||||
"time"
|
"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/jx-callback/business/partner"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"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)
|
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)
|
globals.SugarLogger.Debugf("NotifyWaybillStatus orderID:%s bill:%v", order.VendorOrderID, bill)
|
||||||
if order.VendorID == model.VendorIDELM {
|
if order.VendorID == model.VendorIDELM {
|
||||||
return nil
|
return nil
|
||||||
@@ -272,9 +275,10 @@ func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder, isBillAlr
|
|||||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
"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) {
|
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)
|
globals.SugarLogger.Infof("NotifyUserApplyCancel orderID:%s is not solid", order.VendorOrderID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
title := "老板,您有订单申请取消!请及时联系客户处理!"
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"first": map[string]interface{}{
|
"first": map[string]interface{}{
|
||||||
"value": "老板,您有订单申请取消!请及时联系客户处理!",
|
"value": title,
|
||||||
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
"color": WX_NEW_ORDER_TEMPLATE_COLOR,
|
||||||
},
|
},
|
||||||
"keyword1": map[string]interface{}{
|
"keyword1": map[string]interface{}{
|
||||||
@@ -310,8 +315,9 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
storeID := jxutils.GetSaleStoreIDFromOrder(order)
|
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) {
|
func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments) (err error) {
|
||||||
@@ -323,10 +329,10 @@ func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments) (err error) {
|
|||||||
sb.WriteString(")的一条")
|
sb.WriteString(")的一条")
|
||||||
sb.WriteString(utils.Int2Str(comment.Score))
|
sb.WriteString(utils.Int2Str(comment.Score))
|
||||||
sb.WriteString("星差评,请商家在1小时内及时联系客户处理!")
|
sb.WriteString("星差评,请商家在1小时内及时联系客户处理!")
|
||||||
|
title := sb.String()
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"first": map[string]interface{}{
|
"first": map[string]interface{}{
|
||||||
"value": sb.String(),
|
"value": title,
|
||||||
"color": WX_HIGHLEVEL_TEMPLATE_COLOR,
|
"color": WX_HIGHLEVEL_TEMPLATE_COLOR,
|
||||||
},
|
},
|
||||||
"keyword1": map[string]interface{}{
|
"keyword1": map[string]interface{}{
|
||||||
@@ -343,7 +349,9 @@ func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments) (err error) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
storeID := int(utils.Str2Int64(comment.Jxstoreid))
|
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) {
|
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)
|
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)
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user