- fixed mtps fee cal bug.
This commit is contained in:
@@ -51,9 +51,9 @@ func (c *WaybillController) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal
|
||||
order := c.callbackMsg2Waybill(msg)
|
||||
switch msg.Status {
|
||||
case mtpsapi.OrderStatusWaitingForSchedule:
|
||||
order.DesiredFee = c.calculateDeliveryFee(order)
|
||||
order.Status = model.WaybillStatusNew
|
||||
case mtpsapi.OrderStatusAccepted:
|
||||
order.DesiredFee = c.calculateDeliveryFee(order)
|
||||
order.Status = model.WaybillStatusAccepted
|
||||
case mtpsapi.OrderStatusPickedUp:
|
||||
order.Status = model.WaybillStatusDelivering
|
||||
@@ -126,6 +126,14 @@ func (c *WaybillController) calculateDeliveryFee(bill *model.Waybill) (retVal in
|
||||
} else {
|
||||
delieveryFee += controller.StandardPrice2Int(2.5 + 10 + 2*float64(order.Weight/1000-20))
|
||||
}
|
||||
|
||||
hour, min, sec := bill.WaybillCreatedAt.Clock()
|
||||
totalSeconds := hour*3600 + min*60 + sec
|
||||
if totalSeconds >= 11*3600+30*60 && totalSeconds <= 13*3600 { // 11:30 -- 13:00
|
||||
delieveryFee += controller.StandardPrice2Int(3)
|
||||
} else if totalSeconds >= 21*3600 || totalSeconds <= 6*3600 { // 21:00 -- 06:00
|
||||
delieveryFee += controller.StandardPrice2Int(3)
|
||||
}
|
||||
return delieveryFee
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user