Пример #1
0
    protected override void DataParser(JSONObject jsonObject)
    {
        int        code    = API_Helper.GetCode(jsonObject);
        string     message = API_Helper.GetMessage(jsonObject);
        JSONObject result  = null;

        if (API_Code.CodeIsNoContentUpdated(code))
        {
            var localSaveJson = new JSONObject(localSaveJsonString);
            result = API_Helper.GetResult(localSaveJson);
        }
        else if (jsonObject.HasField("result"))
        {
            result = API_Helper.GetResult(jsonObject);

            if (API_Code.CodeIsNormalSuccess(code))
            {
                var fileStream = File.CreateText(filePath);
                fileStream.Write(jsonObject.Print());
                fileStream.Close();
            }
        }

        OnRequestDataSuccess(code, message, result);
    }
Пример #2
0
#pragma warning restore

    protected virtual void DataParser(JSONObject jsonObject)
    {
        int        code    = API_Helper.GetCode(jsonObject);
        string     message = API_Helper.GetMessage(jsonObject);
        JSONObject result  = null;

        bool through = true;

        if (HasErrorCodeInActionHandleErrorCodeDict(code))
        {
            through = false;
            actionHandleErrorCodeDict[code](code, message);
        }

        if (through)
        {
            if (jsonObject.HasField("result"))
            {
                result = API_Helper.GetResult(jsonObject);
            }

            OnRequestDataSuccess(code, message, result);
        }
    }