- refactor order deliveryType
This commit is contained in:
@@ -19,6 +19,11 @@ import (
|
||||
"github.com/astaxie/beego/orm"
|
||||
)
|
||||
|
||||
const (
|
||||
// maxOrderPrice = 6399 // 单位为分,达达最大价格,超过这个价格配送费会增加
|
||||
maxOrderWeight = 5000 // 5公斤
|
||||
)
|
||||
|
||||
var (
|
||||
ErrCanNotFindMTPSStore = errors.New("不能找到美团配送站点配置")
|
||||
ErrStoreNoPriceInfo = errors.New("找不到门店的美团配送价格信息")
|
||||
@@ -218,7 +223,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy func(del
|
||||
ReceiverLng: jxutils.StandardCoordinate2Int(lngFloat),
|
||||
ReceiverLat: jxutils.StandardCoordinate2Int(latFloat),
|
||||
GoodsValue: jxutils.IntPrice2Standard(order.ActualPayPrice), // todo 超价处理
|
||||
GoodsWeight: float64(jxutils.IntWeight2Float(order.Weight)),
|
||||
GoodsWeight: float64(jxutils.IntWeight2Float(limitOrderWeight(order.Weight))),
|
||||
// ExpectedDeliveryTime: order.ExpectedDeliveredTime.Unix(),
|
||||
OrderType: mtpsapi.OrderTypeASAP,
|
||||
}
|
||||
@@ -297,7 +302,7 @@ func (c *DeliveryHandler) getMTPSShopID(order *model.GoodsOrder, db orm.Ormer) (
|
||||
saleStoreID := jxutils.GetSaleStoreIDFromOrder(order)
|
||||
if globals.OrderUseNewTable || saleStoreID == globals.DebugStoreID {
|
||||
db2 := dao.WrapDB(db)
|
||||
storeCourierList, err2 := dao.GetStoreCouriersByStoreID(db2, saleStoreID, model.VendorIDMTPS)
|
||||
storeCourierList, err2 := dao.GetOpenedStoreCouriersByStoreID(db2, saleStoreID, model.VendorIDMTPS)
|
||||
if err = err2; err != nil && err != orm.ErrNoRows {
|
||||
return "", err
|
||||
}
|
||||
@@ -333,3 +338,10 @@ func (c *DeliveryHandler) getMTPSShopID(order *model.GoodsOrder, db orm.Ormer) (
|
||||
}
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
func limitOrderWeight(weight int) int {
|
||||
if weight > maxOrderWeight {
|
||||
return maxOrderWeight
|
||||
}
|
||||
return weight
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user