public async Task <IActionResult> AddUser([FromBody] User User)
 {
     if (ModelState.IsValid)
     {
         User.Id = Convert.ToInt32(SnowHelper.GetSnowId());
         PublishMQ.AddQueue(Business.Business.Enum.AddUser.ToString(), User);
         await _departmentService.UpdateDepartments();
     }
     _Apiloger.LogInformation($"请求增加一个员工,但是失败了");
     return(Ok(new JsonFailCatch("用户新增失败")));
 }
Beispiel #2
0
        public async Task <IActionResult> RegisterUser([FromBody] UserRegisterModel RegisterModel)
        {
            if (ModelState.IsValid)
            {
                RegisterModel.UserPassword  = FacePayEncrypt.Encrypt(RegisterModel.UserPassword);
                RegisterModel.OtherPassword = FacePayEncrypt.Encrypt(RegisterModel.OtherPassword);
                if (!(RegisterModel.UserPassword.Equals(RegisterModel.OtherPassword)))
                {
                    return(Ok(new JsonFailCatch("两次密码输入不一致")));
                }
                var user = _authorityBusinessInterface.RegisterUserModel(RegisterModel);
                user.Id      = SnowHelper.GetSnowId();
                user.Remarks = user.State == 1 ?"在职": "离职";
                var result = await _userServices.AddUser(user);

                if (result != null)
                {
                    return(Ok(new SucessModel("注册成功")));
                }
            }
            return(Ok(new JsonFailCatch("注册失败")));
        }