- move NotifyNewOrder for OnOrderNew to handleAutoAcceptOrder(to avoid send auto rejected order)

This commit is contained in:
gazebo
2019-01-25 14:41:37 +08:00
parent 0af50522a1
commit a322256a44
2 changed files with 11 additions and 5 deletions

View File

@@ -74,6 +74,7 @@ func (c *BaseScheduler) PickupGoodsAndUpdateStatus(ctx *jxcontext.Context, vendo
}
func GetStoreDeliveryType(order *model.GoodsOrder, storeMap *model.StoreMap) (deliveryType int) {
globals.SugarLogger.Infof("GetStoreDeliveryType orderID:%s", order.VendorID)
jxStoreID := jxutils.GetSaleStoreIDFromOrder(order)
if storeMap == nil {
storeMap, _ = dao.FakeGetStoreMapByStoreID(nil, jxStoreID, order.VendorID)
@@ -89,5 +90,6 @@ func GetStoreDeliveryType(order *model.GoodsOrder, storeMap *model.StoreMap) (de
}
}
}
globals.SugarLogger.Infof("GetStoreDeliveryType orderID:%s, deliveryType:%d", order.VendorID, deliveryType)
return deliveryType
}

View File

@@ -138,6 +138,7 @@ func (s *WatchOrderInfo) updateOrderStoreFeature(order *model.GoodsOrder) (err e
if !isNeedSchedule {
order.DeliveryFlag |= model.OrderDeliveryFlagMaskScheduleDisabled
}
globals.SugarLogger.Debugf("updateOrderStoreFeature orderID:%s, s.storeDeliveryType:%d, order.DeliveryFlag:%d", order.VendorOrderID, order.DeliveryFlag)
}
return err
}
@@ -207,6 +208,9 @@ func init() {
mobile = order.ConsigneeMobile2
}
_ = sch.handleAutoAcceptOrder(order.VendorOrderID, order.VendorID, mobile, jxutils.GetSaleStoreIDFromOrder(order), nil, func(isAcceptIt bool) error {
if isAcceptIt {
weixinmsg.NotifyNewOrder(order)
}
if err = sch.AcceptOrRefuseOrder(order, isAcceptIt, ""); err != nil && err != scheduler.ErrOrderStatusAlreadySatisfyCurOperation {
// 为了解决京东新消息与接单消息乱序的问题
if errWithCode, ok := err.(*utils.ErrorWithCode); ok && errWithCode.Level() == 1 && errWithCode.IntCode() == -1 {
@@ -294,11 +298,11 @@ func (s *DefScheduler) OnOrderStatusChanged(status *model.OrderStatus, isPending
if status.LockStatus != model.OrderStatusUnknown || status.Status > model.OrderStatusUnknown {
globals.SugarLogger.Debugf("OnOrderStatusChanged orderID:%s %s, status:%v", status.VendorOrderID, model.OrderStatusName[status.Status], status)
savedOrderInfo := s.loadSavedOrderFromMap(status, true)
if status.Status == model.OrderStatusNew {
if !isPending {
weixinmsg.NotifyNewOrder(savedOrderInfo.order)
}
}
// if status.Status == model.OrderStatusNew {
// if !isPending {
// weixinmsg.NotifyNewOrder(savedOrderInfo.order)
// }
// }
s.updateOrderByStatus(savedOrderInfo.order, status)
if status.LockStatus == model.OrderStatusUnknown && status.Status > model.OrderStatusUnknown { // 只处理状态转换,一般消息不处理
s.resetTimer(savedOrderInfo, nil, isPending)