From 5bc4a0340f55124ebe5b87e393f42d8e96d837b6 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 31 三月 2025 14:37:05 +0800
Subject: [PATCH] fix: 调整ChannelOutput

---
 LifePayment/LifePayment.Application/User/AccountService.cs |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index 43aeddb..1e32b00 100644
--- a/LifePayment/LifePayment.Application/User/AccountService.cs
+++ b/LifePayment/LifePayment.Application/User/AccountService.cs
@@ -9,6 +9,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Linq.Dynamic.Core;
 using System.Threading.Tasks;
 using Volo.Abp;
 using Volo.Abp.Application.Services;
@@ -92,10 +93,26 @@
 
             return result;
         }
-        //public async Task<UserChannelOutput> GetUserChannel()
-        //{
-        //    var userchannel = await _userChannleRep.Where
-        //}
+
+        public async Task<BackClientUserInfoOutput> GetBackClientUserInfo()
+        {
+            var channlesNums = await _userChannleRep.Where(x => x.UserId == CurrentUser.Id).Select(s => s.ChannleId).Distinct().ToListAsync();
+
+            var channleList = await _lifePayChannlesRepository.Where(x => channlesNums.Contains(x.ChannlesNum)).Select(s => new ChannelOutput()
+            {
+                Name = s.ChannlesName,
+                ChannlesId = s.Id,
+                ChannlesNum = s.ChannlesNum
+            }).ToListAsync();
+
+            BackClientUserInfoOutput result = new BackClientUserInfoOutput()
+            {
+                IsBackClientUser = CurrentUser.ClientId == Constant.ClientType.Back,
+                IsSystem = CurrentUser.IsSystem,
+                ChannleList = channleList
+            };
+            return result;
+        }
 
 
         #endregion
@@ -140,12 +157,13 @@
             && x.PhoneNumber == input.PhoneNumber).FirstOrDefaultAsync();
             if (backClientUser != null)
             {
-                channlesNum = await _userChannleRep.Where(x => x.UserId == backClientUser.Id)
-                     .Select(s => new ChannelOutput()
-                     {
-                         Name = _lifePayChannlesRepository.Where(x => x.ChannlesNum == s.ChannleId).Select(r => r.ChannlesName).FirstOrDefault(),
-                         ChannlesNum = s.ChannleId
-                     }).ToListAsync();
+                var channlesNums = await _userChannleRep.Where(x => x.UserId == backClientUser.Id).Select(s => s.ChannleId).Distinct().ToListAsync();
+                channlesNum = await _lifePayChannlesRepository.Where(x => channlesNums.Contains(x.ChannlesNum)).Select(s => new ChannelOutput()
+                {
+                    Name = s.ChannlesName,
+                    ChannlesId = s.Id,
+                    ChannlesNum = s.ChannlesNum
+                }).ToListAsync();
             }
 
             var result = await LifePayUserMesssageByPhone(lifeUser.PhoneNumber);

--
Gitblit v1.9.1