- defsch调度器的timer添加条件函数ShouldSetTimer
- 饿百发三方需要在订单创建30分钟后才可以
This commit is contained in:
@@ -57,10 +57,11 @@ type PrinterStatus struct {
|
||||
}
|
||||
|
||||
const (
|
||||
TimerTypeNoOverride = 0 // GetStatusActionConfig 返回表示不修改缺省配置
|
||||
TimerTypeByPass = 1
|
||||
TimerTypeBaseNow = 2
|
||||
TimerTypeBaseStatusTime = 3
|
||||
TimerTypeNoOverride = 0 // GetStatusActionConfig 返回表示不修改缺省配置
|
||||
TimerTypeByPass = 1
|
||||
TimerTypeBaseNow = 2
|
||||
TimerTypeBaseStatusTime = 3
|
||||
TimerTypeBaseOrderCreatedAt = 4
|
||||
)
|
||||
|
||||
type StatusActionParams struct {
|
||||
@@ -86,15 +87,20 @@ type WaybillFeeInfo struct {
|
||||
Waybill *model.Waybill `json:"waybill"`
|
||||
}
|
||||
|
||||
func (s *StatusActionParams) GetRefTimeout(statusTime time.Time) (timeout time.Duration) {
|
||||
func (s *StatusActionParams) GetRefTimeout(statusTime time.Time, orderCreatedAt time.Time) (timeout time.Duration) {
|
||||
switch s.TimerType {
|
||||
case TimerTypeBaseNow:
|
||||
timeout = s.Timeout
|
||||
case TimerTypeBaseStatusTime:
|
||||
timeout = statusTime.Sub(time.Now()) + s.Timeout
|
||||
case TimerTypeBaseOrderCreatedAt:
|
||||
timeout = orderCreatedAt.Sub(time.Now()) + s.Timeout
|
||||
default:
|
||||
timeout = 0
|
||||
}
|
||||
if timeout < 0 {
|
||||
timeout = 0
|
||||
}
|
||||
return timeout
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ var (
|
||||
ebaiapi.WaybillStatusCourierPickedup: model.WaybillStatusDelivering,
|
||||
ebaiapi.WaybillStatusDeliveryCancled: model.WaybillStatusCanceled,
|
||||
ebaiapi.WaybillStatusFinished: model.WaybillStatusDelivered,
|
||||
ebaiapi.WaybillStatusExceptional: model.WaybillStatusUnknown,
|
||||
ebaiapi.WaybillStatusExceptional: model.WaybillStatusCanceled,
|
||||
ebaiapi.WaybillStatusSelfDelivery: model.WaybillStatusUnknown,
|
||||
ebaiapi.WaybillStatusDontDeliver: model.WaybillStatusUnknown,
|
||||
ebaiapi.WaybillStatusDeliveryRejected: model.WaybillStatusNeverSend,
|
||||
ebaiapi.WaybillStatusDontDeliver: model.WaybillStatusCanceled,
|
||||
ebaiapi.WaybillStatusDeliveryRejected: model.WaybillStatusCanceled,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user