105 lines
5.6 KiB
C++
105 lines
5.6 KiB
C++
/*
|
|
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#include <alibabacloud/ens/model/DescribeEnsSaleControlResult.h>
|
|
#include <json/json.h>
|
|
|
|
using namespace AlibabaCloud::Ens;
|
|
using namespace AlibabaCloud::Ens::Model;
|
|
|
|
DescribeEnsSaleControlResult::DescribeEnsSaleControlResult() :
|
|
ServiceResult()
|
|
{}
|
|
|
|
DescribeEnsSaleControlResult::DescribeEnsSaleControlResult(const std::string &payload) :
|
|
ServiceResult()
|
|
{
|
|
parse(payload);
|
|
}
|
|
|
|
DescribeEnsSaleControlResult::~DescribeEnsSaleControlResult()
|
|
{}
|
|
|
|
void DescribeEnsSaleControlResult::parse(const std::string &payload)
|
|
{
|
|
Json::Reader reader;
|
|
Json::Value value;
|
|
reader.parse(payload, value);
|
|
setRequestId(value["RequestId"].asString());
|
|
auto allSaleControlNode = value["SaleControl"]["SaleControlItem"];
|
|
for (auto valueSaleControlSaleControlItem : allSaleControlNode)
|
|
{
|
|
SaleControlItem saleControlObject;
|
|
if(!valueSaleControlSaleControlItem["CommodityCode"].isNull())
|
|
saleControlObject.commodityCode = valueSaleControlSaleControlItem["CommodityCode"].asString();
|
|
if(!valueSaleControlSaleControlItem["OrderType"].isNull())
|
|
saleControlObject.orderType = valueSaleControlSaleControlItem["OrderType"].asString();
|
|
auto allSaleControlItemsNode = valueSaleControlSaleControlItem["SaleControlItems"]["saleControlItemsItem"];
|
|
for (auto valueSaleControlSaleControlItemSaleControlItemssaleControlItemsItem : allSaleControlItemsNode)
|
|
{
|
|
SaleControlItem::SaleControlItemsItem saleControlItemsObject;
|
|
if(!valueSaleControlSaleControlItemSaleControlItemssaleControlItemsItem["ModuleCode"].isNull())
|
|
saleControlItemsObject.moduleCode = valueSaleControlSaleControlItemSaleControlItemssaleControlItemsItem["ModuleCode"].asString();
|
|
auto saleControlItem1Node = value["SaleControlItem"];
|
|
auto allConditionSaleControlNode = saleControlItem1Node["ConditionSaleControl"]["ConditionSaleControlItem"];
|
|
for (auto saleControlItem1NodeConditionSaleControlConditionSaleControlItem : allConditionSaleControlNode)
|
|
{
|
|
SaleControlItem::SaleControlItemsItem::SaleControlItem1::ConditionSaleControlItem conditionSaleControlItemObject;
|
|
if(!saleControlItem1NodeConditionSaleControlConditionSaleControlItem["Description"].isNull())
|
|
conditionSaleControlItemObject.description = saleControlItem1NodeConditionSaleControlConditionSaleControlItem["Description"].asString();
|
|
if(!saleControlItem1NodeConditionSaleControlConditionSaleControlItem["Operator"].isNull())
|
|
conditionSaleControlItemObject._operator = saleControlItem1NodeConditionSaleControlConditionSaleControlItem["Operator"].asString();
|
|
auto conditionControlNode = value["ConditionControl"];
|
|
if(!conditionControlNode["ConditionControlModuleCode"].isNull())
|
|
conditionSaleControlItemObject.conditionControl.conditionControlModuleCode = conditionControlNode["ConditionControlModuleCode"].asString();
|
|
if(!conditionControlNode["ConditionControlModuleValue"].isNull())
|
|
conditionSaleControlItemObject.conditionControl.conditionControlModuleValue = conditionControlNode["ConditionControlModuleValue"].asString();
|
|
auto moduleValueNode = value["ModuleValue"];
|
|
if(!moduleValueNode["ModuleMinValue"].isNull())
|
|
conditionSaleControlItemObject.moduleValue.moduleMinValue = moduleValueNode["ModuleMinValue"].asString();
|
|
if(!moduleValueNode["ModuleMaxValue"].isNull())
|
|
conditionSaleControlItemObject.moduleValue.moduleMaxValue = moduleValueNode["ModuleMaxValue"].asString();
|
|
auto allModuleValue2 = moduleValueNode["ModuleValue"]["ModuleValue"];
|
|
for (auto value : allModuleValue2)
|
|
conditionSaleControlItemObject.moduleValue.moduleValue2.push_back(value.asString());
|
|
saleControlItemsObject.saleControlItem1.conditionSaleControl.push_back(conditionSaleControlItemObject);
|
|
}
|
|
auto basicSaleControlNode = saleControlItem1Node["BasicSaleControl"];
|
|
if(!basicSaleControlNode["Description"].isNull())
|
|
saleControlItemsObject.saleControlItem1.basicSaleControl.description = basicSaleControlNode["Description"].asString();
|
|
if(!basicSaleControlNode["Operator"].isNull())
|
|
saleControlItemsObject.saleControlItem1.basicSaleControl._operator = basicSaleControlNode["Operator"].asString();
|
|
auto moduleValue3Node = basicSaleControlNode["ModuleValue"];
|
|
if(!moduleValue3Node["ModuleMinValue"].isNull())
|
|
saleControlItemsObject.saleControlItem1.basicSaleControl.moduleValue3.moduleMinValue = moduleValue3Node["ModuleMinValue"].asString();
|
|
if(!moduleValue3Node["ModuleMaxValue"].isNull())
|
|
saleControlItemsObject.saleControlItem1.basicSaleControl.moduleValue3.moduleMaxValue = moduleValue3Node["ModuleMaxValue"].asString();
|
|
auto allModuleValue4 = moduleValue3Node["ModuleValue"]["ModuleValue"];
|
|
for (auto value : allModuleValue4)
|
|
saleControlItemsObject.saleControlItem1.basicSaleControl.moduleValue3.moduleValue4.push_back(value.asString());
|
|
saleControlObject.saleControlItems.push_back(saleControlItemsObject);
|
|
}
|
|
saleControl_.push_back(saleControlObject);
|
|
}
|
|
|
|
}
|
|
|
|
std::vector<DescribeEnsSaleControlResult::SaleControlItem> DescribeEnsSaleControlResult::getSaleControl()const
|
|
{
|
|
return saleControl_;
|
|
}
|
|
|