private static void Done(List <int> data) { if (data.Any()) { var num = 1; Stopwatch sw = new Stopwatch(); sw.Start(); foreach (var item in data) { using (var client = new OrderQueryClient()) { var dat = client.GetRelatedSplitOrderIDs(item, SplitQueryType.Full); if (dat.Success && dat.Result.Count() == 1) { using (var client2 = new ShopCommentClient()) { var result = client2.SetShopCommentStatus(item); if (result.Success == false || result.Result == false) { OrderDataLogger.Warn($"重置订单号为{item}的数据失败"); } } } } if (num % 20 == 0) { sw.Stop(); OrderDataLogger.Info($"重置异常订单第{num - 20}到{num}条,共{data.Count},用时{sw.ElapsedMilliseconds}"); sw.Reset(); sw.Start(); } num += 1; } } }
public JsonResult ResetCommentStatus(int orderId) { using (var client = new ShopCommentClient()) { var result = client.SetShopCommentStatus(orderId); if (result.Success && result.Result) { return(Json($"重置成功{result.Success},{orderId}", JsonRequestBehavior.AllowGet)); } else { return(Json($"失败{result.Success},{orderId}", JsonRequestBehavior.AllowGet)); } } }