Browse Source

获取设备部署信息 apI

dev
wenlele 1 year ago
parent
commit
5e83ee5dd2
  1. 33
      api/app/lib/controllers/analysis/network.js
  2. 3
      api/config.js
  3. 3
      web/client/src/sections/analysis/containers/treeShow.jsx

33
api/app/lib/controllers/analysis/network.js

@ -26,24 +26,35 @@ async function getOrganizationsStruc (ctx) {
}
async function getThingsDeploy (ctx) {
try {
const { utils: { anxinStrucIdRange } } = ctx.app.fs
const { thingId } = ctx.params
let error = { name: 'FindError', message: '获取设备部署信息失败' };
let rslt = null, errStatus = null;
let { thingId } = ctx.params;
try {
if (!thingId) {
throw '缺少参数 thingId'
}
let iotaResponse = await ctx.app.fs.iotRequest.get(`/things/${thingId}/deploys`) || {}
ctx.status = 200
ctx.body = iotaResponse.body
let iotaResponse = await ctx.app.fs.iotRequest.get(`things/${thingId}/deploys`)
rslt = iotaResponse
error = null;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
} catch (err) {
errStatus = err.status
ctx.fs.logger.error(`path: ${ctx.path}, error: ${err}`);
}
if (error) {
if (errStatus == 404) {
ctx.status = 200;
ctx.body = {
message: '获取设备部署信息失败'
'instances': null
};
} else {
ctx.status = errStatus;
ctx.body = error;
}
} else {
ctx.status = 200;
ctx.body = rslt;
}
}

3
api/config.js

@ -299,7 +299,8 @@ const product = {
root: API_IOT_AUTH
}, {
name: 'iotRequest',
root: IOT_PROXY + '/_iota_api'
root: IOT_PROXY + '/_iota_api',
dataWord: 'text'
}, {
name: 'godRequest',
root: GOD_URL,

3
web/client/src/sections/analysis/containers/treeShow.jsx

@ -23,11 +23,8 @@ const Network = ({ dispatch, actions, user, clientHeight, thingId }) => {
return (
<div style={{ width: "100%", height: "100%" }}>
树状展示
</div>
)

Loading…
Cancel
Save