private void SecondCheckWrongData() { using (var client = new Service.Activity.FlashSaleClient()) { var clientResult = client.SelectFlashSaleWrongCache(); var result = clientResult.Result; if (result.Any()) { var getResult = GetResult(result); var logResults = getResult.Item1; var dbResults = getResult.Item2; var cacheResults = getResult.Item3; if (logResults.Any()) { var htmlStringdb = GenerateHtmlString(logResults); MailService.SendMail("配置表的销量跟历史纪录表不一致=》有问题活动产品2", "*****@*****.**", htmlStringdb); } if (cacheResults.Any()) { var htmlStringcache = GenerateHtmlString(cacheResults); MailService.SendMail("缓存跟数据库记录的销量不符=》有问题活动产品2", "*****@*****.**", htmlStringcache); } if (dbResults.Any()) { var htmlStringdb = GenerateHtmlString(dbResults); MailService.SendMail("配置的总量小于了已经售出的产品数量=》有问题活动产品2", "*****@*****.**", htmlStringdb); } else { Logger.Info("无有问题活动产品,故无需邮件发送"); } } } }
private void FirstCheckWrongData() { using (var client = new Service.Activity.FlashSaleClient()) { var clientResult = client.SelectFlashSaleWrongCache(); var result = clientResult.Result; var getResult = GetResult(result); var logResults = getResult.Item1; var dbResults = getResult.Item2; var cacheResults = getResult.Item3; if (result.Any()) { if (logResults.Any()) { var htmlStringdb = GenerateHtmlString(logResults); MailService.SendMail("配置表的销量跟历史纪录表不一致=》有问题活动产品", "*****@*****.**", htmlStringdb); var models = new List <UpdateQuantityProductModel>(); foreach (var log in logResults) { foreach (var cp in log.CacheProducts) { models.Add(new UpdateQuantityProductModel() { ActivityId = new Guid(log.ActiivtyId), Pid = cp.Pid }); } } var updateClient = client.UpdateConfigSaleoutQuantityFromLog(new UpdateConfigSaleoutQuantityRequest() { RefreshType = RefreshType.RefreshByPid, ProductModels = models }); if (!updateClient.Success) { Logger.Error("更新限时抢购配置数据失败,请排查日志查找原因"); } } if (cacheResults.Any()) { var htmlStringcache = GenerateHtmlString(cacheResults); MailService.SendMail("缓存跟数据库记录的销量不符=》有问题活动产品", "*****@*****.**", htmlStringcache); var cacheclient = client.RefreshFlashSaleHashCount( cacheResults.Select(r => r.ActiivtyId.ToString()).ToList(), false); if (!cacheclient.Success) { Logger.Error("更新限时抢购缓存数据失败,请排查日志查找原因"); } } if (dbResults.Any()) { var htmlStringdb = GenerateHtmlString(dbResults); MailService.SendMail("配置的总量小于了已经售出的产品数量=》有问题活动产品", "*****@*****.**", htmlStringdb); } else { Logger.Info("无有问题活动产品,故无需邮件发送"); } } } }