|
@@ -21,7 +21,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0) {
|
|
|
this.ctx.body = { errcode: 0, errmsg: 'ok' };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '禁用wan网卡失败' };
|
|
|
+ this.ctx.body = { errcode: -1022, errmsg: '禁用wan网卡失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1022, errmsg: '禁用wan网卡失败', error };
|
|
@@ -35,7 +35,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0) {
|
|
|
this.ctx.body = { errcode: 0, errmsg: 'ok' };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '启用wan网卡失败' };
|
|
|
+ this.ctx.body = { errcode: -1023, errmsg: '启用wan网卡失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1023, errmsg: '启用wan网卡失败', error };
|
|
@@ -49,7 +49,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0) {
|
|
|
this.ctx.body = { errcode: 0, errmsg: 'ok' };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '启用lan网卡失败' };
|
|
|
+ this.ctx.body = { errcode: -1024, errmsg: '启用lan网卡失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1024, errmsg: '启用lan网卡失败', error };
|
|
@@ -63,7 +63,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0) {
|
|
|
this.ctx.body = { errcode: 0, errmsg: 'ok' };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '禁用lan网卡失败' };
|
|
|
+ this.ctx.body = { errcode: -1025, errmsg: '禁用lan网卡失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1025, errmsg: '禁用lan网卡失败', error };
|
|
@@ -79,7 +79,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0 && res.data !== '') {
|
|
|
this.ctx.body = { errcode: 0, errmsg: 'ok' };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '地址连接失败' };
|
|
|
+ this.ctx.body = { errcode: -1026, errmsg: '地址连接失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1026, errmsg: '地址连接异常', error };
|
|
@@ -93,7 +93,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0) {
|
|
|
this.ctx.body = { errcode: 0, errmsg: 'ok' };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '获取时间失败' };
|
|
|
+ this.ctx.body = { errcode: -1027, errmsg: '获取时间失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1027, errmsg: '获取时间失败', error };
|
|
@@ -137,7 +137,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0 && res.data) {
|
|
|
this.ctx.body = { errcode: 0, errmsg: 'ok', data: { cpu: res.data } };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '获取CPU使用率失败' };
|
|
|
+ this.ctx.body = { errcode: -1030, errmsg: '获取CPU使用率失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1030, errmsg: '获取CPU使用率失败', error };
|
|
@@ -151,7 +151,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0 && res.data) {
|
|
|
this.ctx.body = { errcode: 0, errmsg: '', data: { memory: res.data } };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '获取内存使用率失败' };
|
|
|
+ this.ctx.body = { errcode: -1031, errmsg: '获取内存使用率失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1031, errmsg: '获取内存使用率失败', error };
|
|
@@ -161,7 +161,7 @@ class SystemctlController extends Controller {
|
|
|
// 获取设备信息
|
|
|
async devinfo() {
|
|
|
try {
|
|
|
- const configJson = require(filePath.configJson);
|
|
|
+ const configJson = this.app.readConfig(filePath.configJson);
|
|
|
const model = configJson.model;
|
|
|
const version = configJson.version;
|
|
|
this.ctx.body = { errcode: 0, errmsg: '', data: { model, version } };
|
|
@@ -188,7 +188,7 @@ class SystemctlController extends Controller {
|
|
|
if (res.errcode === 0) {
|
|
|
this.ctx.body = { errcode: 0, errmsg: 'ok' };
|
|
|
} else {
|
|
|
- this.ctx.body = { errcode: -1, errmsg: '操作失败' };
|
|
|
+ this.ctx.body = { errcode: -1033, errmsg: '操作失败' };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
const body = { errcode: -1033, errmsg: '操作失败', error };
|