From 481c2276623c9f12ce5452334422b8b1322fed45 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 31 三月 2025 10:14:53 +0800
Subject: [PATCH] fix: bug
---
LifePayment/LifePayment.Application/User/UserRoleService.cs | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/LifePayment/LifePayment.Application/User/UserRoleService.cs b/LifePayment/LifePayment.Application/User/UserRoleService.cs
index be79492..3d3e22f 100644
--- a/LifePayment/LifePayment.Application/User/UserRoleService.cs
+++ b/LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -62,7 +62,7 @@
from c in _channleRepository.Where(s => s.ChannlesNum == uc.ChannleId)
select new UserChannleDto
{
- Id = c.ChannlesNum,
+ Id = c.Id,
Name = c.ChannlesName,
},
Remark = u.Remark,
@@ -103,10 +103,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 +227,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