public async Task <object> GetJWTStr(string name, string pass) { string jwtStr = string.Empty; bool suc = false; //这里就是用户登陆以后,通过数据库去调取数据,分配权限的操作 //这里直接写死了 var user = await sysUserInfoServices.GetUserRoleNameStr(name, pass); if (user != null) { TokenModelJWT tokenModel = new TokenModelJWT(); tokenModel.Uid = 1; tokenModel.Role = user; jwtStr = JwtHelper.IssueJWT(tokenModel); suc = true; } else { jwtStr = "login fail!!!"; } return(Ok(new { success = suc, token = jwtStr })); }
public async Task <object> GetJwtStr(string name, string pass) { string jwtStr = string.Empty; bool suc = false; var user = await _sysUserInfoServices.GetUserRoleNameStr(name, MD5Helper.MD5Encrypt32(pass)); if (user != null) { TokenModelJwt tokenModelJwt = new TokenModelJwt { Uid = 1, Role = user }; jwtStr = JwtHelper.IssueJwt(tokenModelJwt); suc = true; } else { jwtStr = "login fail!"; } return(Ok(new { success = suc, token = jwtStr })); }