- 处理微商城订单为自提单的情况

This commit is contained in:
gazebo
2019-06-13 21:05:19 +08:00
parent f20a112fc5
commit b7fc7a7134

View File

@@ -52,7 +52,7 @@ func (p *PurchaseHandler) onOrderMsg(msg *weimobapi.CallbackMsg) (response *weim
orderMapData, err = api.WeimobAPI.QueryOrderDetail(msg.OrderNo, false)
if err == nil {
status = p.callbackMsg2Status(msg, orderMapData)
if status.Status == model.OrderStatusNew {
if msg.Event == weimobapi.MsgEventCreateOrder || status.Status == model.OrderStatusNew {
order := p.Map2Order(orderMapData)
order.StatusTime = msg.StatusTime
err = partner.CurOrderManager.OnOrderNew(order, status)
@@ -115,20 +115,13 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
result := orderData
vendorOrderID := utils.Int64ToStr(utils.MustInterface2Int64(result["orderNo"]))
deliveryDetail := result["deliveryDetail"].(map[string]interface{})
logisticsDeliveryDetail := deliveryDetail["logisticsDeliveryDetail"].(map[string]interface{})
logisticsDeliveryDetail, _ := deliveryDetail["logisticsDeliveryDetail"].(map[string]interface{})
// paymentInfo := result["paymentInfo"].(map[string]interface{})
order = &model.GoodsOrder{
VendorOrderID: vendorOrderID,
VendorID: model.VendorIDWSC,
VendorStoreID: utils.Int64ToStr(utils.MustInterface2Int64(result["processStoreId"])), // 这个不是通常意义上的vendor store id
// StoreID
StoreName: utils.Interface2String(logisticsDeliveryDetail["processStoreTitle"]),
ConsigneeName: utils.Interface2String(logisticsDeliveryDetail["receiverName"]),
ConsigneeMobile: utils.Interface2String(logisticsDeliveryDetail["receiverMobile"]),
ConsigneeAddress: utils.Interface2String(logisticsDeliveryDetail["receiverAddress"]),
CoordinateType: model.CoordinateTypeMars,
ConsigneeLng: jxutils.StandardCoordinate2Int(utils.Str2Float64(utils.Interface2String(logisticsDeliveryDetail["receiverLongitude"]))),
ConsigneeLat: jxutils.StandardCoordinate2Int(utils.Str2Float64(utils.Interface2String(logisticsDeliveryDetail["receiverLatitude"]))),
BuyerComment: utils.Interface2String(result["buyerRemark"]),
ExpectedDeliveredTime: utils.DefaultTimeValue,
PickDeadline: utils.DefaultTimeValue,
@@ -138,9 +131,23 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
ActualPayPrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(result["totalAmount"])),
BusinessType: model.BusinessTypeImmediate,
}
// if expectDeliveryTimeStr, ok := logisticsDeliveryDetail["expectDeliveryTime"].(string); ok {
// if expectDeliveryTimeStr =
// }
if logisticsDeliveryDetail != nil {
order.StoreName = utils.Interface2String(logisticsDeliveryDetail["processStoreTitle"])
order.ConsigneeName = utils.Interface2String(logisticsDeliveryDetail["receiverName"])
order.ConsigneeMobile = utils.Interface2String(logisticsDeliveryDetail["receiverMobile"])
order.ConsigneeAddress = utils.Interface2String(logisticsDeliveryDetail["receiverAddress"])
order.ConsigneeLng = jxutils.StandardCoordinate2Int(utils.Str2Float64(utils.Interface2String(logisticsDeliveryDetail["receiverLongitude"])))
order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(utils.Interface2String(logisticsDeliveryDetail["receiverLatitude"])))
order.CoordinateType = model.CoordinateTypeMars
// if expectDeliveryTimeStr, ok := logisticsDeliveryDetail["expectDeliveryTime"].(string); ok {
// if expectDeliveryTimeStr =
// }
} else {
selfPickupDetail, _ := deliveryDetail["selfPickupDetail"].(map[string]interface{})
if selfPickupDetail != nil {
order.StoreName = utils.Interface2String(selfPickupDetail["selfPickupSiteName"])
}
}
order.Status = p.GetStatusFromVendorStatus(order.VendorStatus)
itemList := result["itemList"].([]interface{})
for _, v := range itemList {
@@ -160,8 +167,11 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
order.Skus = append(order.Skus, sku)
}
jxutils.RefreshOrderSkuRelated(order)
p.arrangeSaleStore(order, utils.Interface2String(logisticsDeliveryDetail["receiverCity"]), utils.Interface2String(logisticsDeliveryDetail["receiverProvince"]))
if logisticsDeliveryDetail != nil {
p.arrangeSaleStore(order, utils.Interface2String(logisticsDeliveryDetail["receiverCity"]), utils.Interface2String(logisticsDeliveryDetail["receiverProvince"]))
}
p.setStoreOrderSeq(order)
globals.SugarLogger.Debug(utils.Format4Output(order, false))
return order
}