From 68af68bf2993e1c29b9165f549723701fe03a509 Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期三, 19 三月 2025 17:02:16 +0800
Subject: [PATCH] 合并

---
 LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs               |    5 +++++
 LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs |    5 +++++
 LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs                   |    6 ++++++
 LifePayment/LifePayment.Application/User/AccountService.cs                      |    8 +++++---
 LifePayment/LifePayment.Domain/Common/ChannelFilter.cs                          |    2 +-
 5 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs b/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
index b880d90..3f7d519 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/CreateBackClientUserInput.cs
@@ -12,6 +12,11 @@
         public string Name { get; set; }
 
         /// <summary>
+        /// 瀵嗙爜
+        /// </summary>
+        public string Password { get; set; }
+
+        /// <summary>
         /// 鎵嬫満鍙�
         /// </summary>
         public string PhoneNumber { get; set; }
diff --git a/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs b/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
index 9e766f5..386b8ae 100644
--- a/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
+++ b/LifePayment/LifePayment.Application.Contracts/User/QrCodeLogin.cs
@@ -50,6 +50,11 @@
         public string Name { get; set; }
 
         /// <summary>
+        /// 瀵嗙爜
+        /// </summary>
+        public string Password { get; set; }
+
+        /// <summary>
         /// 鐢ㄦ埛鍚�
         /// </summary>
         [RegularExpression(LifePaymentConstant.RegularExpression.UserNameEx, ErrorMessage = "璐﹀彿鏍煎紡涓嶆纭�")]
diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index 0837679..2c46855 100644
--- a/LifePayment/LifePayment.Application/User/AccountService.cs
+++ b/LifePayment/LifePayment.Application/User/AccountService.cs
@@ -134,7 +134,7 @@
             return result;
         }
 
-        public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false, string password = null)
+        public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false)
         {
             if (input.ClientId == LifePaymentConstant.ClientId.Back)
             {
@@ -146,8 +146,10 @@
             CheckExtensions.IfTrueThrowUserFriendlyException(any,
                                                              CustomeErrorMessage.PhoneNumberRepeatSaveFail);
 
-            password ??= GlobalRandom.GetRandomPassword();
+            /// input.Password ??= GlobalRandom.GetRandomPassword();
 
+            CheckExtensions.IfTrueThrowUserFriendlyException(string.IsNullOrEmpty(input.Password),
+                                                             "璇疯緭鍏ュ瘑鐮�");
             var res = await _identityUserService.CreateAsync(new IdentityUserCreateDto
             {
                 Name = input.Name,
@@ -155,7 +157,7 @@
                 UserName = input.UserName,
                 RoleNames = input.RoleNames,
                 ClientId = input.ClientId,
-                Password = password,
+                Password = input.Password,
             });
             var user = await _userRepository.InsertAsync(new User
             {
diff --git a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs
index 11cde80..6a00c6f 100644
--- a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs
+++ b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs
@@ -23,7 +23,7 @@
             if (CurrentUser.ClientId == Constant.ClientType.Back)
             {
                 var queryUser = UserChannleRepository.Where(r => r.UserId == CurrentUser.Id).Select(s => s.ChannleId).ToList();
-                var queryResult = query.Where(s => (s.ChannelId.HasValue && queryUser.Contains(s.ChannelId.Value)) || !s.ChannelId.HasValue);
+                var queryResult = query.Where(s => (s.ChannelId && queryUser.Contains(s.ChannelId.Value)) || !s.ChannelId.HasValue);
                 return queryResult;
             }
 
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
index aec1d39..b1413ec 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/UserRoleController.cs
@@ -62,12 +62,18 @@
         [HttpPost]
         public async Task<int> UpdateBackClientUser(UpdateBackClientUserInput input)
         {
+
+            var identityUser = await _identityUserService.GetAsync(input.Id);
+
+            CheckExtensions.IfTrueThrowUserFriendlyException(identityUser == null,
+                                                             "鐢ㄦ埛涓嶅瓨鍦�");
             await _identityUserService.UpdateAsync(input.Id, new IdentityUserUpdateDto
             {
                 Name = input.Name,
                 PhoneNumber = input.PhoneNumber,
                 UserName = input.UserName,
                 RoleNames = input.RoleNames,
+                Password = input.Password,
             });
             return await _userRoleService.UpdateBackClientUser(input);
         }

--
Gitblit v1.9.1