Code Monkey home page Code Monkey logo

Comments (7)

AxiosLeo avatar AxiosLeo commented on May 26, 2024 1

@chingyat

产品方定义的 Iot 2018-01-20 GetThingTopo 接口的回调数据结构中,Data 内没有 ProductInfo 和 PropertyStatusInfo。在 Data.List 中有 deviceInfo 与生成结果相符。
您可以提交工单,将问题反馈给 Iot 产品方,让他们改下相关文档。

<ResultMapping>
        <Member tagName="RequestId" type="String" visibility="Public" name="requestId"/>
        <Member tagName="Success" type="Boolean" visibility="Public" name="success"/>
        <Member tagName="Code" type="String" visibility="Public" name="code"/>
        <Member tagName="ErrorMessage" type="String" visibility="Public" name="errorMessage"/>
        <Struct tagName="Data" visibility="Public" name="data">
            <Member tagName="Total" type="Long" visibility="Public" name="total"/>
            <Member tagName="CurrentPage" type="Integer" visibility="Public" name="currentPage"/>
            <Member tagName="PageSize" type="Integer" visibility="Public" name="pageSize"/>
            <Member tagName="PageCount" type="Long" visibility="Public" name="pageCount"/>
            <Array tagName="List" itemName="deviceInfo" visibility="Public" name="list" nullToEmpty="true">
                <Member tagName="IotId" type="String" visibility="Public" name="iotId"/>
                <Member tagName="ProductKey" type="String" visibility="Public" name="productKey"/>
                <Member tagName="DeviceName" type="String" visibility="Public" name="deviceName"/>
            </Array>
        </Struct>
    </ResultMapping>

from aliyun-openapi-cpp-sdk.

AxiosLeo avatar AxiosLeo commented on May 26, 2024 1

@chingyat

您好,请关注 #69 是否可以解决您的问题。

from aliyun-openapi-cpp-sdk.

AxiosLeo avatar AxiosLeo commented on May 26, 2024

在您提供的文档页面中,未找到 dataNode 定义。

from aliyun-openapi-cpp-sdk.

fuzy112 avatar fuzy112 commented on May 26, 2024

@AxiosCros
dataNode 是你们的代码中的局部变量啊亲,

auto dataNode = value["Data"];

from aliyun-openapi-cpp-sdk.

fuzy112 avatar fuzy112 commented on May 26, 2024

@AxiosCros
您就不能能仔细看看代码后再回复我吗?

void GetThingTopoResult::parse(const std::string &payload)
{
	Json::Reader reader;
	Json::Value value;
	reader.parse(payload, value);

	setRequestId(value["RequestId"].asString());
	auto dataNode = value["Data"];
	if(!dataNode["Total"].isNull())
		data_.total = std::stol(dataNode["Total"].asString());
	if(!dataNode["CurrentPage"].isNull())
		data_.currentPage = std::stoi(dataNode["CurrentPage"].asString());
	if(!dataNode["PageSize"].isNull())
		data_.pageSize = std::stoi(dataNode["PageSize"].asString());
	if(!dataNode["PageCount"].isNull())
		data_.pageCount = std::stol(dataNode["PageCount"].asString());
	auto allList = value["List"]["deviceInfo"];
	for (auto value : allList)
	{
		Data::DeviceInfo deviceInfoObject;
		if(!value["IotId"].isNull())
			deviceInfoObject.iotId = value["IotId"].asString();
		if(!value["ProductKey"].isNull())
			deviceInfoObject.productKey = value["ProductKey"].asString();
		if(!value["DeviceName"].isNull())
			deviceInfoObject.deviceName = value["DeviceName"].asString();
		data_.list.push_back(deviceInfoObject);
	}
	if(!value["Success"].isNull())
		success_ = value["Success"].asString() == "true";
	if(!value["Code"].isNull())
		code_ = value["Code"].asString();
	if(!value["ErrorMessage"].isNull())
		errorMessage_ = value["ErrorMessage"].asString();

}

value["List"] 是不存在的,dataNode (也就是 value["Data"]) 下面才有 List

不是文档的问题,是代码写错了!

from aliyun-openapi-cpp-sdk.

AxiosLeo avatar AxiosLeo commented on May 26, 2024

抱歉,我看一下。
代码是自动生成的不是编写的,如果有问题的话,要去修改下生成器。
感谢反馈。

from aliyun-openapi-cpp-sdk.

fuzy112 avatar fuzy112 commented on May 26, 2024

@AxiosCros
解决了。

from aliyun-openapi-cpp-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.