From 2fb049ae2f0560c87b2e53fbdc5b588e64fa565e Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期二, 01 四月 2025 11:11:43 +0800
Subject: [PATCH] fix: 修改GetBackClientUsers中的UserChannleDto

---
 LifePayment/LifePayment.Application/User/UserRoleService.cs |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/LifePayment/LifePayment.Application/User/UserRoleService.cs b/LifePayment/LifePayment.Application/User/UserRoleService.cs
index be79492..6a93332 100644
--- a/LifePayment/LifePayment.Application/User/UserRoleService.cs
+++ b/LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -62,7 +62,8 @@
                            from c in _channleRepository.Where(s => s.ChannlesNum == uc.ChannleId)
                         select new UserChannleDto
                         {
-                            Id = c.ChannlesNum,
+                            Id = c.Id,
+                            ChannlesNum = c.ChannlesNum,
                             Name = c.ChannlesName,
                         },
                 Remark = u.Remark,
@@ -103,10 +104,16 @@
             List<UserChannle> userChannles = new List<UserChannle>();
             foreach (var item in input.ChannlesId)
             {
+                var channleNum = item;
+                if (IsGuid(channleNum))
+                {
+                    channleNum = await _channleRepository.Where(x => x.Id == Guid.Parse(item)).Select(s => s.ChannlesNum).FirstOrDefaultAsync();
+                }
+
                 userChannles.Add(new UserChannle()
                 {
                     Id = Guid.NewGuid(),
-                    ChannleId = item,
+                    ChannleId = channleNum,
                     UserId = entity.Id
                 });
             }
@@ -221,5 +228,11 @@
             await _roleRepository.DeleteAsync(id);
             return Constant.SUCCESS;
         }
+
+        private bool IsGuid(string input)
+        {
+            Guid guidOutput;
+            return Guid.TryParse(input, out guidOutput);
+        }
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1