From 7fa2ef988854e5789008d771cbf171e0075416b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=C2=B7=C3=A6?= <279202647@qq.com> Date: Wed, 14 Apr 2021 12:52:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=82=A8=E5=AD=98Sku?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JdShopListener/JdShopListener.csproj | 2 +- JdShopListener/JdShopListener/MainWindow.xaml | 2 +- .../JdShopListener/MainWindowViewModel.cs | 364 +++++++++++++++++- ... 20210414042219_InitialCreate.Designer.cs} | 29 +- ...ate.cs => 20210414042219_InitialCreate.cs} | 11 +- .../Migrations/JdDBContextModelSnapshot.cs | 27 ++ .../JdShopListener/Models/ItemChangeModel.cs | 112 +----- .../JdShopListener/Models/ItemData.cs | 15 +- .../JdShopListener/Models/SkuModel.cs | 31 ++ .../JdShopListener/SqlHelpers/DbHelper.cs | 13 + JdShopListener/JdShopListener/db/items.db | Bin 28672 -> 28672 bytes 11 files changed, 488 insertions(+), 118 deletions(-) rename JdShopListener/JdShopListener/Migrations/{20210413085518_InitialCreate.Designer.cs => 20210414042219_InitialCreate.Designer.cs} (71%) rename JdShopListener/JdShopListener/Migrations/{20210413085518_InitialCreate.cs => 20210414042219_InitialCreate.cs} (73%) diff --git a/JdShopListener/JdShopListener/JdShopListener.csproj b/JdShopListener/JdShopListener/JdShopListener.csproj index 46ad476..456270c 100644 --- a/JdShopListener/JdShopListener/JdShopListener.csproj +++ b/JdShopListener/JdShopListener/JdShopListener.csproj @@ -29,7 +29,7 @@ - Always + PreserveNewest diff --git a/JdShopListener/JdShopListener/MainWindow.xaml b/JdShopListener/JdShopListener/MainWindow.xaml index c9cfc1c..7212ae6 100644 --- a/JdShopListener/JdShopListener/MainWindow.xaml +++ b/JdShopListener/JdShopListener/MainWindow.xaml @@ -167,7 +167,7 @@ - + diff --git a/JdShopListener/JdShopListener/MainWindowViewModel.cs b/JdShopListener/JdShopListener/MainWindowViewModel.cs index be02f67..b5842da 100644 --- a/JdShopListener/JdShopListener/MainWindowViewModel.cs +++ b/JdShopListener/JdShopListener/MainWindowViewModel.cs @@ -45,9 +45,11 @@ namespace JdShopListener Btn_Add = new RelayCommand(Add); Btn_ShowList = new RelayCommand(ShowList); Btn_Start = new RelayCommand(Start); - + Btn_ShowData = new RelayCommand(ShowData); + ItemList = new System.Collections.ObjectModel.ObservableCollection(); SkuList = new System.Collections.ObjectModel.ObservableCollection(); - + SelectDate = DateList.FirstOrDefault(); + SelectPro = ProList.FirstOrDefault(); Init(); } @@ -92,7 +94,7 @@ namespace JdShopListener public ProModel SelectPro { get { return _SelectPro; } - set { Set(ref _SelectPro, value); } + set { Set(ref _SelectPro, value); ShowData(); } } @@ -103,7 +105,7 @@ namespace JdShopListener public DateModel SelectDate { get { return _SelectDate; } - set { Set(ref _SelectDate, value); } + set { Set(ref _SelectDate, value);ShowData(); } } private System.Collections.ObjectModel.ObservableCollection _ItemList; @@ -146,6 +148,10 @@ namespace JdShopListener set { Set(ref _Desc, value); } } + /// + /// 所有sku最后变化记录 + /// + public List LastItemChangeList { get; set; } = new List(); /// /// 添加事件 @@ -162,6 +168,10 @@ namespace JdShopListener /// public RelayCommand Btn_Start { get; set; } + /// + /// 刷新数据 + /// + public RelayCommand Btn_ShowData { get; set; } /// /// 添加 @@ -171,7 +181,7 @@ namespace JdShopListener Thread addThread=new Thread(()=>{ - var detail= GetItemDetail("69920799280"); + var detail= GetItemDetail(Sku); var list = detail.product.colorSize; @@ -196,7 +206,9 @@ namespace JdShopListener //加入本地数据库 skus.Add(model); - SkuList.Add(model); + Application.Current.Dispatcher.Invoke(() => { + SkuList.Add(model); + }); } //加载sku详情 @@ -206,12 +218,29 @@ namespace JdShopListener //主图 string src = detail.product.src; + var catIds = detail.product.cat; + + List cats = new List(); + + foreach (var catId in catIds) + { + cats.Add((int)catId); + } + + string cat = string.Join(",", cats); //标题 string title = detail.product.name; + string shopId = detail.product.shopId; + + string vid= detail.product.venderId; + sku.ImgUrl = "http://img11.360buyimg.com/n1/" + src; sku.Title = title; + sku.Cat = cat; + sku.ShopId = shopId; + sku.VenderId = vid; Thread.Sleep(3000); }); @@ -240,7 +269,158 @@ namespace JdShopListener /// public void Start() { + Thread t = new Thread(() => + { + LastItemChangeList.Clear(); + LastItemChangeList = DbHelper.Db.GetLastItemChanges(); + + DoWork(); + }); + t.Start(); + } + + /// + /// 显示数据 + /// + public void ShowData() + { + Application.Current.Dispatcher.Invoke(() => + { + ItemList.Clear(); + }); + + if (SelectPro == null||SelectDate==null) + return; + + var list= DbHelper.Db.GetItemChanges(DateTime.Now.AddDays(SelectDate.Day)); + switch (SelectPro.Type) + { + case ProType.Active: + { + var data = list.Where(c => c.NewActive != c.OldActive).ToList(); + data.ForEach(item => + { + + ItemData change = new ItemData() + { + Date = item.Date, + Desc = item.Desc, + ImgUrl = item.ImgUrl, + SkuId = item.SkuId + }; + + if (item.OldActive == null) + { + item.OldActive = "[]"; + } + if (item.NewActive == null) + { + item.NewActive = "[]"; + } + change.OldProList = Newtonsoft.Json.JsonConvert.DeserializeObject>(item.OldActive); + change.NewProList = Newtonsoft.Json.JsonConvert.DeserializeObject>(item.NewActive); + + Application.Current.Dispatcher.Invoke(() => + { + ItemList.Add(change); + }); + + }); + } + break; + + case ProType.Coupons: + { + var data = list.Where(c => c.NewCoupons != c.OldCoupons).ToList(); + data.ForEach(item => + { + + ItemData change = new ItemData() + { + Date = item.Date, + Desc = item.Desc, + ImgUrl = item.ImgUrl, + SkuId = item.SkuId + }; + + if (item.OldCoupons == null) + { + item.OldCoupons = "[]"; + } + if (item.NewCoupons == null) + { + item.NewCoupons = "[]"; + } + change.OldProList = Newtonsoft.Json.JsonConvert.DeserializeObject>(item.OldCoupons); + change.NewProList = Newtonsoft.Json.JsonConvert.DeserializeObject>(item.NewCoupons); + + Application.Current.Dispatcher.Invoke(() => + { + ItemList.Add(change); + }); + }); + } + break; + + case ProType.Promotion: + { + var data = list.Where(c => c.NewPromotion != c.OldPromotion).ToList(); + data.ForEach(item => + { + + ItemData change = new ItemData() + { + Date = item.Date, + Desc = item.Desc, + ImgUrl = item.ImgUrl, + SkuId = item.SkuId + }; + + if (item.OldPromotion == null) + { + item.OldPromotion = "[]"; + } + if (item.NewPromotion == null) + { + item.NewPromotion = "[]"; + } + change.OldProList = Newtonsoft.Json.JsonConvert.DeserializeObject>(item.OldPromotion); + change.NewProList = Newtonsoft.Json.JsonConvert.DeserializeObject>(item.NewPromotion); + + Application.Current.Dispatcher.Invoke(() => + { + ItemList.Add(change); + }); + }); + } + break; + + case ProType.Price: + { + var data = list.Where(c => c.NewPrice != c.OldPrice).ToList(); + data.ForEach(item => + { + + ItemData change = new ItemData() + { + Date = item.Date, + Desc = item.Desc, + ImgUrl = item.ImgUrl, + SkuId = item.SkuId + }; + + change.OldPro = item.OldPrice.ToString(); + change.NewPro = item.NewPrice.ToString(); + + Application.Current.Dispatcher.Invoke(() => + { + ItemList.Add(change); + }); + }); + } + break; + } } /// @@ -275,7 +455,177 @@ namespace JdShopListener return null; } } - + + /// + /// 执行任务 + /// + public void DoWork() + { + //开始监控全部 + foreach (var sku in SkuList) + { + var lastSku = LastItemChangeList.FirstOrDefault(c => c.SkuId == sku.SkuId); + + if(lastSku==null) + { + lastSku = new ItemChangeModel(); + } + + ItemChangeModel item = new ItemChangeModel() + { + Date = DateTime.Now, + Desc = sku.Desc, + ImgUrl = sku.ImgUrl, + SkuId = sku.SkuId + }; + + var result = GetWareBusiness(sku); + + //价格 + decimal? price = result.price.p; + if (price == null || price == 0) + { + price = result.price.op ?? 0; + } + + item.NewPrice = (decimal)price; + + #region 活动 + var newActive = new List(); + //活动 + var miaoshaInfo = result.miaoshaInfo; + //判断是否有活动 + if (miaoshaInfo != null) + { + string miaoshaTitle = miaoshaInfo.title; + + DateTime endDate = ToDateTime((long)miaoshaInfo.endTime); + + decimal? msPrice = result.price.p; + + newActive.Add(new { title= $"{miaoshaTitle} 价格:{msPrice} 结束时间:{endDate.ToString("yyyy-MM-dd")}", value=string.Empty }); + } + + //活动 + var yuyueInfo = result.yuyueInfo; + if (yuyueInfo != null) + { + string title = "预约抢购"; + + string time = yuyueInfo.buyTime; + time = (time.Split("-")[3] + time.Split("-")[4] + time.Split("-")[5]); + //DateTime endDate = ToDateTime((long)yuyueInfo.endTime); + + decimal? msPrice = result.price.p; + + newActive.Add(new { title= $"{title} 价格:{msPrice} 结束时间:{time}", value=string.Empty }); + } + + item.NewActive = Newtonsoft.Json.JsonConvert.SerializeObject(newActive); + #endregion + + #region 促销 + + var newPromotion = new List(); + + //促销 + var promotion = result.promotion; + if (promotion != null) + { + //促销活动列表 + var activity = promotion.activity; + if (activity != null) + { + foreach (var active in activity) + { + string title = active.text; + string value = active.value; + newPromotion.Add(new { title, value }); + } + } + + + //赠品列表 + var gift = promotion.gift; + if (gift != null) + { + + string title = "赠品"; + string value = string.Empty; + foreach (var gif in gift) + { + value += gif.skuId + ","; + } + + if (!string.IsNullOrEmpty(value)) + { + + newPromotion.Add(new { title, value }); + } + } + + item.NewPromotion = Newtonsoft.Json.JsonConvert.SerializeObject( newPromotion); + } + #endregion + + #region 优惠券 + var newCoupons = new List(); + //优惠券 + var couponInfo = result.couponInfo; + if (couponInfo != null) + { + foreach (var coupon in couponInfo) + { + string title = $"满{coupon.quota}减{coupon.discount}"; + newCoupons.Add(new { title, value = string.Empty }); + } + } + + item.NewCoupons =Newtonsoft.Json.JsonConvert.SerializeObject( newCoupons); + #endregion + + //判断是否有变化 + if (lastSku.NewActive != item.NewActive||lastSku.NewCoupons!=item.NewCoupons||lastSku.NewPrice!=item.NewPrice||lastSku.NewPromotion!=item.NewPromotion) + { + item.OldActive = lastSku.NewActive; + item.OldCoupons = lastSku.OldCoupons; + item.OldPrice = lastSku.OldPrice; + item.OldPromotion = lastSku.OldPromotion; + + DbHelper.Db.AddItemChangeModel(item); + + } + + Thread.Sleep(3000); + } + } + + + private dynamic GetWareBusiness(SkuModel model) + { + string url = $"https://item-soa.jd.com/getWareBusiness?callback=jQuery6834366&skuId={model.SkuId}&cat={model.Cat}&area=19_1666_1669_0&shopId={model.ShopId}&venderId={model.VenderId}¶mJson=%7B%22platform2%22%3A%221%22%2C%22colType%22%3A0%2C%22specialAttrStr%22%3A%22p0ppp1pppppp3ppppppppppp%22%2C%22skuMarkStr%22%3A%2200%22%7D&num=1"; + + HttpClient client = new HttpClient(); + var json= client.GetStringAsync(url).Result; + json = json.Remove(0, "jQuery6834366(".Length); + json = json.Remove(json.Length - 1, 1); + + var data= Newtonsoft.Json.JsonConvert.DeserializeObject(json); + + return data; + } + + /// + /// 将时间戳转换为时间 + /// + /// + public DateTime ToDateTime(long TimeStamps) + { + var date = new DateTime(1970, 1, 1).AddMilliseconds(TimeStamps); + //new DateTime().AddMilliseconds(621355968000000000/10000).AddMilliseconds(TimeStamps);//效果同上 + return date; + } + } diff --git a/JdShopListener/JdShopListener/Migrations/20210413085518_InitialCreate.Designer.cs b/JdShopListener/JdShopListener/Migrations/20210414042219_InitialCreate.Designer.cs similarity index 71% rename from JdShopListener/JdShopListener/Migrations/20210413085518_InitialCreate.Designer.cs rename to JdShopListener/JdShopListener/Migrations/20210414042219_InitialCreate.Designer.cs index eca9ee9..7938acf 100644 --- a/JdShopListener/JdShopListener/Migrations/20210413085518_InitialCreate.Designer.cs +++ b/JdShopListener/JdShopListener/Migrations/20210414042219_InitialCreate.Designer.cs @@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace JdShopListener.Migrations { [DbContext(typeof(JdDBContext))] - [Migration("20210413085518_InitialCreate")] + [Migration("20210414042219_InitialCreate")] partial class InitialCreate { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -42,6 +42,24 @@ namespace JdShopListener.Migrations b.Property("SkuId") .HasColumnType("TEXT"); + b.Property("newActive") + .HasColumnType("TEXT"); + + b.Property("newCoupons") + .HasColumnType("TEXT"); + + b.Property("newPromotion") + .HasColumnType("TEXT"); + + b.Property("oldActive") + .HasColumnType("TEXT"); + + b.Property("oldCoupons") + .HasColumnType("TEXT"); + + b.Property("oldPromotion") + .HasColumnType("TEXT"); + b.HasKey("Id"); b.ToTable("ItemChange"); @@ -53,12 +71,18 @@ namespace JdShopListener.Migrations .ValueGeneratedOnAdd() .HasColumnType("TEXT"); + b.Property("Cat") + .HasColumnType("TEXT"); + b.Property("Desc") .HasColumnType("TEXT"); b.Property("ImgUrl") .HasColumnType("TEXT"); + b.Property("ShopId") + .HasColumnType("TEXT"); + b.Property("SkuId") .HasColumnType("TEXT"); @@ -68,6 +92,9 @@ namespace JdShopListener.Migrations b.Property("Title") .HasColumnType("TEXT"); + b.Property("VenderId") + .HasColumnType("TEXT"); + b.HasKey("Id"); b.ToTable("SkuModel"); diff --git a/JdShopListener/JdShopListener/Migrations/20210413085518_InitialCreate.cs b/JdShopListener/JdShopListener/Migrations/20210414042219_InitialCreate.cs similarity index 73% rename from JdShopListener/JdShopListener/Migrations/20210413085518_InitialCreate.cs rename to JdShopListener/JdShopListener/Migrations/20210414042219_InitialCreate.cs index 45de258..9252c0b 100644 --- a/JdShopListener/JdShopListener/Migrations/20210413085518_InitialCreate.cs +++ b/JdShopListener/JdShopListener/Migrations/20210414042219_InitialCreate.cs @@ -17,6 +17,12 @@ namespace JdShopListener.Migrations ImgUrl = table.Column(type: "TEXT", nullable: true), OldPrice = table.Column(type: "TEXT", nullable: false), NewPrice = table.Column(type: "TEXT", nullable: false), + oldActive = table.Column(type: "TEXT", nullable: true), + newActive = table.Column(type: "TEXT", nullable: true), + oldPromotion = table.Column(type: "TEXT", nullable: true), + newPromotion = table.Column(type: "TEXT", nullable: true), + oldCoupons = table.Column(type: "TEXT", nullable: true), + newCoupons = table.Column(type: "TEXT", nullable: true), Date = table.Column(type: "TEXT", nullable: false) }, constraints: table => @@ -33,7 +39,10 @@ namespace JdShopListener.Migrations ImgUrl = table.Column(type: "TEXT", nullable: true), SpuId = table.Column(type: "TEXT", nullable: true), Desc = table.Column(type: "TEXT", nullable: true), - Title = table.Column(type: "TEXT", nullable: true) + Cat = table.Column(type: "TEXT", nullable: true), + Title = table.Column(type: "TEXT", nullable: true), + ShopId = table.Column(type: "TEXT", nullable: true), + VenderId = table.Column(type: "TEXT", nullable: true) }, constraints: table => { diff --git a/JdShopListener/JdShopListener/Migrations/JdDBContextModelSnapshot.cs b/JdShopListener/JdShopListener/Migrations/JdDBContextModelSnapshot.cs index 8348778..36ed136 100644 --- a/JdShopListener/JdShopListener/Migrations/JdDBContextModelSnapshot.cs +++ b/JdShopListener/JdShopListener/Migrations/JdDBContextModelSnapshot.cs @@ -40,6 +40,24 @@ namespace JdShopListener.Migrations b.Property("SkuId") .HasColumnType("TEXT"); + b.Property("newActive") + .HasColumnType("TEXT"); + + b.Property("newCoupons") + .HasColumnType("TEXT"); + + b.Property("newPromotion") + .HasColumnType("TEXT"); + + b.Property("oldActive") + .HasColumnType("TEXT"); + + b.Property("oldCoupons") + .HasColumnType("TEXT"); + + b.Property("oldPromotion") + .HasColumnType("TEXT"); + b.HasKey("Id"); b.ToTable("ItemChange"); @@ -51,12 +69,18 @@ namespace JdShopListener.Migrations .ValueGeneratedOnAdd() .HasColumnType("TEXT"); + b.Property("Cat") + .HasColumnType("TEXT"); + b.Property("Desc") .HasColumnType("TEXT"); b.Property("ImgUrl") .HasColumnType("TEXT"); + b.Property("ShopId") + .HasColumnType("TEXT"); + b.Property("SkuId") .HasColumnType("TEXT"); @@ -66,6 +90,9 @@ namespace JdShopListener.Migrations b.Property("Title") .HasColumnType("TEXT"); + b.Property("VenderId") + .HasColumnType("TEXT"); + b.HasKey("Id"); b.ToTable("SkuModel"); diff --git a/JdShopListener/JdShopListener/Models/ItemChangeModel.cs b/JdShopListener/JdShopListener/Models/ItemChangeModel.cs index 493b940..d9c0ea7 100644 --- a/JdShopListener/JdShopListener/Models/ItemChangeModel.cs +++ b/JdShopListener/JdShopListener/Models/ItemChangeModel.cs @@ -68,115 +68,21 @@ namespace JdShopListener.Models } - private string oldActive; - /// - /// 旧活动 - /// - [NotMapped] - public List OldActive - { - get - { - return Newtonsoft.Json.JsonConvert.DeserializeObject>(oldActive); - } - - set - { - oldActive= Newtonsoft.Json.JsonConvert.SerializeObject(value); - } - } + public string OldActive { get; set; } - + public string NewActive { get; set; } - private string newActive; - /// - /// 新活动 - /// - [NotMapped] - public List NewActive - { - get - { - return Newtonsoft.Json.JsonConvert.DeserializeObject>(newActive); - } - - set - { - newActive = Newtonsoft.Json.JsonConvert.SerializeObject(value); - } - } - private string oldPromotion; - /// - /// 旧促销 - /// - [NotMapped] - public List OldPromotion - { - get - { - return Newtonsoft.Json.JsonConvert.DeserializeObject>(oldPromotion); - } - - set - { - oldPromotion = Newtonsoft.Json.JsonConvert.SerializeObject(value); - } - } + public string OldPromotion { get; set; } - private string newPromotion; - /// - /// 新促销 - /// - [NotMapped] - public List NewPromotion - { - get - { - return Newtonsoft.Json.JsonConvert.DeserializeObject>(newPromotion); - } - - set - { - newPromotion = Newtonsoft.Json.JsonConvert.SerializeObject(value); - } - } + public string NewPromotion { get; set; } - private string oldCoupons; - /// - /// 旧优惠券 - /// - [NotMapped] - public List OldCoupons - { - get - { - return Newtonsoft.Json.JsonConvert.DeserializeObject>(oldCoupons); - } - - set - { - oldCoupons = Newtonsoft.Json.JsonConvert.SerializeObject(value); - } - } - private string newCoupons; - /// - /// 新优惠券 - /// - [NotMapped] - public List NewCoupons - { - get - { - return Newtonsoft.Json.JsonConvert.DeserializeObject>(newCoupons); - } - - set - { - newCoupons = Newtonsoft.Json.JsonConvert.SerializeObject(value); - } - } + public string OldCoupons { get; set; } + + + public string NewCoupons { get; set; } + private DateTime _Date; /// diff --git a/JdShopListener/JdShopListener/Models/ItemData.cs b/JdShopListener/JdShopListener/Models/ItemData.cs index e4c7150..a92fdc5 100644 --- a/JdShopListener/JdShopListener/Models/ItemData.cs +++ b/JdShopListener/JdShopListener/Models/ItemData.cs @@ -5,24 +5,31 @@ using System.Text; namespace JdShopListener.Models { + public class ProListModel + { + public string Title { get; set; } + + public string Value { get; set; } + } + public class ItemData : ViewModelBase { - private List _OldProList; + private List _OldProList; /// /// 旧的数据变化集合 /// - public List OldProList + public List OldProList { get { return _OldProList; } set { Set(ref _OldProList, value); } } - private List _NewProList; + private List _NewProList; /// /// 新的数据变化集合 /// - public List NewProList + public List NewProList { get { return _NewProList; } set { Set(ref _NewProList, value); } diff --git a/JdShopListener/JdShopListener/Models/SkuModel.cs b/JdShopListener/JdShopListener/Models/SkuModel.cs index 000b2d9..7c9738f 100644 --- a/JdShopListener/JdShopListener/Models/SkuModel.cs +++ b/JdShopListener/JdShopListener/Models/SkuModel.cs @@ -55,6 +55,17 @@ namespace JdShopListener.Models set { Set(ref _Desc, value); } } + private string _Cat; + /// + /// 类目 + /// + public string Cat + { + get { return _Cat; } + set { Set(ref _Cat, value); } + } + + private string _Title; /// /// 标题 @@ -65,5 +76,25 @@ namespace JdShopListener.Models set { Set(ref _Title, value); } } + private string _ShopId; + /// + /// 店铺Id + /// + public string ShopId + { + get { return _ShopId; } + set { Set(ref _ShopId, value); } + } + + private string _VenderId; + /// + /// VenderId + /// + public string VenderId + { + get { return _VenderId; } + set { Set(ref _VenderId, value); } + } + } } diff --git a/JdShopListener/JdShopListener/SqlHelpers/DbHelper.cs b/JdShopListener/JdShopListener/SqlHelpers/DbHelper.cs index 09aa060..ba58f7a 100644 --- a/JdShopListener/JdShopListener/SqlHelpers/DbHelper.cs +++ b/JdShopListener/JdShopListener/SqlHelpers/DbHelper.cs @@ -109,6 +109,19 @@ namespace JdShopListener.SqlHelpers } } + /// + /// 获取全部sku最后一条变化记录 + /// + /// + public List GetLastItemChanges() + { + using (var db = new JdDBContext()) + { + return db.ItemChanges.ToList().GroupBy(c => c.SkuId).Select(c=>c.OrderByDescending(c => c.Date).FirstOrDefault()).ToList(); + } + + } + /// /// 根据日期批量获取变化记录 diff --git a/JdShopListener/JdShopListener/db/items.db b/JdShopListener/JdShopListener/db/items.db index bd2bdaa0c533690dd8b987184110e4804585abef..5752b3a8e6820f2043843070b8b34bb5206ee31c 100644 GIT binary patch delta 308 zcmZp8z}WDBaY80PcRT~%CH}QMr}^e`$MekE*!Y}_tI2|uU0ha{vBi0EGS3xe=fsl9 zD!j^?I=oy8K%f+ykze4MqNEVw8WE!47wY2!lL$-AOGz#AOqp!MYtPl}&&)2asL0rs zxw(~>iLpLEC&e+jB(p3Pi^java-4ENeE~)Jx%nlT`FYs2;*$pIcFr#?$j?(Q#;zG6 f3z6Jh$(Jk0Zen0!WMpW$`K|mvemLioKA!^sW<*x) delta 101 zcmZp8z}WDBaY80PPb351CH}R%)qHb#B6+