/// <summary>
        /// 验证用户是否具有该方法的权限
        /// </summary>
        public static string ValidateUserAuthentication(string userToken)
        {
            if (_allMethodFunctionList == null || _allMethodFunctionList.Count == 0)
            {
                //改为现在查询 old
                // var userManager = new UserManager();
                //new
                // var userManager = new UserManager();
                //  _allMethodFunctionList = userManager.LoadAllMethodFunction();
                _allMethodFunctionList = SDB.CreateQuery <MethodFunction>().ToList();
            }

            var method          = new System.Diagnostics.StackFrame(1).GetMethod();
            var currentFullName = string.Format("{0}.{1}", method.ReflectedType.FullName, method.Name);
            var config          = _allMethodFunctionList.FirstOrDefault(p => p.MethodFullName == currentFullName);

            if (config == null)
            {
                throw new Exception(string.Format("没有配置方法 {0} 的调用权限数据", currentFullName));
            }

            var userId = string.Empty;

            ValidateAuthentication(userToken, config.Mode, config.FunctionId, out userId);
            return(userId);
        }
Beispiel #2
0
 /// <summary>
 /// 查询彩种
 /// </summary>
 public static LotteryGame QueryLotteryGame(string gameCode)
 {
     if (_cacheAllGameList == null || _cacheAllGameList.Count <= 0)
     {
         //var manager = new LotteryGameManager();
         var p = SDB.CreateQuery <LotteryGame>().ToList();
         _cacheAllGameList.AddRange(p);
     }
     return(_cacheAllGameList.FirstOrDefault(p => p.GameCode == gameCode));
 }