From dbf044662b9a75e5b42f8f76c65faaf89c95bb21 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期三, 02 四月 2025 19:36:48 +0800
Subject: [PATCH] fix:bug修复

---
 LifePayment/LifePayment.Application/LifePay/StatisticsService.cs |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
index f76e87e..c526c4b 100644
--- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
@@ -20,6 +20,7 @@
 using ZeroD.Util;
 using NPOI.SS.Formula.Functions;
 using System.Security.Principal;
+using StackExchange.Redis;
 
 namespace LifePayment.Application.LifePay
 {
@@ -199,8 +200,10 @@
         {
 
             var statistics = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false)
-                            .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId))
-                            .ToListAsync();
+                            .WhereIf(channleList != null && channleList.Count() > 0, x => channleList.Contains(x.ChannelId))
+            .ToListAsync();
+
+            CheckExtensions.IfTrueThrowUserFriendlyException(statistics == null, "缁熻澶辫触");
             var groupedStatistics = statistics
                .GroupBy(x => x.ChannelId)
                .Select(g => new
@@ -218,7 +221,7 @@
             {
                 ChannelDataReceive receive = new ChannelDataReceive()
                 {
-                    ChannelName = _lifePayChannlesRep.Where(x => x.ChannlesNum == item.ChannelId).FirstOrDefault().ChannlesName,
+                    ChannelName = _lifePayChannlesRep.Where(x => x.ChannlesNum == item.ChannelId).FirstOrDefault()?.ChannlesName,
                     ReceivePrice = item.ReceivePrice,
                     ChannlesRakePrice = item.ChannlesRakePrice,
                 };
@@ -244,7 +247,7 @@
             {
                 ChannelDataUserNumber usernumber = new ChannelDataUserNumber()
                 {
-                    ChannelName = _lifePayChannlesRep.Where(x => x.ChannlesNum == item.ChannelId).FirstOrDefault().ChannlesName,
+                    ChannelName = _lifePayChannlesRep.Where(x => x.ChannlesNum == item.ChannelId).FirstOrDefault()?.ChannlesName,
                     Number = item.Number,
                 };
                 if (channelDataList.UserNumberList.Count() < 5)
@@ -310,7 +313,8 @@
             var yesterdayFail = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆�)
                 .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.ChannelId == channleId).CountAsync();
             /// 绱鐢ㄦ埛
-            var accumulatedUsers = await _lifePayUserRepository.Where(x => x.IsDeleted == false).WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.CreationChannleNum == channleId).CountAsync();
+            var accumulatedUsers = await _lifePayUserRepository.Where(x => x.IsDeleted == false && x.CreationTime < today)
+                .WhereIf(!string.IsNullOrWhiteSpace(channleId), x => x.CreationChannleNum == channleId).CountAsync();
             /// 鏄ㄦ棩娲昏穬鐢ㄦ埛
             var yesterdayActiveUsers = await (from a in _lifePayUserRepository
                                               join b in _lifePayOrderRepository on a.Id equals b.UserId

--
Gitblit v1.9.1