public async Task <IActionResult> Login([FromBody] RequestUser model) { var pwd = MD5Helper.MD5Encrypt32(model.password); var query = await _baseUser.Query(f => f.username.Equals(model.username) && f.password.Equals(pwd) && f.status == 1); if (query.Count == 0) { throw new BadExceptionResult("User is valid!"); } var bytes = SerializeHelper.SerializeToBytes(query); //TODO根据项目获取数据库 _redisManager.SetDefaultDatabase(12); _redisManager.SetHash(RedisConstant.UserData, query.First().id.ToStr(), bytes); var token = "bearer "; token += JwtHelper.IssueJwt(new JwtTokenModel { Role = "admin,test", Uid = 1 }); return(new ObjectResult(new { token })); }