Browse Source

获取设备部署信息 apI

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

35
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;
ctx.body = {
message: '获取设备部署信息失败'
} catch (err) {
errStatus = err.status
ctx.fs.logger.error(`path: ${ctx.path}, error: ${err}`);
}
if (error) {
if (errStatus == 404) {
ctx.status = 200;
ctx.body = {
'instances': null
};
} else {
ctx.status = errStatus;
ctx.body = error;
}
} else {
ctx.status = 200;
ctx.body = rslt;
}
}

9
api/config.js

@ -125,7 +125,7 @@ const CLICKHOUST_VCMP = process.env.CLICKHOUST_VCMP || flags.clickHouseVcmp
const CLICKHOUST_DATA_ALARM = process.env.CLICKHOUST_DATA_ALARM || flags.clickHouseDataAlarm
const CLICKHOUST_IOT = process.env.CLICKHOUST_IOT || flags.clickHouseIot
const CLICKHOUST_CAM_WORKFLOW = process.env.CLICKHOUST_CAM_WORKFLOW || flags.clickHouseCamworkflow
const CLICKHOUST_DATA_ALARM_LOCAL=process.env.CLICKHOUST_DATA_ALARM_LOCAL|| flags.clickHouseDataAlarmLocal
const CLICKHOUST_DATA_ALARM_LOCAL = process.env.CLICKHOUST_DATA_ALARM_LOCAL || flags.clickHouseDataAlarmLocal
const CONFIRM_ALARM_ANXIN_USER_ID = process.env.CONFIRM_ALARM_ANXIN_USER_ID || flags.confirmAlarmAnxinUserId
@ -152,7 +152,7 @@ const ANXINCLOUD_ES_NODES_REST = process.env.ANXINCLOUD_ES_NODES_REST || flags.e
// const BUSINESS_KEY=process.env.BUSINESS_KEY||['160','161']
//文件上传类型限制(主要是固件升级上传固件包)
const TYPES= process.env.TYPES&&process.env.TYPES.split(',')||flags.types.split(',')
const TYPES = process.env.TYPES && process.env.TYPES.split(',') || flags.types.split(',')
const requireParams = {
FS_CAMUNDA_HOST, FS_CAMUNDA_ROOT,
@ -197,7 +197,7 @@ const product = {
secretKey: QINIU_SK
},
maxSize: 104857600, // 100M
types:TYPES
types: TYPES
}
}, {
entry: require('./app').entry,
@ -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