From e743d132c19a68bf4eb71a93a1858feb9979dcdc Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Wed, 7 Sep 2022 03:15:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D1688=E7=88=AC=E8=99=AB?= =?UTF-8?q?=E5=92=8C=E4=B8=87=E9=82=A6=E5=8F=96=E5=9B=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/APIServices/OneBoundAPIService.cs | 2 +- .../APIServices/PurchaseProductAPIService.cs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/BBWY.Client/APIServices/OneBoundAPIService.cs b/BBWY.Client/APIServices/OneBoundAPIService.cs index a5898855..d88d80f4 100644 --- a/BBWY.Client/APIServices/OneBoundAPIService.cs +++ b/BBWY.Client/APIServices/OneBoundAPIService.cs @@ -29,7 +29,7 @@ namespace BBWY.Client.APIServices { try { - https://api-gw.onebound.cn/1688/item_get/key=t5060712539&secret=20211103&num_iid=649560646832&lang=zh-CN&cache=no + //https://api-gw.onebound.cn/1688/item_get/key=t5060712539&secret=20211103&num_iid=649560646832&lang=zh-CN&cache=no var result = restApiService.SendRequest("https://api-gw.onebound.cn/", $"{platform}/item_get", $"key={key}&secret={secret}&num_iid={productId}&lang=zh-CN&cache=no", null, HttpMethod.Get, paramPosition: ParamPosition.Query, enableRandomTimeStamp: true); if (result.StatusCode != System.Net.HttpStatusCode.OK) throw new Exception($"{result.StatusCode} {result.Content}"); diff --git a/BBWY.Client/APIServices/PurchaseProductAPIService.cs b/BBWY.Client/APIServices/PurchaseProductAPIService.cs index 46fb01d9..40686824 100644 --- a/BBWY.Client/APIServices/PurchaseProductAPIService.cs +++ b/BBWY.Client/APIServices/PurchaseProductAPIService.cs @@ -92,11 +92,11 @@ namespace BBWY.Client.APIServices if (result.StatusCode != System.Net.HttpStatusCode.OK) throw new Exception($"{result.StatusCode} {result.Content}"); - var j = JObject.Parse(result.Content); - var isOK = j.Value("error_code") == "0000"; + var jobject = JObject.Parse(result.Content); + var isOK = jobject.Value("error_code") == "0000"; if (isOK) { - var skuJArray = (JArray)j["item"]["skus"]["sku"]; + var skuJArray = (JArray)jobject["item"]["skus"]["sku"]; if (skuJArray.Count == 0) { //errorMsg = $"商品{purchaseSchemeProduct.PurchaseProductId}缺少sku信息"; @@ -112,14 +112,14 @@ namespace BBWY.Client.APIServices PurchaseSkuId = j.Value("sku_id"), PurchaseSkuSpecId = j.Value("spec_id"), Title = j.Value("properties_name"), - Logo = GetOneBoundSkuLogo(j, (JArray)j["item"]["prop_imgs"]["prop_img"]) + Logo = GetOneBoundSkuLogo(j, (JArray)jobject["item"]["prop_imgs"]["prop_img"]) }).ToList(); - var purchaserId = j["item"]["seller_info"].Value("user_num_id"); - var purchaserName = j["item"]["seller_info"].Value("title"); + var purchaserId = jobject["item"]["seller_info"].Value("user_num_id"); + var purchaserName = jobject["item"]["seller_info"].Value("title"); if (string.IsNullOrEmpty(purchaserName)) - purchaserName = j["item"]["seller_info"].Value("shop_name"); - var purchaserLocation = j["item"].Value("location"); + purchaserName = jobject["item"]["seller_info"].Value("shop_name"); + var purchaserLocation = jobject["item"].Value("location"); return (new Purchaser() { @@ -199,7 +199,7 @@ namespace BBWY.Client.APIServices Location = jobject["data"]["1081181309101"]["data"]["location"].ToString() }; - var colorsProperty = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value("fid") == 3216 && + var colorsProperty = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value("fid") == 3216 || j.Value("fid") == 1627207)["value"] .Children() .Select(j => new