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 WechatActionFilter : ActionFilterAttribute
    {
        private readonly BLL.T_Sys_Users userBLL = new BLL.T_Sys_Users();
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var openid = filterContext.HttpContext.Request["openid"];
            var model = userBLL.GetModel(openid);
            if (model == null)
            {
                filterContext.Result = new ContentResult() { Content = new AjaxResult { state = ResultTypes.error.ToString(), message = "操作失败,请重新进入公众号" }.ToJson() };
                return;
            }
            base.OnActionExecuting(filterContext);
        }
    }
}