예제 #1
0
    /*
     #
     # Do Actions
     #
     */
    public void DoAction()
    {
        FGSAPIAction FGSAction = Utils.json_decode <FGSAPIAction>(Utils._POST("act"));

        // {"value":[{"key":"Level_1","value":1}],"action":"custom"}

        if (FGSAction != null)
        {
            //			HttpContext.Current.Response.Write("ok");

            try
            {
                switch (FGSAction.action)
                {
                case "ping":
                    if (FGSAction.value == "ping")
                    {
                        //RequestOpenURL("");
                        //RequestCallJS("");
                        ping();
                    }
                    break;

                case "visit":
                    //if (Utils.safeInt(FGSAction.value) > -1 && Utils.safeInt(FGSAction.state) > -1)
                    if (Utils.safeInt(FGSAction.value) > -1)
                    {
                        visit(Utils.safeInt(FGSAction.value), Utils.safeInt(FGSAction.state));
                        //visit(Utils.safeInt(FGSAction.value), 0);
                    }
                    break;

                case "play":
                    if (Utils.safeInt(FGSAction.value) > 0)
                    {
                        play(Utils.safeInt(FGSAction.value));
                    }
                    break;

                case "cbp":
                    if (Utils.safeInt(FGSAction.value) > 0)
                    {
                        setCallBackParam(Utils.safeInt(FGSAction.value), FGSAction.result);
                    }
                    break;

                case "custom":
                    var customValue = (Dictionary <string, object>)(FGSAction.value[0]);
                    if (Utils.safeInt(customValue["value"]) > 0)
                    {
                        custom(Utils.safeStr(customValue["key"]), Utils.safeInt(customValue["value"]));
                    }
                    break;

                default:
                    RequestVisit();
                    break;
                }
            }
            catch (Exception e)
            {
                //HttpContext.Current.Response.Write("ok"+e);
                //RequestVisit(e.ToString());
                System.Diagnostics.Debug.WriteLine("FGS ServerAPI Error: " + e.Message);
                SaveErrorLogs(e.ToString());
            }
        }
        else
        {
            RequestVisit();
        }
    }
예제 #2
0
    /*
     #
     # Do Actions
     #
     */
    public static void DoAction()
    {
        FGSAPIAction FGSAction = Utils.json_decode <FGSAPIAction>(Utils._POST("act"));

        // {"value":[{"key":"Level_1","value":1}],"action":"custom"}

        if (FGSAction != null)
        {
            //			HttpContext.Current.Response.Write("ok");

            try
            {
                switch (FGSAction.action)
                {
                case "ping":
                    if (FGSAction.value == "ping")
                    {
                        //$FGSCache->RequestOpenURL("");
                        //$FGSCache->RequestCallJS("");
                        ping();
                    }
                    break;

                case "visit":
                    if (Utils.safeInt(FGSAction.value) > -1)
                    {
                        visit(Utils.safeInt(FGSAction.value));
                    }
                    break;

                case "play":
                    if (Utils.safeInt(FGSAction.value) > 0)
                    {
                        play(Utils.safeInt(FGSAction.value));
                    }
                    break;

                case "cbp":
                    if (Utils.safeInt(FGSAction.value) > 0)
                    {
                        setCallBackParam(Utils.safeInt(FGSAction.value), FGSAction.result);
                    }
                    break;

                case "custom":
                    var customValue = (Dictionary <string, object>)(FGSAction.value[0]);
                    if (Utils.safeInt(customValue["value"]) > 0)
                    {
                        custom(Utils.safeStr(customValue["key"]), Utils.safeInt(customValue["value"]));
                    }
                    break;

                default:
                    RequestVisit();
                    break;
                }
            }
            catch (Exception e)
            {
                //HttpContext.Current.Response.Write("ok"+e);
                RequestVisit();
            }
        }
        else
        {
            RequestVisit();
        }
    }