From fea8e7e57339729be0fea61e01715e4097948d02 Mon Sep 17 00:00:00 2001 From: sanji Date: Mon, 4 Dec 2023 11:54:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D1688=E7=88=AC=E8=99=AB?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../APIServices/PurchaseProductAPIService.cs | 44 ++++++++++++++++--- .../PurchaseProductAPIService.cs | 40 +++++++++++++---- 2 files changed, 69 insertions(+), 15 deletions(-) diff --git a/BBWY.Client/APIServices/PurchaseProductAPIService.cs b/BBWY.Client/APIServices/PurchaseProductAPIService.cs index 647416c5..e6aa0925 100644 --- a/BBWY.Client/APIServices/PurchaseProductAPIService.cs +++ b/BBWY.Client/APIServices/PurchaseProductAPIService.cs @@ -25,6 +25,9 @@ namespace BBWY.Client.APIServices private string qtAppId = "BBWY2023022001"; private string qtAppSecret = "908e131365d5448ca651ba20ed7ddefe"; + private List locationIdList; + private List priceIdList; + private TimeSpan purchaseProductCacheTimeSpan; //private TimeSpan _1688SessionIdTimeSpan; @@ -48,6 +51,17 @@ namespace BBWY.Client.APIServices }; purchaseProductCacheTimeSpan = TimeSpan.FromDays(1); this.quanTanProductClient = quanTanProductClient; + locationIdList = new List() + { + "300252630336272", + "1081181309101", + "16347413030323" + }; + priceIdList = new List() { + "300252630336263", + "1081181309582", + "16347413030316" + }; } public (Purchaser purchaser, IList purchaseSchemeProductSkus)? GetProductInfo(Platform platform, string productId, string skuId, string purchaseProductId, PurchaseOrderMode priceMode, PurchaseProductAPIMode apiMode) @@ -200,11 +214,18 @@ namespace BBWY.Client.APIServices var purchaser = new Purchaser() { Id = jobject["globalData"]["tempModel"]["sellerUserId"].ToString(), - Name = jobject["globalData"]["tempModel"]["companyName"].ToString(), - Location = jobject["data"]["1081181309101"] != null ? - jobject["data"]["1081181309101"]["data"]["location"].ToString() : - jobject["data"]["16347413030323"]["data"]["location"].ToString() + Name = jobject["globalData"]["tempModel"]["companyName"].ToString() }; + foreach (var lid in locationIdList) + { + if (jobject["data"][lid] != null) + { + purchaser.Location = jobject["data"][lid]["data"]["location"].ToString(); + break; + } + } + + var colorsProperty = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value("fid") == 3216 || j.Value("fid") == 1627207 || @@ -217,9 +238,18 @@ namespace BBWY.Client.APIServices imageUrl = j.Value("imageUrl") }).ToList(); - var firstPrice = jobject["data"]["1081181309582"] != null ? - jobject["data"]["1081181309582"]["data"]["priceModel"]["currentPrices"][0].Value("price") : - jobject["data"]["16347413030316"]["data"]["priceModel"]["currentPrices"][0].Value("price"); + //var firstPrice = jobject["data"]["1081181309582"] != null ? + // jobject["data"]["1081181309582"]["data"]["priceModel"]["currentPrices"][0].Value("price") : + // jobject["data"]["16347413030316"]["data"]["priceModel"]["currentPrices"][0].Value("price"); + var firstPrice = 0M; + foreach (var pid in priceIdList) + { + if (jobject["data"][pid] != null) + { + firstPrice = jobject["data"][pid]["data"]["priceModel"]["currentPrices"][0].Value("price"); + break; + } + } var purchaseSchemeProductSkus = new List(); diff --git a/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs b/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs index 17413558..51b8c2ee 100644 --- a/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs +++ b/BBWY.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs @@ -25,6 +25,9 @@ namespace BBWY.Server.Business private string qtAppId = "BBWY2023022001"; private string qtAppSecret = "908e131365d5448ca651ba20ed7ddefe"; + private List locationIdList; + private List priceIdList; + private TimeSpan purchaseProductCacheTimeSpan; //private TimeSpan _1688SessionIdTimeSpan; @@ -48,6 +51,17 @@ namespace BBWY.Server.Business }; purchaseProductCacheTimeSpan = TimeSpan.FromDays(1); this.quanTanProductClient = quanTanProductClient; + locationIdList = new List() + { + "300252630336272", + "1081181309101", + "16347413030323" + }; + priceIdList = new List() { + "300252630336263", + "1081181309582", + "16347413030316" + }; } public PurchaseSkuBasicInfoResponse GetProductInfo(PurchaseSkuBasicInfoRequest request) @@ -210,12 +224,16 @@ namespace BBWY.Server.Business var purchaser = new Purchaser() { Id = jobject["globalData"]["tempModel"]["sellerUserId"].ToString(), - Name = jobject["globalData"]["tempModel"]["companyName"].ToString(), - Location = jobject["data"]["1081181309101"] != null ? - jobject["data"]["1081181309101"]["data"]["location"].ToString() : - jobject["data"]["16347413030323"]["data"]["location"].ToString(), - Platform = Enums.Platform.阿里巴巴 + Name = jobject["globalData"]["tempModel"]["companyName"].ToString() }; + foreach (var lid in locationIdList) + { + if (jobject["data"][lid] != null) + { + purchaser.Location = jobject["data"][lid]["data"]["location"].ToString(); + break; + } + } var colorsProperty = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value("fid") == 3216 || j.Value("fid") == 1627207 || @@ -228,9 +246,15 @@ namespace BBWY.Server.Business imageUrl = j.Value("imageUrl") }).ToList(); - var firstPrice = jobject["data"]["1081181309582"] != null ? - jobject["data"]["1081181309582"]["data"]["priceModel"]["currentPrices"][0].Value("price") : - jobject["data"]["16347413030316"]["data"]["priceModel"]["currentPrices"][0].Value("price"); + var firstPrice = 0M; + foreach (var pid in priceIdList) + { + if (jobject["data"][pid] != null) + { + firstPrice = jobject["data"][pid]["data"]["priceModel"]["currentPrices"][0].Value("price"); + break; + } + } var list = new List();