From 5260559b412b12b2b919b91fd4691d5a9fe3bd35 Mon Sep 17 00:00:00 2001 From: 移动系统liao <liaoxujun@qq.com> Date: 星期一, 25 八月 2025 08:49:24 +0800 Subject: [PATCH] 完成一些用户相关逻辑修正 --- Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs | 61 +++++++++++++++++++++++++++--- 1 files changed, 55 insertions(+), 6 deletions(-) diff --git a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs index d641f88..b520808 100644 --- a/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs +++ b/Admin.NET/FZCTB.NET.API.Application/User/CustomerService.cs @@ -147,7 +147,10 @@ { CusExtendId = dd.Id, ExRoleId = ExRole.Id ?? 0, - steps = CusExtendStep.UNExamine + steps = CusExtendStep.UNExamine, + CreateTime = DateTime.Now, + CreateUserName = "浼佷笟鐢ㄦ埛:" + ThisUser?.Name, + CreateUserId = ThisUser?.Id }; @@ -249,6 +252,10 @@ ExRoleId = rols.Id, CusExtendId = user.CusExtendId, steps= CusExtendStep.UNExamine, + + CreateTime = DateTime.Now, + CreateUserName = "浼佷笟鐢ㄦ埛:" + ThisUser?.Name, + CreateUserId = ThisUser?.Id, }); @@ -448,7 +455,7 @@ } if (!await isManger()) throw Oops.Oh("鐢ㄦ埛娌℃湁鏉冮檺"); - return (await _fBS_CustormerUsersRep.GetListAsync(x => x.CusExtendId == id&&x.IsEn==true)).Adapt<List<FBS_CustormerUsersOutput>>(); + return (await _fBS_CustormerUsersRep.GetListAsync(x => x.CusExtendId == id)).Adapt<List<FBS_CustormerUsersOutput>>(); } public FBS_CustormerUsers? ThisUser { get; set; } /// <summary> @@ -521,14 +528,14 @@ } var User = await _fBS_CustormerUsersRep.GetFirstAsync(x =>x.CusExtendId==ThisUser.CusExtendId &&x.Id== CustormerUserId); - if (User != null) + if (User == null) { throw Oops.Oh("鐢ㄦ埛涓嶅瓨鍦�"); } if(User.IsEn==false) throw Oops.Oh("鏃犳晥鐢ㄦ埛涓嶅彲璁剧疆涓虹鐞嗗憳"); - User.IsManager = true; + User.IsManager = !User.IsManager; User.UpdateTime = DateTime.Now; User.UpdateUserName= "浼佷笟鐢ㄦ埛:" + ThisUser?.Name; User.UpdateUserId = ThisUser.Id; @@ -581,13 +588,13 @@ { throw Oops.Oh("Id閿欒"); } - if(Param.CusExtendId!=Param.Id) + if(Param.CusExtendId!= cid) { throw Oops.Oh("缁勭粐鏈烘瀯涓嶅悓涓嶅彲淇敼"); } var User = await _fBS_CustormerUsersRep.GetFirstAsync(x => x.CusExtendId == Param.CusExtendId && x.Id == Param.Id); - if (User != null) + if (User == null) { throw Oops.Oh("鐢ㄦ埛涓嶅瓨鍦�"); } @@ -602,6 +609,48 @@ } + + /// <summary> + /// 鍒犻櫎鍛樺伐 + /// </summary> + /// <param name="CustormerUserId"> UserList 鐨処D</param> + /// <returns></returns> + [HttpDelete] + public async Task<bool> DelCustormerUsers(long CustormerUserId) + { + if (!await isManger()) + throw Oops.Oh("鐢ㄦ埛娌℃湁鏉冮檺"); + var cid = App.User.FindFirst(ClaimConst.CustomerExId)?.Value.ToLong() ?? 0; + if (cid == 0) + { + throw Oops.Oh("鐢ㄦ埛鍑瘉閿欒"); + + } + var uid = App.User.FindFirst(ClaimConst.UserId)?.Value.ToLong() ?? 0; + if (uid == 0) + { + + + } + if (CustormerUserId == uid) + throw Oops.Oh("鑷繁涓嶅彲鍒犻櫎鑷繁"); + if (ThisUser == null) + { + + ThisUser = await _fBS_CustormerUsersRep.GetFirstAsync(x => x.Id == uid && x.CusExtendId == cid && x.IsEn == true); + + } + var User = await _fBS_CustormerUsersRep.GetFirstAsync(x => x.CusExtendId == ThisUser.CusExtendId && x.Id == CustormerUserId); + if (User == null) + { + throw Oops.Oh("鐢ㄦ埛涓嶅瓨鍦�"); + } + return await _fBS_CustormerUsersRep.DeleteByIdAsync(CustormerUserId); + + + + } + /// <summary> /// 鏉冮檺楠岃瘉鏄惁鏄鐞嗗憳 /// </summary> -- Gitblit v1.9.1