コード例 #1
0
 public void Post([FromBody] SysUserInfo model)
 {
     model.Id           = Guid.NewGuid().ToString();
     model.UserName     = "******";
     model.ReallyName   = "张三";
     model.DepartmentID = "11223";
     model.CreateTime   = DateTime.Now;
     model.UpdateTime   = null;
     model.Password     = Md5Helper.Md5("000000");
     systemUserService.AddUser(model);
 }
コード例 #2
0
 public IActionResult AddUser([FromQuery] SystemUserAddRequestDto query, TokenModel tokenModel)
 {
     _systemUserService.AddUser(new SystemUserModel()
     {
         RealName    = query.RealName,
         UserName    = query.UserName,
         Description = query.Description,
         Picture     = query.Picture,
         IsUse       = query.IsUse,
         ID          = Guid.NewGuid().ToString().ToUpper()
     });
     return(Ok(new ResponseDto()));
 }
コード例 #3
0
        public IActionResult Registration([FromBody] SysUserInfo model)
        {
            RespondResult result = new RespondResult();

            model.Id         = Guid.NewGuid().ToString();
            model.CreateTime = DateTime.Now;
            model.UpdateTime = null;
            model.Password   = Md5Helper.Md5(model.Password);
            int resultcount = systemUserService.AddUser(model);

            //用户注册失败
            if (resultcount == 0)
            {
                result.is_success = false;
                result.msg        = "注册失败";
                result.result     = null;
            }
            var tokenStr = AuthConfiguer.GetJWT(model, _jwtSettings);

            result.is_success = true;
            result.msg        = "注册成功";
            result.result     = tokenStr;
            return(Ok(result));
        }