- send different wx msg when mt changed courier
This commit is contained in:
@@ -359,6 +359,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
|||||||
case model.WaybillStatusAccepted:
|
case model.WaybillStatusAccepted:
|
||||||
s.resetTimer(savedOrderInfo, bill, isPending)
|
s.resetTimer(savedOrderInfo, bill, isPending)
|
||||||
if !isPending {
|
if !isPending {
|
||||||
|
isBillAlreadyCandidate := s.isBillCandidate(order, bill)
|
||||||
// todo 购买平台的运单,优先级最高,但这样写也可能带来问题,即在这个时间,因为之前3方已经接单,已经发出了转自送请求(而且可能成功了),所以加个状态判断
|
// todo 购买平台的运单,优先级最高,但这样写也可能带来问题,即在这个时间,因为之前3方已经接单,已经发出了转自送请求(而且可能成功了),所以加个状态判断
|
||||||
if order.WaybillVendorID == model.VendorIDUnknown ||
|
if order.WaybillVendorID == model.VendorIDUnknown ||
|
||||||
(order.VendorID == bill.WaybillVendorID && order.VendorID != order.WaybillVendorID && (order.DeliveryFlag&model.OrderDeliveryFlagMaskPurcahseDisabled) == 0) {
|
(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)
|
globals.SugarLogger.Infof("OnWaybillStatusChanged Accepted orderID:%s got multiple bill:%v", order.VendorOrderID, bill)
|
||||||
}
|
}
|
||||||
if s.isBillCandidate(order, bill) && order.WaybillVendorID != order.VendorID {
|
if s.isBillCandidate(order, bill) && order.WaybillVendorID != order.VendorID {
|
||||||
weixinmsg.NotifyWaybillStatus(bill, order)
|
weixinmsg.NotifyWaybillStatus(bill, order, isBillAlreadyCandidate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case model.WaybillStatusAcceptCanceled:
|
case model.WaybillStatusAcceptCanceled:
|
||||||
@@ -461,7 +462,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !isPending {
|
if !isPending {
|
||||||
weixinmsg.NotifyWaybillStatus(bill, order)
|
weixinmsg.NotifyWaybillStatus(bill, order, false)
|
||||||
}
|
}
|
||||||
case model.WaybillStatusNeverSend: // 平台不配送,直接创建三方运单
|
case model.WaybillStatusNeverSend: // 平台不配送,直接创建三方运单
|
||||||
s.resetTimer(savedOrderInfo, bill, isPending)
|
s.resetTimer(savedOrderInfo, bill, isPending)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const (
|
|||||||
//新订单模板消息文字颜色
|
//新订单模板消息文字颜色
|
||||||
WX_NEW_ORDER_TEMPLATE_COLOR = "#173177"
|
WX_NEW_ORDER_TEMPLATE_COLOR = "#173177"
|
||||||
WX_HIGHLEVEL_TEMPLATE_COLOR = "#FF0000" //红色
|
WX_HIGHLEVEL_TEMPLATE_COLOR = "#FF0000" //红色
|
||||||
|
WX_HIGHLEVEL_TEMPLATE_COLOR2 = "#333333" //黑色
|
||||||
WX_TEMPLATE_VENDERCOLOR_JDDJ = "#47B34F"
|
WX_TEMPLATE_VENDERCOLOR_JDDJ = "#47B34F"
|
||||||
WX_TEMPLATE_VENDERCOLOR_MT = "#F4A800"
|
WX_TEMPLATE_VENDERCOLOR_MT = "#F4A800"
|
||||||
WX_TEMPLATE_VENDERCOLOR_ELM = "#0191EA" //蓝色
|
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)
|
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)
|
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
|
||||||
@@ -184,9 +185,14 @@ func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder) error {
|
|||||||
} else if bill.WaybillVendorID == model.VendorIDDada {
|
} else if bill.WaybillVendorID == model.VendorIDDada {
|
||||||
templateID = WX_DADA_DELIVERY_GRABDONE_TEMPLATE_ID
|
templateID = WX_DADA_DELIVERY_GRABDONE_TEMPLATE_ID
|
||||||
}
|
}
|
||||||
titleColor = WX_HIGHLEVEL_TEMPLATE_COLOR
|
|
||||||
remark = FormatDeliveryTime(order)
|
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:
|
case model.WaybillStatusDelivered:
|
||||||
if bill.WaybillVendorID == model.VendorIDMTPS {
|
if bill.WaybillVendorID == model.VendorIDMTPS {
|
||||||
templateID = WX_MTPS_DELIVERY_DONE_TEMPLATE_ID
|
templateID = WX_MTPS_DELIVERY_DONE_TEMPLATE_ID
|
||||||
|
|||||||
Reference in New Issue
Block a user