public string login(string username, string password, string code, string uuid, RequestBasicInfo info)
        {
            string verifyKey = YouGeSystemConst.CAPTCHA_CODE_KEY + uuid;

            string captcha = YouGeRedisHelper.Get(verifyKey);

            YouGeRedisHelper.Del(verifyKey);
            if (captcha == null)
            {
                //启动线程 记录日志
                var ta = new Task(() =>

                                  sysLoginRepository.recordLogininfor(username, YouGeSystemConst.FAIL, "没有验证码", info)
                                  );
                ta.Start();

                throw new CaptchaExpireException();
            }

            if (!string.Equals(code, captcha, StringComparison.OrdinalIgnoreCase))
            {
                var tb = new Task(() =>
                                  sysLoginRepository.recordLogininfor(username, YouGeSystemConst.FAIL, "验证码已失效", info)
                                  );
                tb.Start();
                throw new CaptchaException();
            }
            try
            {
                LoginUser loginUser = this.loadUserByUsername(username, password);
                var       tf        = new Task(() =>
                                               sysLoginRepository.recordLogininfor(username, YouGeSystemConst.SUCCESS, "登录成功", info)
                                               );
                tf.Start();
                // 生成token
                return(tokenService.createToken(loginUser, info));
            }
            catch (Exception e)
            {
                if (e.Message.Contains("密码错误"))
                {
                    var tc = new Task(() =>
                                      sysLoginRepository.recordLogininfor(username, YouGeSystemConst.FAIL, "用户不存在/密码错误", info)
                                      );
                    tc.Start();


                    throw new UserPasswordNotMatchException();
                }
                else
                {
                    var td = new Task(() =>
                                      sysLoginRepository.recordLogininfor(username, YouGeSystemConst.FAIL, e.Message, info)
                                      );
                    td.Start();

                    throw new CustomException(e.Message);
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        public void clearCache()
        {
            string keys = YouGeSystemConst.SYS_CONFIG_KEY + "*";

            YouGeRedisHelper.Del(keys);
            // throw new NotImplementedException();
        }
 public void delLoginUser(string token)
 {
     if (!string.IsNullOrEmpty(token))
     {
         string userKey = getTokenKey(token);
         YouGeRedisHelper.Del(userKey);
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="configIds"></param>
        /// <returns></returns>
        public int deleteConfigByIds(long[] configIds)
        {
            int row = 0, count = 0;

            string[] keys = new string[configIds.Length];
            for (int i = 0; i < configIds.Length; i++)
            {
                row     = this.Delete((int)configIds[i]);
                count   = count + row;
                keys[i] = configIds[i].ToString();
            }


            if (count > 0)
            {
                YouGeRedisHelper.Del(keys);
                //  List<String> keys = YouGeRedisHelper.get(YouGeSystemConst.SYS_CONFIG_KEY + "*");
                // redisCache.deleteObject(keys);
            }
            return(count);
        }