- send different wx msg when mt changed courier

This commit is contained in:
gazebo
2018-12-17 11:53:12 +08:00
parent 215cdd9533
commit cae7c6d372
2 changed files with 12 additions and 5 deletions

View File

@@ -359,6 +359,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
case model.WaybillStatusAccepted:
s.resetTimer(savedOrderInfo, bill, isPending)
if !isPending {
isBillAlreadyCandidate := s.isBillCandidate(order, bill)
// todo 购买平台的运单优先级最高但这样写也可能带来问题即在这个时间因为之前3方已经接单已经发出了转自送请求而且可能成功了所以加个状态判断
if order.WaybillVendorID == model.VendorIDUnknown ||
(order.VendorID == bill.WaybillVendorID && order.VendorID != order.WaybillVendorID && (order.DeliveryFlag&model.OrderDeliveryFlagMaskPurcahseDisabled) == 0) {
@@ -381,7 +382,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
globals.SugarLogger.Infof("OnWaybillStatusChanged Accepted orderID:%s got multiple bill:%v", order.VendorOrderID, bill)
}
if s.isBillCandidate(order, bill) && order.WaybillVendorID != order.VendorID {
weixinmsg.NotifyWaybillStatus(bill, order)
weixinmsg.NotifyWaybillStatus(bill, order, isBillAlreadyCandidate)
}
}
case model.WaybillStatusAcceptCanceled:
@@ -461,7 +462,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
}
}
if !isPending {
weixinmsg.NotifyWaybillStatus(bill, order)
weixinmsg.NotifyWaybillStatus(bill, order, false)
}
case model.WaybillStatusNeverSend: // 平台不配送,直接创建三方运单
s.resetTimer(savedOrderInfo, bill, isPending)

View File

@@ -22,6 +22,7 @@ const (
//新订单模板消息文字颜色
WX_NEW_ORDER_TEMPLATE_COLOR = "#173177"
WX_HIGHLEVEL_TEMPLATE_COLOR = "#FF0000" //红色
WX_HIGHLEVEL_TEMPLATE_COLOR2 = "#333333" //黑色
WX_TEMPLATE_VENDERCOLOR_JDDJ = "#47B34F"
WX_TEMPLATE_VENDERCOLOR_MT = "#F4A800"
WX_TEMPLATE_VENDERCOLOR_ELM = "#0191EA" //蓝色
@@ -163,7 +164,7 @@ func NotifyNewOrder(order *model.GoodsOrder) (err error) {
return SendMsgToStore(storeID, WX_NEWORDER_TEMPLATE_ID, fmt.Sprintf("%s%d", WX_TO_ORDER_PAGE_URL, storeID), data)
}
func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder) error {
func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder, isBillAlreadyCandidate bool) error {
globals.SugarLogger.Debugf("NotifyWaybillStatus orderID:%s bill:%v", order.VendorOrderID, bill)
if order.VendorID == model.VendorIDELM {
return nil
@@ -184,9 +185,14 @@ func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder) error {
} else if bill.WaybillVendorID == model.VendorIDDada {
templateID = WX_DADA_DELIVERY_GRABDONE_TEMPLATE_ID
}
titleColor = WX_HIGHLEVEL_TEMPLATE_COLOR
remark = FormatDeliveryTime(order)
title = fmt.Sprintf("%s 第%d号订单长时间无人配送我们已安排%s配送员%s电话号码%s负责配送。^_^", model.VendorChineseNames[bill.OrderVendorID], order.OrderSeq, model.VendorChineseNames[bill.WaybillVendorID], bill.CourierName, bill.CourierMobile)
if isBillAlreadyCandidate {
titleColor = WX_HIGHLEVEL_TEMPLATE_COLOR
title = fmt.Sprintf("%s 第%d号订单由于之前安排的配送员长时间没有取货我们已重新安排%s配送员%s负责配送。^_^", model.VendorChineseNames[bill.OrderVendorID], order.OrderSeq, model.VendorChineseNames[bill.WaybillVendorID], bill.CourierName)
} else {
titleColor = WX_HIGHLEVEL_TEMPLATE_COLOR2
title = fmt.Sprintf("%s 第%d号订单长时间无人配送我们已安排%s配送员%s负责配送。^_^", model.VendorChineseNames[bill.OrderVendorID], order.OrderSeq, model.VendorChineseNames[bill.WaybillVendorID], bill.CourierName)
}
case model.WaybillStatusDelivered:
if bill.WaybillVendorID == model.VendorIDMTPS {
templateID = WX_MTPS_DELIVERY_DONE_TEMPLATE_ID