diff --git a/BBWYB.Server.Business/DataRepair/DataRepairBusiness.cs b/BBWYB.Server.Business/DataRepair/DataRepairBusiness.cs index 2d47976..12b90a7 100644 --- a/BBWYB.Server.Business/DataRepair/DataRepairBusiness.cs +++ b/BBWYB.Server.Business/DataRepair/DataRepairBusiness.cs @@ -1009,14 +1009,20 @@ namespace BBWYB.Server.Business public void SyncPurchaserName() { List> updatePurchaserList = new List>(); - var dbPurchaserList = fsql.Select().Where(p => string.IsNullOrEmpty(p.Tag)).ToList(); - var pspList = fsql.Select() - .GroupBy(psp2 => psp2.PurchaserId) - .WithTempQuery(g => new { MaxId = g.Max(g.Value.Id), PurchaserId = g.Key }) + var pspList = fsql.Select() + .InnerJoin((psp2, p) => psp2.PurchaserId == p.Id) + .Where((psp2, p) => string.IsNullOrEmpty(p.Location)) + .GroupBy((psp2, p) => psp2.PurchaserId) + .WithTempQuery(g => new { MaxId = g.Max(g.Value.Item1.Id), PurchaserId = g.Key }) .From() .InnerJoin((psp2, psp1) => psp2.MaxId == psp1.Id) .ToList((psp2, psp1) => psp1); + + //var pspList = fsql.Select(432883091529819).ToList(); + var purchaserIdList = pspList.Select(x => x.PurchaserId).Distinct().ToList(); + var dbPurchaserList = fsql.Select(purchaserIdList).ToList(); + var index = 0; foreach (var psp in pspList) { diff --git a/BBWYB.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs b/BBWYB.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs index f5fada7..181b34a 100644 --- a/BBWYB.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs +++ b/BBWYB.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs @@ -6,6 +6,7 @@ using BBWYB.Server.Model.Db; using BBWYB.Server.Model.Dto; using Microsoft.Extensions.Caching.Memory; using Newtonsoft.Json.Linq; +using System.Net.Http.Headers; using System.Text.RegularExpressions; namespace BBWYB.Server.Business @@ -309,10 +310,38 @@ namespace BBWYB.Server.Business if (jobject["data"][locationIdList[i]] != null) { location = jobject["data"][locationIdList[i]]["data"]["location"].ToString(); + if (string.IsNullOrEmpty(location)) + continue; break; } } + if (string.IsNullOrEmpty(location)) + { + var jobjectdata = jobject["data"] as JObject; + foreach (var jproperty in jobjectdata.Properties()) + { + if (jobjectdata[jproperty.Name].Value("componentType") == "@ali/tdmod-od-pc-attribute-new") + { + location = jobjectdata[jproperty.Name]["data"].FirstOrDefault(x => x.Value("name") == "产地")?.Value("value"); + if (!string.IsNullOrEmpty(location)) + break; + } + } + + if (string.IsNullOrEmpty(location)) + { + if (purchaserName.Contains("市") && purchaserName.Contains("区")) + { + location = purchaserName.Substring(0, purchaserName.IndexOf("区") + 1); + } + else if (purchaserName.Contains("市")) + { + location = purchaserName.Substring(0, purchaserName.IndexOf("市") + 1); + } + } + } + var purchaser = new Purchaser() { Id = jobject["globalData"]["tempModel"]["sellerUserId"].ToString(), diff --git a/BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs b/BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs index 93122bb..5fccbf2 100644 --- a/BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs +++ b/BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs @@ -33,6 +33,9 @@ namespace BBWYB.Server.Business public ListResponse QueryPurchaserList(QueryPurchaserRequest request) { + //默认ShopId为空 + request.ShopId = null; + #region 数据验证 if (request.RecentDayCondition != null && request.RecentDayCondition.RecentDay > 0) {