|
|
@ -8,6 +8,7 @@ using Microsoft.Extensions.Caching.Memory; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using System.Net.Http.Headers; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using static Google.Protobuf.Reflection.SourceCodeInfo.Types; |
|
|
|
|
|
|
|
namespace BBWYB.Server.Business |
|
|
|
{ |
|
|
@ -35,6 +36,7 @@ namespace BBWYB.Server.Business |
|
|
|
private List<string> purchaserNameIdList; |
|
|
|
|
|
|
|
private IList<string> invalidPurchaserNameList; |
|
|
|
private IDictionary<string, List<string>> provinceDictionary; |
|
|
|
|
|
|
|
public PurchaseProductAPIService(RestApiService restApiService, IMemoryCache memoryCache) |
|
|
|
{ |
|
|
@ -70,6 +72,21 @@ namespace BBWYB.Server.Business |
|
|
|
priceIdList = new List<string>() { "1081181309582", "1081181309582", "16347413030316", "13772573013151" }; |
|
|
|
|
|
|
|
purchaserNameIdList = new List<string>() { "38229149", "38229148", "38229150" }; |
|
|
|
|
|
|
|
provinceDictionary = new Dictionary<string, List<string>>() |
|
|
|
{ |
|
|
|
{ "省", new List<string>() |
|
|
|
{ |
|
|
|
"黑龙江","吉林","辽宁","河北","山西","陕西","甘肃","青海","河南","湖北","湖南","山东","江苏","安徽","浙江","江西","福建","台湾","贵州","四川","云南","广东","海南" |
|
|
|
} |
|
|
|
}, |
|
|
|
{ "自治区", new List<string>(){ "内蒙古","西藏"}}, |
|
|
|
{ "回族自治区", new List<string>(){"宁夏"}}, |
|
|
|
{ "维吾尔自治区", new List<string>(){"新疆"}}, |
|
|
|
{ "壮族自治区", new List<string>(){"广西"}}, |
|
|
|
{ "特别行政区",new List<string>(){ "香港","澳门"}}, |
|
|
|
{ "市",new List<string>(){ "重庆","北京","天津","上海"}} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
public PurchaseSkuBasicInfoResponse GetProductInfo(PurchaseSkuBasicInfoRequest request) |
|
|
@ -342,6 +359,8 @@ namespace BBWYB.Server.Business |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
location = FormatteLocation(location); |
|
|
|
|
|
|
|
var purchaser = new Purchaser() |
|
|
|
{ |
|
|
|
Id = jobject["globalData"]["tempModel"]["sellerUserId"].ToString(), |
|
|
@ -415,34 +434,27 @@ namespace BBWYB.Server.Business |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//private (Purchaser purchaser, IList<PurchaseSchemeProductSku> purchaseSchemeProductSkus)? LoadFromQTSpider(Platform platform, string productId, string skuId, string purchaseProductId, PurchaseOrderMode priceMode)
|
|
|
|
//{
|
|
|
|
// try
|
|
|
|
// {
|
|
|
|
// var response = quanTanProductClient.GetProductInfo(purchaseProductId, qtAppId, qtAppSecret);
|
|
|
|
// if (response.Status != 200)
|
|
|
|
// return null;
|
|
|
|
// return (new Purchaser()
|
|
|
|
// {
|
|
|
|
// Id = response.Data.Supplier.VenderId,
|
|
|
|
// Name = response.Data.Supplier.VerdenName,
|
|
|
|
// Location = response.Data.Supplier.Location
|
|
|
|
// }, response.Data.ProductSku.Select(qtsku => new PurchaseSchemeProductSku()
|
|
|
|
// {
|
|
|
|
// ProductId = productId,
|
|
|
|
// SkuId = skuId,
|
|
|
|
// PurchaseProductId = purchaseProductId,
|
|
|
|
// Price = qtsku.Price,
|
|
|
|
// Title = qtsku.Title,
|
|
|
|
// PurchaseSkuId = qtsku.SkuId,
|
|
|
|
// PurchaseSkuSpecId = string.Empty,
|
|
|
|
// Logo = qtsku.Logo
|
|
|
|
// }).ToList());
|
|
|
|
// }
|
|
|
|
// catch
|
|
|
|
// {
|
|
|
|
// return null;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
private string FormatteLocation(string location) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(location)) |
|
|
|
return location; |
|
|
|
location = location.Trim().Replace(" ", string.Empty); |
|
|
|
|
|
|
|
foreach (var provincekey in provinceDictionary.Keys) |
|
|
|
{ |
|
|
|
var province = provinceDictionary[provincekey].FirstOrDefault(p => location.StartsWith(p)); |
|
|
|
if (string.IsNullOrEmpty(province)) |
|
|
|
continue; |
|
|
|
if (location.Contains(provincekey)) |
|
|
|
return location; |
|
|
|
location = location.Replace(province, $"{province}{provincekey}"); |
|
|
|
if (location.EndsWith(provincekey)) |
|
|
|
return location; |
|
|
|
if (!location.EndsWith("市")) |
|
|
|
location = $"{location}市"; |
|
|
|
} |
|
|
|
//Console.WriteLine(location);
|
|
|
|
return location; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|