public ResponseResult LoginOut(int userid)
        {
            ResponseResult result = new ResponseResult();

            SYS_TICKET_AUTH_BLL.getInstance().DeleteTicketAuthByUserId(userid);

            //返回信息
            result.return_code = "SUCCESS";
            result.return_info = "成功退出";
            return(result);
        }
        /// <summary>
        /// 验证票据是否有效
        /// </summary>
        /// <param name="encryptToken">token</param>
        /// <returns></returns>
        private bool ValidateTicket(string encryptToken)
        {
            bool flag = false;

            //获取数据库Token
            SYS_TICKET_AUTH model = SYS_TICKET_AUTH_BLL.getInstance().GetTicketAuthByToken(encryptToken);

            if (model.Token == encryptToken) //存在
            {
                //未超时
                flag = (DateTime.Now <= model.ExprieTime) ? true : false;
            }

            return(flag);
        }
        //var content = ActionContext.Request.Properties["MS_HttpContext"] as HttpContextBase;

        //////get
        ////var token = content.Request.Headers["Token"];
        //var token = content.Request.Form["Token"];
        //SYS_TICKET_AUTH model = SYS_TICKET_AUTH_BLL.getInstance().GetTicketAuthByToken(token);
        //LoginedUserName = model.UserName;
        //LoginedUserId = model.UserId;

        /// <summary>
        /// 获取用户授权信息
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public void GetByToken(string token)
        {
            LoginedUserName = SYS_TICKET_AUTH_BLL.getInstance().GetTicketAuthByToken(token).UserName;
        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <returns></returns>
        public ResponseResult Login([FromBody] JObject data)
        {
            //返回实体
            ResponseResult result = new ResponseResult();

            try
            {
                string msg = "";

                if (data["username"] != null && data["password"] != null)

                //&& data["validatecode"] != null && data["pictureId"]!=null)
                {
                    var    dtNow    = DateTime.Now;
                    string username = data["username"].ToString();
                    string password = data["password"].ToString();

                    //string validatecode = data["validatecode"].ToString();
                    //string pictureId = data["pictureId"].ToString();

                    //if (validatecode != CacheHelper.GetCache(pictureId).ToString())
                    //{
                    //    result.return_code = "FAIL";
                    //    result.return_msg = "验证码错误";
                    //    return result;
                    //}

                    //登录
                    var model = SYS_USER_INFO_BLL.getInstance().GetLoginModel(username, password, ref msg);

                    //账号 密码验证通过
                    if (model != null)
                    {
                        //Common.Enum.LoginStatus.Success;
                        //生成票据
                        string Token = Common.Helper.DESEncrypt.Encrypt(System.Guid.NewGuid().ToString());

                        int userid = model.Id;

                        //直接清除
                        SYS_TICKET_AUTH_BLL.getInstance().DeleteTicketAuthByUserId(userid);


                        #region 将身份信息保存票据表中,验证当前请求是否是有效请求

                        SYS_TICKET_AUTH ticket = new SYS_TICKET_AUTH();
                        ticket.UserId     = model.Id;
                        ticket.UserName   = model.UserName;
                        ticket.Token      = Token;
                        ticket.ExprieTime = dtNow.AddMinutes(30); //30分钟过期
                        ticket.CreateTime = dtNow;

                        //新增ticket
                        SYS_TICKET_AUTH_BLL.getInstance().SavaTicketAuth(ticket);

                        #endregion

                        JObject logininfo = new JObject();
                        logininfo.Add("userid", model.Id);
                        logininfo.Add("loginname", model.UserName);
                        logininfo.Add("token", Token);
                        result.return_code = Common.Enum.RETURN_CODE.SUCCESS.ToString();
                        result.return_info = logininfo;
                    }

                    //账号密码验证错误
                    else
                    {
                        result.return_code = Common.Enum.RETURN_CODE.FAIL.ToString();
                    }
                }
                else
                {
                    result.return_code = Common.Enum.RETURN_CODE.ERROR.ToString();
                    result.return_msg  = "参数不完整";
                    result.return_info = null;
                }
                result.return_msg = msg;

                //var resultObj = JsonConvert.SerializeObject(obj, Formatting.Indented);
                //HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(resultObj, Encoding.GetEncoding("UTF-8"), "application/json") };
                //return result;
            }
            catch (Exception ex)
            {
                Logger.Error(string.Format("登录异常,异常信息:{0}", ex.ToString()));
            }
            return(result);
        }