- 设置美团外卖的自动拣货时间为4分钟
This commit is contained in:
@@ -792,7 +792,6 @@ func (s *DefScheduler) handleAutoAcceptOrder(orderID string, vendorID int, userM
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *DefScheduler) mergeOrderStatusConfig(statusType, status int, purchaseVendorID int) (retVal *StatusActionConfig) {
|
func (s *DefScheduler) mergeOrderStatusConfig(statusType, status int, purchaseVendorID int) (retVal *StatusActionConfig) {
|
||||||
vendorTimeout := partner.GetPurchasePlatformFromVendorID(purchaseVendorID).GetStatusActionTimeout(statusType, status)
|
|
||||||
s.locker.RLock()
|
s.locker.RLock()
|
||||||
defer func() {
|
defer func() {
|
||||||
s.locker.RUnlock()
|
s.locker.RUnlock()
|
||||||
@@ -802,11 +801,12 @@ func (s *DefScheduler) mergeOrderStatusConfig(statusType, status int, purchaseVe
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
retVal = &StatusActionConfig{}
|
retVal = &StatusActionConfig{}
|
||||||
if defConfig != nil {
|
*retVal = *defConfig
|
||||||
*retVal = *defConfig
|
if vendorActionParams := partner.GetPurchasePlatformFromVendorID(purchaseVendorID).GetStatusActionTimeout(statusType, status); vendorActionParams != nil {
|
||||||
}
|
retVal.Timeout = vendorActionParams.Timeout
|
||||||
if vendorTimeout != 0 {
|
if vendorActionParams.TimeoutGap >= 0 {
|
||||||
retVal.Timeout = vendorTimeout
|
retVal.TimeoutGap = vendorActionParams.TimeoutGap
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return retVal
|
return retVal
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ const (
|
|||||||
CancelWaybillReasonOther = 10
|
CancelWaybillReasonOther = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type StatusActionParams struct {
|
||||||
|
Timeout time.Duration // 超时时间,0在GetStatusActionConfig返回时表示不修改缺省
|
||||||
|
TimeoutGap int // 以秒为单位的随机时间,0在GetStatusActionConfig返回时表示不修改缺省
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
CancelWaybillReasonStrNotAcceptIntime = "没有及时抢单"
|
CancelWaybillReasonStrNotAcceptIntime = "没有及时抢单"
|
||||||
CancelWaybillReasonStrSwitch2SelfFailed = "转自送失败"
|
CancelWaybillReasonStrSwitch2SelfFailed = "转自送失败"
|
||||||
@@ -69,7 +74,7 @@ type IPurchasePlatformHandler interface {
|
|||||||
GetStatusFromVendorStatus(vendorStatus string) int
|
GetStatusFromVendorStatus(vendorStatus string) int
|
||||||
Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder)
|
Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder)
|
||||||
GetOrder(vendorOrderID string) (order *model.GoodsOrder, err error)
|
GetOrder(vendorOrderID string) (order *model.GoodsOrder, err error)
|
||||||
GetStatusActionTimeout(statusType, status int) time.Duration
|
GetStatusActionTimeout(statusType, status int) (params *StatusActionParams)
|
||||||
|
|
||||||
AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error)
|
AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error)
|
||||||
PickupGoods(order *model.GoodsOrder, isSelfDeilivery bool, userName string) (err error)
|
PickupGoods(order *model.GoodsOrder, isSelfDeilivery bool, userName string) (err error)
|
||||||
@@ -147,8 +152,8 @@ type DeliveryPlatformHandlerInfo struct {
|
|||||||
type BasePurchasePlatform struct {
|
type BasePurchasePlatform struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *BasePurchasePlatform) GetStatusActionTimeout(statusType, status int) time.Duration {
|
func (p *BasePurchasePlatform) GetStatusActionTimeout(statusType, status int) (params *StatusActionParams) {
|
||||||
return 0
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -277,11 +277,13 @@ func (c *PurchaseHandler) callbackMsg2Status(msg *ebaiapi.CallbackMsg) (orderSta
|
|||||||
return orderStatus
|
return orderStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) GetStatusActionTimeout(statusType, status int) time.Duration {
|
func (c *PurchaseHandler) GetStatusActionTimeout(statusType, status int) (params *partner.StatusActionParams) {
|
||||||
if statusType == scheduler.TimerStatusTypeOrder && status == model.OrderStatusNew {
|
if statusType == scheduler.TimerStatusTypeOrder && status == model.OrderStatusNew {
|
||||||
return acceptOrderDelay // 饿百开了专送店的订单没有拣货状态,接单后就为拣货完成,所以要延迟接单,否则门店来不及备货
|
params = &partner.StatusActionParams{ // 饿百开了专送店的订单没有拣货状态,接单后就为拣货完成,所以要延迟接单,否则门店来不及备货
|
||||||
|
Timeout: acceptOrderDelay,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) getOrderStoreDeliveryType(order *model.GoodsOrder) (deliveryType int) {
|
func (c *PurchaseHandler) getOrderStoreDeliveryType(order *model.GoodsOrder) (deliveryType int) {
|
||||||
|
|||||||
@@ -317,11 +317,13 @@ func (c *PurchaseHandler) SelfDeliverDelievered(order *model.GoodsOrder, userNam
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) GetStatusActionTimeout(statusType, status int) time.Duration {
|
func (c *PurchaseHandler) GetStatusActionTimeout(statusType, status int) (params *partner.StatusActionParams) {
|
||||||
if statusType == scheduler.TimerStatusTypeOrder && status == model.OrderStatusNew {
|
if statusType == scheduler.TimerStatusTypeOrder && status == model.OrderStatusNew {
|
||||||
return acceptOrderDelay // 饿了么开了专送店的订单没有拣货状态,接单后就为拣货完成,所以要延迟接单,否则门店来不及备货
|
params = &partner.StatusActionParams{ // 饿了么开了专送店的订单没有拣货状态,接单后就为拣货完成,所以要延迟接单,否则门店来不及备货
|
||||||
|
Timeout: acceptOrderDelay,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) RefreshRealMobile(ctx *jxcontext.Context, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func (c *PurchaseHandler) RefreshRealMobile(ctx *jxcontext.Context, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"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/jxcontext"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
@@ -20,6 +21,11 @@ const (
|
|||||||
FakeMsgTypeOrderDelivering = "orderDelivering"
|
FakeMsgTypeOrderDelivering = "orderDelivering"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
pickupOrderDelay = 4 * time.Minute
|
||||||
|
pickupOrderGap = 20
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
VendorStatus2StatusMap = map[string]int{
|
VendorStatus2StatusMap = map[string]int{
|
||||||
mtwmapi.OrderStatusUserCommitted: model.OrderStatusUnknown,
|
mtwmapi.OrderStatusUserCommitted: model.OrderStatusUnknown,
|
||||||
@@ -259,3 +265,13 @@ func getTimeFromTimestamp(timeStamp int64) time.Time {
|
|||||||
func (c *PurchaseHandler) RefreshRealMobile(ctx *jxcontext.Context, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func (c *PurchaseHandler) RefreshRealMobile(ctx *jxcontext.Context, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *PurchaseHandler) GetStatusActionTimeout(statusType, status int) (params *partner.StatusActionParams) {
|
||||||
|
if statusType == scheduler.TimerStatusTypeOrder && status == model.OrderStatusAccepted {
|
||||||
|
params = &partner.StatusActionParams{ // 美团外卖要求在5分钟内拣货,不然订单会被取消
|
||||||
|
Timeout: pickupOrderDelay,
|
||||||
|
TimeoutGap: pickupOrderGap,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|||||||
@@ -168,10 +168,6 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStatusActionTimeout(statusType, status int) time.Duration {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error) {
|
func (p *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error) {
|
||||||
if !isAcceptIt {
|
if !isAcceptIt {
|
||||||
if globals.EnableStoreWrite && globals.EnableWscStoreWrite {
|
if globals.EnableStoreWrite && globals.EnableWscStoreWrite {
|
||||||
|
|||||||
Reference in New Issue
Block a user