Browse Source

获取设备部署信息 apI

dev
wenlele 1 year ago
parent
commit
5e83ee5dd2
  1. 33
      api/app/lib/controllers/analysis/network.js
  2. 9
      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;
} }
} }

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_DATA_ALARM = process.env.CLICKHOUST_DATA_ALARM || flags.clickHouseDataAlarm
const CLICKHOUST_IOT = process.env.CLICKHOUST_IOT || flags.clickHouseIot const CLICKHOUST_IOT = process.env.CLICKHOUST_IOT || flags.clickHouseIot
const CLICKHOUST_CAM_WORKFLOW = process.env.CLICKHOUST_CAM_WORKFLOW || flags.clickHouseCamworkflow 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 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 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 = { const requireParams = {
FS_CAMUNDA_HOST, FS_CAMUNDA_ROOT, FS_CAMUNDA_HOST, FS_CAMUNDA_ROOT,
@ -197,7 +197,7 @@ const product = {
secretKey: QINIU_SK secretKey: QINIU_SK
}, },
maxSize: 104857600, // 100M maxSize: 104857600, // 100M
types:TYPES types: TYPES
} }
}, { }, {
entry: require('./app').entry, entry: require('./app').entry,
@ -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