示例#1
0
        /// <summary>
        /// 请求处理
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="response"></param>
        /// <param name="userFactory"></param>
        /// <param name="httpGet"></param>
        public static void Request(string typeName, HttpGet httpGet, IGameResponse response, Func <int, BaseUser> userFactory)
        {
            int    actionID  = httpGet.ActionId;
            string tempName  = string.Format(typeName, httpGet.ActionId);
            string errorInfo = "";

            try
            {
                bool isRL = BaseStruct.CheckRunloader(httpGet);
                if (isRL || httpGet.CheckSign())
                {
                    BaseStruct action = FindRoute(typeName, httpGet, actionID);
                    Process(action, httpGet, response, userFactory);
                    if (action != null)
                    {
                        return;
                    }
                }
                else
                {
                    errorInfo = "Sign Error";
                    TraceLog.WriteError("Action request {3} error:{2},rl:{0},param:{1}", isRL, httpGet.ParamString, errorInfo, tempName);
                }
            }
            catch (Exception ex)
            {
                errorInfo = string.Format("Action request {0} error:{1}", tempName, ex);
                TraceLog.WriteError("Action request {0} error:{1}\r\nparam:{2}", tempName, ex, httpGet.ParamString);
            }
            RequestError(response, actionID, errorInfo);
        }
示例#2
0
        /// <summary>
        /// 请求脚本处理
        /// </summary>
        /// <param name="httpGet">请求参数对象</param>
        /// <param name="response">字节输出处理</param>
        /// <param name="userFactory">创建user对象工厂,可为Null</param>
        public static void RequestScript(HttpGet httpGet, IGameResponse response, Func <int, BaseUser> userFactory)
        {
            int    actionID  = httpGet.ActionId;
            string errorInfo = "";

            try
            {
                bool isRl = BaseStruct.CheckRunloader(httpGet);
                if (isRl || httpGet.CheckSign())
                {
                    BaseStruct baseStruct = FindScriptRoute(httpGet, actionID);
                    if (baseStruct != null)
                    {
                        Process(baseStruct, httpGet, response, userFactory);
                        return;
                    }
                }
                else
                {
                    errorInfo = "Sign Error";
                    TraceLog.WriteError("Action request error:{2},rl:{0},param:{1}", isRl, httpGet.ParamString, errorInfo);
                }
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("Action request error:{0}\r\nparam:{1}", ex, httpGet.ParamString);
            }
            RequestError(response, actionID, errorInfo);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="response"></param>
        /// <param name="userFactory"></param>
        /// <param name="httpGet"></param>
        public static void Request(string typeName, HttpGet httpGet, IGameResponse response, Func <int, BaseUser> userFactory)
        {
            int    actionID  = 0;
            string errorInfo = "";

            try
            {
                bool isRL = BaseStruct.CheckRunloader(httpGet);
                if (isRL || httpGet.CheckSign())
                {
                    if (httpGet.GetInt("ActionID", ref actionID))
                    {
                        BaseStruct action = FindRoute(typeName, httpGet, actionID);
                        Process(action, httpGet, response, userFactory);
                        if (action != null)
                        {
                            return;
                        }
                    }
                }
                else
                {
                    errorInfo = "签名验证失败";
                    TraceLog.WriteError("Action request error:{2},rl:{0},param:{1}", isRL, httpGet.ParamString, errorInfo);
                }
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("Action request error:{0}\r\nparam:{1}", ex, httpGet.ParamString);
            }
            RequestError(response, actionID, 10000, errorInfo);
        }