- 对于饿百与美团外卖订单,设置其PickDeadline
This commit is contained in:
@@ -26,7 +26,7 @@ const (
|
|||||||
time2Schedule3rdCarrier = 20 // 收到平台方自有配送的新运单消息后,等待创建三方配送运单的时间(分钟),如果是定时达,会再根据ExpectedDeliveredTime与dingShiDaAheadTime做调整
|
time2Schedule3rdCarrier = 20 // 收到平台方自有配送的新运单消息后,等待创建三方配送运单的时间(分钟),如果是定时达,会再根据ExpectedDeliveredTime与dingShiDaAheadTime做调整
|
||||||
// time2Schedule3rdCarrierGap4OrderStatus = 3 * time.Minute // 京东要求是运单状态为待抢单且超时5分钟,但为了防止没有运单事件,所以就拣货完成事件开始算,添加3分钟
|
// time2Schedule3rdCarrierGap4OrderStatus = 3 * time.Minute // 京东要求是运单状态为待抢单且超时5分钟,但为了防止没有运单事件,所以就拣货完成事件开始算,添加3分钟
|
||||||
time2AutoPickupMin = 15 * time.Minute // 自动拣货等待时间,这个只有在没有PickDeadline信息才有用,否则会根据PickDeadline设置
|
time2AutoPickupMin = 15 * time.Minute // 自动拣货等待时间,这个只有在没有PickDeadline信息才有用,否则会根据PickDeadline设置
|
||||||
time2AutoPickupGap = 5 * 60 //随机5分钟
|
time2AutoPickupGap = 1 * 60 //随机1分钟
|
||||||
|
|
||||||
// (把pending order timerout 在-pendingOrderTimerMinMinSecond至pendingOrderTimerMaxSecond映射到pendingOrderTimerMinSecond至pendingOrderTimerMaxSecond)
|
// (把pending order timerout 在-pendingOrderTimerMinMinSecond至pendingOrderTimerMaxSecond映射到pendingOrderTimerMinSecond至pendingOrderTimerMaxSecond)
|
||||||
pendingOrderTimerMinMinSecond = 5 * 60 // 5分钟
|
pendingOrderTimerMinMinSecond = 5 * 60 // 5分钟
|
||||||
@@ -734,7 +734,7 @@ func (s *DefScheduler) resetTimer(savedOrderInfo *WatchOrderInfo, bill *model.Wa
|
|||||||
panic("TimerType is wrong!!!")
|
panic("TimerType is wrong!!!")
|
||||||
}
|
}
|
||||||
if config.TimeoutGap != 0 {
|
if config.TimeoutGap != 0 {
|
||||||
timeout += time.Duration(rand.Int31n(int32(config.TimeoutGap))) * time.Second
|
timeout += time.Duration(rand.Intn(int(config.TimeoutGap))) * time.Second
|
||||||
}
|
}
|
||||||
if isPending && timeout < pendingOrderTimerMaxSecond*time.Second { // 如果是PENDING的订单,则将其分布到2--5秒内,让后续事件有机会执行
|
if isPending && timeout < pendingOrderTimerMaxSecond*time.Second { // 如果是PENDING的订单,则将其分布到2--5秒内,让后续事件有机会执行
|
||||||
timeout = time.Duration(jxutils.MapValue2Scope(int64(timeout), -pendingOrderTimerMinMinSecond*1000, pendingOrderTimerMaxSecond*1000, pendingOrderTimerMinSecond*1000, pendingOrderTimerMaxSecond*1000)) * time.Millisecond
|
timeout = time.Duration(jxutils.MapValue2Scope(int64(timeout), -pendingOrderTimerMinMinSecond*1000, pendingOrderTimerMaxSecond*1000, pendingOrderTimerMinSecond*1000, pendingOrderTimerMaxSecond*1000)) * time.Millisecond
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/refutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestObjFieldByName(t *testing.T) {
|
func TestObjFieldByName(t *testing.T) {
|
||||||
@@ -14,27 +15,27 @@ func TestObjFieldByName(t *testing.T) {
|
|||||||
ID: 1,
|
ID: 1,
|
||||||
Name: "hello",
|
Name: "hello",
|
||||||
}
|
}
|
||||||
if GetObjFieldByName(kk, "ID").(int8) != 1 {
|
if refutil.GetObjFieldByName(kk, "ID").(int8) != 1 {
|
||||||
t.Fatal("value is not ok")
|
t.Fatal("value is not ok")
|
||||||
}
|
}
|
||||||
if GetObjFieldByName(kk, "Name").(string) != "hello" {
|
if refutil.GetObjFieldByName(kk, "Name").(string) != "hello" {
|
||||||
t.Fatal("value is not ok")
|
t.Fatal("value is not ok")
|
||||||
}
|
}
|
||||||
|
|
||||||
pKK := &kk
|
pKK := &kk
|
||||||
if GetObjFieldByName(pKK, "ID").(int8) != 1 {
|
if refutil.GetObjFieldByName(pKK, "ID").(int8) != 1 {
|
||||||
t.Fatal("value is not ok")
|
t.Fatal("value is not ok")
|
||||||
}
|
}
|
||||||
if GetObjFieldByName(pKK, "Name").(string) != "hello" {
|
if refutil.GetObjFieldByName(pKK, "Name").(string) != "hello" {
|
||||||
t.Fatal("value is not ok")
|
t.Fatal("value is not ok")
|
||||||
}
|
}
|
||||||
|
|
||||||
SetObjFieldByName(pKK, "ID", int8(100))
|
refutil.SetObjFieldByName(pKK, "ID", int8(100))
|
||||||
SetObjFieldByName(pKK, "Name", "world")
|
refutil.SetObjFieldByName(pKK, "Name", "world")
|
||||||
if GetObjFieldByName(pKK, "ID").(int8) != 100 {
|
if refutil.GetObjFieldByName(pKK, "ID").(int8) != 100 {
|
||||||
t.Fatal("value is not ok")
|
t.Fatal("value is not ok")
|
||||||
}
|
}
|
||||||
if GetObjFieldByName(pKK, "Name").(string) != "world" {
|
if refutil.GetObjFieldByName(pKK, "Name").(string) != "world" {
|
||||||
t.Fatal("value is not ok")
|
t.Fatal("value is not ok")
|
||||||
}
|
}
|
||||||
t.Log(utils.Format4Output(pKK, false))
|
t.Log(utils.Format4Output(pKK, false))
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
// acceptOrderDelay = 180 * time.Second
|
// acceptOrderDelay = 180 * time.Second
|
||||||
pickupOrderDelay = 240 * time.Second
|
pickupOrderDelay = 240 * time.Second
|
||||||
pickupOrderGap = 30
|
pickupOrderGap = 20
|
||||||
|
|
||||||
callDeliveryDelay = 10 * time.Minute
|
callDeliveryDelay = 10 * time.Minute
|
||||||
callDeliveryDelayGap = 30
|
callDeliveryDelayGap = 30
|
||||||
// fakePickedUp = "9527"
|
// fakePickedUp = "9527"
|
||||||
@@ -92,6 +93,9 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
ActualPayPrice: utils.MustInterface2Int64(orderMap["user_fee"]),
|
ActualPayPrice: utils.MustInterface2Int64(orderMap["user_fee"]),
|
||||||
Skus: []*model.OrderSku{},
|
Skus: []*model.OrderSku{},
|
||||||
}
|
}
|
||||||
|
if jxutils.IsTimeEmpty(order.PickDeadline) && !jxutils.IsTimeEmpty(order.StatusTime) {
|
||||||
|
order.PickDeadline = order.StatusTime.Add(pickupOrderDelay /* + time.Duration(rand.Intn(pickupOrderGap))*time.Second*/)
|
||||||
|
}
|
||||||
if jxutils.IsMobileFake(order.ConsigneeMobile) {
|
if jxutils.IsMobileFake(order.ConsigneeMobile) {
|
||||||
if mobileInfo, err := api.EbaiAPI.OrderPrivateInfo(vendorOrderID); err == nil {
|
if mobileInfo, err := api.EbaiAPI.OrderPrivateInfo(vendorOrderID); err == nil {
|
||||||
order.ConsigneeMobile = mobileInfo.ShortNumber
|
order.ConsigneeMobile = mobileInfo.ShortNumber
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
pickupOrderDelay = 4 * time.Minute
|
pickupOrderDelay = 240 * time.Second
|
||||||
pickupOrderGap = 20
|
pickupOrderGap = 20
|
||||||
|
|
||||||
callDeliveryDelay = 10 * time.Minute
|
callDeliveryDelay = 10 * time.Minute
|
||||||
callDeliveryDelayGap = 30
|
callDeliveryDelayGap = 30
|
||||||
)
|
)
|
||||||
@@ -91,6 +92,9 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
ActualPayPrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["total"])),
|
ActualPayPrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["total"])),
|
||||||
Skus: []*model.OrderSku{},
|
Skus: []*model.OrderSku{},
|
||||||
}
|
}
|
||||||
|
if jxutils.IsTimeEmpty(order.PickDeadline) && !jxutils.IsTimeEmpty(order.StatusTime) {
|
||||||
|
order.PickDeadline = order.StatusTime.Add(pickupOrderDelay /*+ time.Duration(rand.Intn(pickupOrderGap))*time.Second*/)
|
||||||
|
}
|
||||||
order.Status = p.GetStatusFromVendorStatus(order.VendorStatus)
|
order.Status = p.GetStatusFromVendorStatus(order.VendorStatus)
|
||||||
if jxutils.IsTimeEmpty(order.ExpectedDeliveredTime) {
|
if jxutils.IsTimeEmpty(order.ExpectedDeliveredTime) {
|
||||||
order.BusinessType = model.BusinessTypeImmediate
|
order.BusinessType = model.BusinessTypeImmediate
|
||||||
|
|||||||
Reference in New Issue
Block a user