From 6831e003276b2d582d9f242462c3dde23d29285c Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期三, 19 三月 2025 14:32:30 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi

---
 LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs      |    5 +++++
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs |    4 ++--
 LifePayment/LifePayment.Domain/LifePay/LifePayUser.cs                  |    4 ++--
 LifePayment/LifePayment.Application/User/AccountService.cs             |   19 ++++++++++++++++++-
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs          |    5 ++---
 5 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
index 38e0d09..853c9a4 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
@@ -127,12 +127,12 @@
     /// <summary>
     /// 鏈�鍚庣櫥褰曟笭閬�
     /// </summary>
-    public string CreationChannle { get; set; }
+    public string? CreationChannle { get; set; }
 
     /// <summary>
     /// 鏈�鍚庣櫥褰曟笭閬�
     /// </summary>
-    public string LastLoginChannle { get; set; }
+    public string? LastLoginChannle { get; set; }
 
     public DateTime? LastLoginTime { get; set; }
 
diff --git a/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs b/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
index de67ea7..2a96375 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
@@ -75,6 +75,11 @@
         public string[] RoleNames { get; set; }
 
         /// <summary>
+        /// 娓犻亾鍒楄〃
+        /// </summary>
+        public Guid[] ChannlesId { get; set; }
+
+        /// <summary>
         /// 灏忕▼搴廜penId
         /// </summary>
         public string OpenId { get; set; }
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index df3cda1..f87e0a1 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -171,13 +171,12 @@
     /// <returns></returns>
     public async Task<PageOutput<UserListOutput>> GetUserPage(PageInput input)
     {
-        var channel = await _lifePayChannlesRep.ToListAsync();
         return await _lifePayUserRepository.Select(x =>
                                                    new UserListOutput()
                                                    {
                                                        Id = x.Id,
-                                                       //CreationChannle = string.IsNullOrEmpty(x.CreationChannleNum) ? "" : channel.Where(c => c.ChannlesNum == x.CreationChannleNum).FirstOrDefault().ChannlesName,
-                                                       //LastLoginChannle = string.IsNullOrEmpty(x.LastLoginChannleNum) ? "" : channel.Where(c => c.ChannlesNum == x.LastLoginChannleNum).FirstOrDefault().ChannlesName,
+                                                       CreationChannle = string.IsNullOrEmpty(x.CreationChannleNum) ? "" : _lifePayChannlesRep.Where(c => c.ChannlesNum == x.CreationChannleNum).FirstOrDefault().ChannlesName,
+                                                       LastLoginChannle = string.IsNullOrEmpty(x.LastLoginChannleNum) ? "" : _lifePayChannlesRep.Where(c => c.ChannlesNum == x.LastLoginChannleNum).FirstOrDefault().ChannlesName,
                                                        PhoneNumber = x.PhoneNumber,
                                                        CreationTime = x.CreationTime,
                                                        LastLoginTime = x.LastLoginTime
diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index bf2d4e3..0837679 100644
--- a/LifePayment/LifePayment.Application/User/AccountService.cs
+++ b/LifePayment/LifePayment.Application/User/AccountService.cs
@@ -6,6 +6,7 @@
 using Microsoft.EntityFrameworkCore;
 using Microsoft.Extensions.Configuration;
 using System;
+using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
 using Volo.Abp;
@@ -27,6 +28,7 @@
         private readonly IConfiguration _configuration;
         private readonly IIdentityModelAuthenticationService _authenticator;
         private readonly IRepository<User, Guid> _userRepository;
+        private readonly IRepository<UserChannle, Guid> _userChannleRep;
         private readonly IIdentityUserAppService _identityUserService;
 
         public AccountService(
@@ -35,7 +37,8 @@
                IIdentityModelAuthenticationService authenticator,
                IRepository<User, Guid> userRepository,
                IIdentityUserAppService identityUserService,
-               IRepository<LifePayUser, Guid> lifePayUserRepository)
+               IRepository<LifePayUser, Guid> lifePayUserRepository,
+               IRepository<UserChannle, Guid> userChannleRep)
         {
             _configuration = configuration;
             _wxManager = wxManager;
@@ -43,6 +46,7 @@
             _lifePayUserRepository = lifePayUserRepository;
             _authenticator = authenticator;
             _userRepository = userRepository;
+            _userChannleRep = userChannleRep;
         }
 
         #region 鏌ヨ
@@ -170,6 +174,19 @@
                 DepartmentOrgId = input.ClientId == LifePaymentConstant.ClientId.Back ? input.DepartmentOrgId : null,
                 CompanyOrgId = input.ClientId == LifePaymentConstant.ClientId.Back ? input.CompanyOrgId : null
             });
+
+            List<UserChannle> userChannles = new List<UserChannle>();
+            foreach (var item in input.ChannlesId)
+            {
+                userChannles.Add(new UserChannle()
+                {
+                    Id = Guid.NewGuid(),
+                    ChannleId = item,
+                    UserId = user.Id
+                });
+            }
+
+            await _userChannleRep.InsertManyAsync(userChannles);
             //if (input.ClientId == Constant.ClientType.Back)
             //{
             //    await _distributedEventBus.PublishAsync(new SendPhoneMessageInput
diff --git a/LifePayment/LifePayment.Domain/LifePay/LifePayUser.cs b/LifePayment/LifePayment.Domain/LifePay/LifePayUser.cs
index e326820..5540d1f 100644
--- a/LifePayment/LifePayment.Domain/LifePay/LifePayUser.cs
+++ b/LifePayment/LifePayment.Domain/LifePay/LifePayUser.cs
@@ -23,7 +23,7 @@
         /// <summary>
         /// 娉ㄥ唽娓犻亾缂栧彿
         /// </summary>
-        public string CreationChannleNum { get; set; }
+        public string? CreationChannleNum { get; set; }
 
         public string UnionId { get; set; }
 
@@ -32,6 +32,6 @@
         /// <summary>
         /// 鏈�鍚庣櫥褰曟笭閬撶紪鍙�
         /// </summary>
-        public string LastLoginChannleNum { get; set; }
+        public string? LastLoginChannleNum { get; set; }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1