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) { async function getThingsDeploy (ctx) {
try { let error = { name: 'FindError', message: '获取设备部署信息失败' };
const { utils: { anxinStrucIdRange } } = ctx.app.fs let rslt = null, errStatus = null;
const { thingId } = ctx.params let { thingId } = ctx.params;
try {
if (!thingId) { if (!thingId) {
throw '缺少参数 thingId' throw '缺少参数 thingId'
} }
let iotaResponse = await ctx.app.fs.iotRequest.get(`/things/${thingId}/deploys`) || {} let iotaResponse = await ctx.app.fs.iotRequest.get(`things/${thingId}/deploys`)
rslt = iotaResponse
ctx.status = 200 error = null;
ctx.body = iotaResponse.body
} catch (error) { } catch (err) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); errStatus = err.status
ctx.status = 400; ctx.fs.logger.error(`path: ${ctx.path}, error: ${err}`);
}
if (error) {
if (errStatus == 404) {
ctx.status = 200;
ctx.body = { 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 root: API_IOT_AUTH
}, { }, {
name: 'iotRequest', name: 'iotRequest',
root: IOT_PROXY + '/_iota_api' root: IOT_PROXY + '/_iota_api',
dataWord: 'text'
}, { }, {
name: 'godRequest', name: 'godRequest',
root: GOD_URL, root: GOD_URL,

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

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

Loading…
Cancel
Save