Exemplo n.º 1
0
 public ActionResult ExamActivity(Guid aid)
 {
     try
     {
         var result = QiangGouManager.ExamActivity(aid);
         if (result > 0)
         {
             var del = SeckillManager.DeleteStatusData(aid.ToString());
             if (del > 0)
             {
                 result = 1;
             }
         }
         if (result > 0)
         {
             SeckillManager.OpertionLogs(SeckillManager.OpertionType.ApprovePass, "", "", aid.ToString());
         }
         return(Json(new
         {
             code = result
         }));
     }
     catch (Exception e)
     {
         return(Json(new
         {
             code = -3,
             msg = e.Message + e.InnerException + e.StackTrace
         }));
     }
 }
Exemplo n.º 2
0
 public ActionResult ExamActivity(Guid aid)
 {
     try
     {
         var cacheGetFlag = GetOperateFlagCache();
         if (cacheGetFlag)
         {
             return(Json(new { Status = 0, Message = "现在有人正在操作请稍等下。。。。" }));
         }
         var cacheSetStartFlag = SetOperateFlagStartCache();
         if (!cacheSetStartFlag)
         {
             return(Json(new { Status = 0, Message = "服务器异常,请再点击审核" }));
         }
         var origin = QiangGouManager.FetchQiangGouAndProducts(aid) ?? new QiangGouModel();
         var result = QiangGouManager.ExamActivity(aid);
         if (result > 0)
         {
             var after       = QiangGouManager.FetchQiangGouAndProducts(aid);
             var chandata    = LogChangeDataManager.GetLogChangeData(origin, after);
             var beforeValue = QiangGouManager.GenerateSimpleQiangGouModel(chandata.Item1);
             var afterValue  = QiangGouManager.GenerateSimpleQiangGouModel(chandata.Item2);
             var oprLog      = new FlashSaleProductOprLog();
             oprLog.OperateUser    = ThreadIdentity.Operator.Name;
             oprLog.CreateDateTime = DateTime.Now;
             oprLog.BeforeValue    = JsonConvert.SerializeObject(beforeValue);
             oprLog.AfterValue     = JsonConvert.SerializeObject(afterValue);
             oprLog.LogType        = "FlashSaleLog";
             oprLog.LogId          = after.ActivityID.ToString();
             oprLog.Operation      = "审核活动";
             LoggerManager.InsertLog("FlashSaleOprLog", oprLog);
             LoggerManager.InsertFlashSaleLog(chandata.Item1, beforeValue.HashKey);
             LoggerManager.InsertFlashSaleLog(chandata.Item2, afterValue.HashKey);
             UpdateToCache(aid, false, origin.ActiveType);
         }
         //throw new Exception();
         return(Json(new
         {
             code = result
         }));
     }
     catch (Exception e)
     {
         return(Json(new
         {
             code = -3,
             msg = e.Message + e.InnerException + e.StackTrace
         }));
     }
     finally
     {
         SetOperateFlagEndCache();
     }
 }
Exemplo n.º 3
0
 public ActionResult ExamActivity(Guid aid)
 {
     try
     {
         var result = QiangGouManager.ExamActivity(aid);
         if (result > 0)
         {
             var del = SeckillManager.DeleteStatusData(aid.ToString());
             if (del > 0)
             {
                 result = 1;
             }
         }
         if (result > 0)
         {
             using (var client = new CacheClient())
             {
                 var cacheresult = client.RefreshRedisCachePrefixForCommon(new RefreshCachePrefixRequest()
                 {
                     Prefix     = "SecondKillPrefix",
                     ClientName = "FlashSale",
                     Expiration = TimeSpan.FromDays(1)
                 });
                 cacheresult.ThrowIfException(true);
             }
             var cache = QiangGouManager.ReflashQiangGouCache(aid, false, 1);
             if (cache == false)
             {
                 return(Json(new { Status = 0, Message = "刷新缓存失败【请手动刷新】" }));
             }
             SeckillManager.OpertionLogs(SeckillManager.OpertionType.ApprovePass, "", "", aid.ToString());
         }
         return(Json(new
         {
             code = result
         }));
     }
     catch (Exception e)
     {
         return(Json(new
         {
             code = -3,
             msg = e.Message + e.InnerException + e.StackTrace
         }));
     }
 }