From 65beca31c74c6313519ba51ac2a3302659172eab Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期一, 31 三月 2025 10:40:04 +0800
Subject: [PATCH] fix:新增渠道查询接口

---
 LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs |    3 +++
 LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs     |    1 +
 LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs         |   15 ++++++++++-----
 LifePayment/LifePayment.Application/User/AccountService.cs            |   25 +++++++++++++++++++++----
 LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml           |    6 ++++++
 5 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs b/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
index 1059078..9af1f4e 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Collections.Generic;
 using System.Threading.Tasks;
 using Volo.Abp;
 using Volo.Abp.Application.Services;
@@ -32,6 +33,8 @@
         Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp);
 
         Task<Guid> CreateAccount(CreateAccountInput input, bool isSend = false, bool isAdminCreate = false);
+
+        Task<List<ChannelOutput>> GetUserChannel();
         #endregion
     }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs b/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
index 0f96d68..19822f8 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
@@ -128,4 +128,5 @@
         /// </summary>
         public Guid? DepartmentOrgId { get; set; }
     }
+    
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index 43aeddb..7ba7018 100644
--- a/LifePayment/LifePayment.Application/User/AccountService.cs
+++ b/LifePayment/LifePayment.Application/User/AccountService.cs
@@ -92,10 +92,27 @@
 
             return result;
         }
-        //public async Task<UserChannelOutput> GetUserChannel()
-        //{
-        //    var userchannel = await _userChannleRep.Where
-        //}
+
+        public async Task<List<ChannelOutput>> GetUserChannel()
+        {
+            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();
+            }
+
+            return userchannel;
+        }
 
 
         #endregion
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index 9d1f2ee..c696fbb 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -521,6 +521,12 @@
             <param name="id">瑙掕壊Id</param>
             <returns></returns>
         </member>
+        <member name="M:LifePayment.HttpApi.UserRoleController.GetUserChannel">
+            <summary>
+            鑾峰彇鐢ㄦ埛娓犻亾
+            </summary>
+            <returns></returns>
+        </member>
         <member name="M:LifePayment.HttpApi.WxPayNotifyController.WxRechargeNotify(LifePayment.Application.Contracts.WxRechargeNotifyInput)">
             <summary>
             寰俊鏀粯鍥炶皟閫氱煡
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
index 7bf8650..48a0385 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
@@ -3,6 +3,7 @@
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using System;
+using System.Collections.Generic;
 using System.Threading.Tasks;
 using Volo.Abp.AspNetCore.Mvc;
 using Volo.Abp.Identity;
@@ -200,10 +201,14 @@
             return await _userRoleService.DeleteRole(id);
         }
 
-        //[HttpGet]
-        //public async Task<UserChannelOutput> GetUserChannel()
-        //{
-        //    return await _accountService.GetUserChannel();
-        //}
+        /// <summary>
+        /// 鑾峰彇鐢ㄦ埛娓犻亾
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        public async Task<List<ChannelOutput>> GetUserChannel()
+        {
+            return await _accountService.GetUserChannel();
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1