/// <summary> /// 获取京东运费 /// </summary> /// <param name="getShippingOptionRequest"></param> /// <returns></returns> private decimal GetJdFright(GetShippingOptionRequest getShippingOptionRequest) { try { var freightObj = new Services.JD.DTO.JDFetchFreightIn() { Province = getShippingOptionRequest.ShippingAddress.JDAddrLevel1, City = getShippingOptionRequest.ShippingAddress.JDAddrLevel2, County = getShippingOptionRequest.ShippingAddress.JDAddrLevel3, Town = getShippingOptionRequest.ShippingAddress.JDAddrLevel4, Skus = getShippingOptionRequest.Items.Where(p => p.ShoppingCartItem.Product.JDSkuId.HasValue) .Select(p => new Services.JD.DTO.JDFetchFreightIn_Skus() { SkuId = p.ShoppingCartItem.Product.JDSkuId.Value, Num = p.ShoppingCartItem.Quantity }).ToList() }; var result = _jdService.FetchFreight(freightObj); return(result.Freight); } catch (Exception e) { //log return(0); } }
/// <summary> /// 抓取运费 /// </summary> /// <returns></returns> public ActionResult FetchFreight(JDFetchFreightIn freightIn) { return(Content(JsonConvert.SerializeObject(_jdService.FetchFreight(freightIn)))); }