using CallCenter.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CallCenterApi.Interface.App_Start
{
    public class APPActionFilter : ActionFilterAttribute
    {
        private readonly BLL.T_Sys_Users userBLL = new BLL.T_Sys_Users();
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var usercode = filterContext.HttpContext.Request["usercode"];
            var model = userBLL.GetModel(usercode);
            if (model == null)
            {
                filterContext.Result = new ContentResult() { Content = new AjaxResult { state = ResultTypes.notoken.ToString(), message = "登录超时，请重新登录" }.ToJson() };
                return;
            }
            base.OnActionExecuting(filterContext);
        }
    }
}