- refactor auto accept order, explicit refuse added.
This commit is contained in:
@@ -46,15 +46,15 @@ func (o *OrderController) OrderMessage(msg *elmapi.CallbackMsg) (retVal *elmapi.
|
||||
|
||||
return retVal
|
||||
}
|
||||
func (o *OrderController) acceptOrder(orderID string, userMobile string) {
|
||||
if controllers.IsAutoAcceptOrder(userMobile, nil) {
|
||||
globals2.ElmAPI.ConfirmOrder(orderID)
|
||||
if userMobile == "" {
|
||||
globals.SugarLogger.Infof("elm order:%v force accepted, because userMobile is empty", orderID)
|
||||
|
||||
func OnNewOrder(orderID string, userMobile string) {
|
||||
controllers.OnNewOrder(orderID, controllers.ELM_VENDERID, userMobile, 0, nil, func(acceptIt bool) {
|
||||
if acceptIt {
|
||||
globals2.ElmAPI.ConfirmOrder(orderID)
|
||||
} else {
|
||||
globals2.ElmAPI.CancelOrder(orderID, elmapi.CancelOrderTypeOthers, "")
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Infof("elm order:%v refused, userMobile:%s", orderID, userMobile)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (o *OrderController) NewOrder(msg *elmapi.CallbackMsg, orderId string, userMobile string) *elmapi.CallbackResponse {
|
||||
@@ -84,7 +84,7 @@ func (o *OrderController) NewOrder(msg *elmapi.CallbackMsg, orderId string, user
|
||||
globals.SugarLogger.Infof("duplicate elm msg received:%v", msg)
|
||||
}
|
||||
}
|
||||
o.acceptOrder(orderId, userMobile)
|
||||
OnNewOrder(orderId, userMobile)
|
||||
return retVal
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user