예제 #1
0
 public void RefreshAllPids()
 {
     try
     {
         Logger.Info($"开始刷新");
         var datas = DalFlashSale.SelectAllSaleActivity() ?? new List <Models.FlashSaleProductModel>();
         Logger.Info($"总数:{datas.Count}");
         if (!datas.Any())
         {
             return;
         }
         var pidCacheHour     = 12; // pid缓存小时数
         var prefixCacheHour  = 12; //前缀缓存小时数
         var index            = 0;
         var productInterface = new ProductInterface(Logger);
         var prefix           = (DateTime.Now - DateTime.MinValue).TotalMilliseconds.ToString();
         var errorPids        = new List <string>();
         datas.Select(r => r.Pid).Split(100).Select(p => p.ToList())
         .ForEach(pids =>
         {
             errorPids.AddRange(
                 AsyncHelper.RunSync(
                     () => productInterface.RefreshProductSaleActivityCacheByPidsWithPrefixAsync(
                         pids, prefix, pidCacheHour)));
             Logger.Info($"第{++index}批刷新完成");
             Thread.Sleep(50);
         });
         Logger.Info($"刷新完成,失败数:{errorPids.Count}");
         var result = AsyncHelper.RunSync(
             () => productInterface.ResetPrefixForProductSaleActivityCacheByPidsCacheAsync(
                 prefix, prefixCacheHour));
         Logger.Info($"重置缓存-->result:{result}");
     }
     catch (Exception e)
     {
         Logger.Error($"刷新异常", e);
     }
 }
예제 #2
0
 public ProductController(ProductInterface accountReposite)
 {
     _context = accountReposite;
 }
예제 #3
0
 public GraphStoryService(ContentInterface contentInterface, LocationInterface locationInterface, ProductInterface productInterface, PurchaseInterface purchaseInterface, TagInterface tagInterface, UserInterface userInterface)
 {
     this.contentInterface  = contentInterface;
     this.locationInterface = locationInterface;
     this.productInterface  = productInterface;
     this.purchaseInterface = purchaseInterface;
     this.tagInterface      = tagInterface;
     this.userInterface     = userInterface;
 }