From c914975bffe90f808a05dba2c53d4a750e8403c0 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期三, 06 八月 2025 18:17:08 +0800 Subject: [PATCH] feat:企业开发 --- FlexJobApi.User.Application/Enterprises/Commands/EnterpriseCommandHandler.cs | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/FlexJobApi.User.Application/Enterprises/Commands/EnterpriseCommandHandler.cs b/FlexJobApi.User.Application/Enterprises/Commands/EnterpriseCommandHandler.cs index de65441..a151896 100644 --- a/FlexJobApi.User.Application/Enterprises/Commands/EnterpriseCommandHandler.cs +++ b/FlexJobApi.User.Application/Enterprises/Commands/EnterpriseCommandHandler.cs @@ -52,11 +52,18 @@ await rep.UpdateAsync(entity); } + var checkExist = await repUserInfo.AsQueryable() + .AnyAsync(it => + it.Type == EnumUserType.Enterprise + && it.EnterpriseId != entity.Id + && it.UserAuth.UserName == request.UserName); + if (checkExist) throw Oops.Oh(EnumErrorCodeType.s405, "璇ヨ处鍙�"); + var userInfo = await repUserInfo.AsQueryable() .Include(it => it.UserAuth) .FirstOrDefaultAsync(it => it.Type == EnumUserType.Enterprise - && it.UserAuth.UserName == request.UserName); + && it.EnterpriseId == entity.Id); if (userInfo == null) { userInfo = new UserInfo @@ -66,16 +73,16 @@ Status = EnumUserInfoStatus.Normal, UserAuth = new UserAuth { + Name = request.Contacts, UserName = request.UserName, PhoneNumber = request.ContactPhoneNumber, - Password = PBKDF2Encryption.Encrypt(request.Password) + Password = PBKDF2Encryption.Encrypt(MD5Encryption.Encrypt(request.Password)) } }; await repUserInfo.InsertAsync(userInfo); } else { - if (userInfo.EnterpriseId != entity.Id) throw Oops.Oh(EnumErrorCodeType.s405, "璇ヨ处鍙�"); userInfo.UserAuth.PhoneNumber = request.ContactPhoneNumber; await repUserInfo.UpdateAsync(userInfo); } -- Gitblit v1.9.1