|
@@ -146,7 +146,7 @@ function init() {
|
|
|
|
|
|
if (port !== -1) {
|
|
if (port !== -1) {
|
|
logger.info('#####################predictorState:');
|
|
logger.info('#####################predictorState:');
|
|
- var config = getRustConfig()
|
|
|
|
|
|
+ // var config = getRustConfig()
|
|
// var com = `curl -X GET -H 'auth: 4L' -H 'token: r7T$8gBV!f&L@E2+' "http://127.0.0.1:${port}/predictor_state"`;
|
|
// var com = `curl -X GET -H 'auth: 4L' -H 'token: r7T$8gBV!f&L@E2+' "http://127.0.0.1:${port}/predictor_state"`;
|
|
// logger.info('#####################com:', com);
|
|
// logger.info('#####################com:', com);
|
|
// execSync(com, (error, stdout, stderr) => {
|
|
// execSync(com, (error, stdout, stderr) => {
|
|
@@ -160,21 +160,21 @@ function init() {
|
|
// res.send({'code': 200, 'data': stdout, "message": "SUCCESS"});
|
|
// res.send({'code': 200, 'data': stdout, "message": "SUCCESS"});
|
|
// });
|
|
// });
|
|
|
|
|
|
- http.request_get(`http://127.0.0.1:${port}/predictor_state`, {...config.headers})
|
|
|
|
- .then((data) => {
|
|
|
|
- logger.info('#####################-d', data);
|
|
|
|
- res.send({'code': 200, 'data': data, "message": "SUCCESS"});
|
|
|
|
- })
|
|
|
|
- // 处理可能发生的错误
|
|
|
|
- .catch((error) => {
|
|
|
|
- logger.info(`#####################汇报:获取状态请求失败: ${error.message}`)
|
|
|
|
- // logger.error(`#####################汇报:获取状态请求失败: ${error.message}`)
|
|
|
|
- res.send({'code': -1, 'data': null, "message": `获取状态请求失败${error.message}`});
|
|
|
|
- });
|
|
|
|
|
|
+ // http.request_get(`http://127.0.0.1:${port}/predictor_state`, {...config.headers})
|
|
|
|
+ // .then((data) => {
|
|
|
|
+ // logger.info('#####################-d', data);
|
|
|
|
+ // res.send({'code': 200, 'data': data, "message": "SUCCESS"});
|
|
|
|
+ // })
|
|
|
|
+ // // 处理可能发生的错误
|
|
|
|
+ // .catch((error) => {
|
|
|
|
+ // logger.info(`#####################汇报:获取状态请求失败: ${error.message}`)
|
|
|
|
+ // // logger.error(`#####################汇报:获取状态请求失败: ${error.message}`)
|
|
|
|
+ // res.send({'code': -1, 'data': null, "message": `获取状态请求失败${error.message}`});
|
|
|
|
+ // });
|
|
|
|
+ res.send({'code': 200, 'data': data, "message": "SUCCESS"});
|
|
} else {
|
|
} else {
|
|
res.send({'code': -1, 'data': null, "message": "机器人不存在"});
|
|
res.send({'code': -1, 'data': null, "message": "机器人不存在"});
|
|
}
|
|
}
|
|
-
|
|
|
|
})
|
|
})
|
|
// 使服务器监听特定端口
|
|
// 使服务器监听特定端口
|
|
app.listen(port, () => {
|
|
app.listen(port, () => {
|