From 1447caa6b184ee1e80970740e30fa970c3d08a78 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期一, 31 三月 2025 13:54:38 +0800
Subject: [PATCH] Merge branch 'dev-lifepay-v1.3' of http://120.26.58.240:8888/r/LifePaymentApi into dev-lifepay-v1.3

---
 LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs      |    2 
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs     |   17 ++++++++
 LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml |   10 +++++
 LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs              |    6 +-
 LifePayment/LifePayment.Application/User/AccountService.cs                 |   34 ++++++++--------
 LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml                |    4 +-
 6 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
index a87c39d..ceb6dc1 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
@@ -1175,6 +1175,23 @@
     public string Name { get; set; }
 
     public string ChannlesNum { get; set; }
+
+    public Guid ChannlesId { get; set; }
+}
+
+public class BackClientUserInfoOutput
+{
+    /// <summary>
+    /// 鏄惁鏄悗鍙扮敤鎴�
+    /// </summary>
+    public bool IsBackClientUser { get; set; }
+
+    public bool IsSystem { get; set; }
+
+    /// <summary>
+    /// 娓犻亾鍙�
+    /// </summary>
+    public List<ChannelOutput> ChannleList { get; set; }
 }
 
 public class LifePayExpensesReceiptsListOutput
diff --git a/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs b/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
index 9af1f4e..99f11c1 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
@@ -34,7 +34,7 @@
 
         Task<Guid> CreateAccount(CreateAccountInput input, bool isSend = false, bool isAdminCreate = false);
 
-        Task<List<ChannelOutput>> GetUserChannel();
+        Task<BackClientUserInfoOutput> GetBackClientUserInfo();
         #endregion
     }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index 7ba7018..58f2164 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;
@@ -93,25 +94,24 @@
             return result;
         }
 
-        public async Task<List<ChannelOutput>> GetUserChannel()
+        public async Task<BackClientUserInfoOutput> GetBackClientUserInfo()
         {
-            var userchannel = await _userChannleRep.Where(x => x.UserId == CurrentUser.Id)
-                .Select(s => new ChannelOutput()
-                {
-                    Name = _lifePayChannlesRepository.Where(x => x.ChannlesNum == s.ChannleId).Select(r => r.ChannlesName).FirstOrDefault(),
-                    ChannlesNum = s.ChannleId
-                }).ToListAsync();
-            if (userchannel.Count() == 0)
-            {
-                userchannel = await _lifePayChannlesRepository
-               .Select(s => new ChannelOutput()
-               {
-                   Name = s.ChannlesName,
-                   ChannlesNum = s.ChannlesNum
-               }).ToListAsync();
-            }
+            var channlesNums = await _userChannleRep.Where(x => x.UserId == CurrentUser.Id).Select(s => s.ChannleId).Distinct().ToListAsync();
 
-            return userchannel;
+            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;
         }
 
 
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index e545425..009d3b5 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -534,9 +534,9 @@
             <param name="id">瑙掕壊Id</param>
             <returns></returns>
         </member>
-        <member name="M:LifePayment.HttpApi.UserRoleController.GetUserChannel">
+        <member name="M:LifePayment.HttpApi.UserRoleController.GetBackClientUserInfo">
             <summary>
-            鑾峰彇鐢ㄦ埛娓犻亾
+            鑾峰彇鐢ㄦ埛璐﹀彿璇︽儏
             </summary>
             <returns></returns>
         </member>
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index 6a12b8b..1b61f78 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -1761,6 +1761,16 @@
             娓犻亾鍙�
             </summary>
         </member>
+        <member name="P:LifePayment.Application.Contracts.BackClientUserInfoOutput.IsBackClientUser">
+            <summary>
+            鏄惁鏄悗鍙扮敤鎴�
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.BackClientUserInfoOutput.ChannleList">
+            <summary>
+            娓犻亾鍙�
+            </summary>
+        </member>
         <member name="P:LifePayment.Application.Contracts.LifePayExpensesReceiptsListOutput.Id">
             <summary>
             缂栧彿
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
index 48a0385..2be205b 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
@@ -202,13 +202,13 @@
         }
 
         /// <summary>
-        /// 鑾峰彇鐢ㄦ埛娓犻亾
+        /// 鑾峰彇鐢ㄦ埛璐﹀彿璇︽儏
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public async Task<List<ChannelOutput>> GetUserChannel()
+        public async Task<BackClientUserInfoOutput> GetBackClientUserInfo()
         {
-            return await _accountService.GetUserChannel();
+            return await _accountService.GetBackClientUserInfo();
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1