Пример #1
0
        /// <summary>
        /// 获取参数
        /// </summary>
        /// <param name="RouteData"></param>
        /// <param name="_objs"></param>
        /// <returns></returns>
        internal static bool GetMinObj(AshxRouteData RouteData, out object[] _objs)
        {
            Ashx ashx = RouteData.GetAshx;

            if (ashx.Parameters.Length > 0)
            {
                bool minObj(out object[] _objs)
                {
                    int index  = 0;
                    int length = ashx.Parameters.Length;

                    _objs = new object[length];
                    if (ashx.Parameters[index].ParameterType == typeof(HttpContext))
                    {
                        _objs[0] = RouteData.HttpContext;
                        index++;
                    }
                    _objs = AshxExtension.GetParameterObjs(ashx, RouteData.HttpContext.Request, index, length, _objs, out bool isException);
                    return(isException);
                }

                return(minObj(out _objs));
            }
            _objs = default;
            return(false);
        }
Пример #2
0
 protected override bool Initialize(Ashx ashx)
 {
     if (ashx.TryGetValue(out mvc))
     {
         if (Session.TryGetValue("Admin", out anmininfo))
         {
             Rout rout  = new("Admin", mvc);
             var  routs = Session.Get <List <Rout> >("Routs");
             if (Rout.Contains(routs, rout, out R_Rout))
             {
                 if (mvc.IsAction && !Rout.IsActionEnum(rout.Authority, R_Rout.PermissionType))
                 {
                     Json(new { code = 2010, msg = "您不具备访问该API的权限!" });
                     return(false);
                 }
                 else
                 {
                     if (mvc.Action == ActionEnum.Delete)
                     {
                         //加入操作日志
                         AddBaseLog(mvc);
                     }
                 }
             }
         }
         else
         {
             Json(new { code = 2001, msg = "用户未登录!" });
             return(false);
         }
     }
     return(true);
 }
Пример #3
0
        protected override bool Initialize(Ashx ashx)
        {
            //var s = ED();

            //var a1 = s.A1;

            //var a2 = s.A2;

            //Session.Set("key10", "123456");

            //ps sd = new ps() { key = 1050 };
            //Session.Set("key11", sd);

            //Context
            //Json(new { m = "无需结果" });
            return(true);
        }
Пример #4
0
        /// <summary>
        /// 获取参数
        /// </summary>
        /// <param name="RouteData"></param>
        /// <param name="_objs"></param>
        /// <returns></returns>
        internal static bool GetObj(AshxRouteData RouteData, out object[] _objs)
        {
            Ashx ashx = RouteData.GetAshx;

            if (ashx.Parameters.Length > 0)
            {
                bool obj(out object[] _objs)
                {
                    int length = ashx.Parameters.Length;

                    _objs = new object[length];
                    _objs = AshxExtension.GetParameterObjs(ashx, RouteData.HttpContext.Request, 0, length, _objs, out bool isException);
                    return(isException);
                }

                return(obj(out _objs));
            }
            _objs = default;
            return(false);
        }
Пример #5
0
 protected override void OnResult(Ashx ashx)
 {
 }