예제 #1
0
 public IActionResult Login([FromBody] UserDto dto)
 {
     if (dto.UserName == "11" & dto.Pwd == "11")
     {
         double expiresMinutes = 600;
         var    response       = new
         {
             Status       = true,
             access_token = _authFactory.SignIn(new UserInfo()
             {
                 UserName = "******", UserId = "11"
             }),                                                                  //用户token
             expires_in = (int)TimeSpan.FromMinutes(expiresMinutes).TotalSeconds, //token过期时长
             token_type = "Bearer"
         };
         return(Ok(response));
     }
     return(BadRequest("用户账号或密码错误!"));
 }