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); }
protected void CheckCode(JSONObject data) { int code = API_Helper.GetCode(data); if (!API_Code.CodeIsNormalSuccess(code)) { string errorMessage = API_Helper.GetMessage(data); error = new ErrorServerRequest(code, errorMessage); } }
#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); } }