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();