Exemplo n.º 1
0
        public static bool CheckAuth(out int uid)
        {
            RequestUtil req = new RequestUtil();
            string account = req.String("account", false, "授权错误");
            string auth = req.String("auth", false, "授权错误");

            if (req.HasError)
            {
                Json.Write(new { success = false, returnCode = "0000", msg = req.FirstError, errors = req.GetErrors() }, HttpContext.Current.Response.Output);
            }
            else if (CheckAuth(account, auth))
            {
                uid = GetAccountID(account);
                return true;
            }
            else
            {
                Json.Write(new { success = false, returnCode = "0000", msg = "授权错误" }, HttpContext.Current.Response.Output);
            }
            uid = 0;
            return false;
        }
Exemplo n.º 2
0
        public static bool CheckAuth(out int uid)
        {
            RequestUtil req     = new RequestUtil();
            string      account = req.String("account", false, "授权错误");
            string      auth    = req.String("auth", false, "授权错误");

            if (req.HasError)
            {
                Json.Write(new { success = false, returnCode = "0000", msg = req.FirstError, errors = req.GetErrors() }, HttpContext.Current.Response.Output);
            }
            else if (CheckAuth(account, auth))
            {
                uid = GetAccountID(account);
                return(true);
            }
            else
            {
                Json.Write(new { success = false, returnCode = "0000", msg = "授权错误" }, HttpContext.Current.Response.Output);
            }
            uid = 0;
            return(false);
        }