V0.37.2.250711_alpha:修改了动态链接库加载的错误处理
This commit is contained in:
parent
18308ad375
commit
648855204d
Binary file not shown.
@ -1,8 +1,4 @@
|
|||||||
const express = require('express');
|
const express = require('express');
|
||||||
const path = require('path');
|
|
||||||
const fs = require('fs').promises;
|
|
||||||
const xlsx = require('xlsx');
|
|
||||||
const multer = require('multer');
|
|
||||||
const {
|
const {
|
||||||
getDataInterfaces,
|
getDataInterfaces,
|
||||||
addDataInterface,
|
addDataInterface,
|
||||||
@ -12,20 +8,6 @@ const {
|
|||||||
} = require('../utils/data-interface-utils');
|
} = require('../utils/data-interface-utils');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const upload = multer({ storage: multer.memoryStorage() });
|
|
||||||
|
|
||||||
// 数据文件路径
|
|
||||||
const DATA_FILE = path.join(__dirname, '../data/interface.json');
|
|
||||||
|
|
||||||
// 确保数据目录存在
|
|
||||||
async function ensureDataDirectory() {
|
|
||||||
const dataDir = path.dirname(DATA_FILE);
|
|
||||||
try {
|
|
||||||
await fs.access(dataDir);
|
|
||||||
} catch {
|
|
||||||
await fs.mkdir(dataDir, { recursive: true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取接口列表
|
// 获取接口列表
|
||||||
router.get('/list', async (req, res) => {
|
router.get('/list', async (req, res) => {
|
||||||
|
@ -111,11 +111,6 @@ app.use('/api/data-monitor', dataMonitorRoutes);
|
|||||||
app.use('/api/data-collect', dataCollectRoutes);
|
app.use('/api/data-collect', dataCollectRoutes);
|
||||||
app.use('/api/interface-gen', interfaceGenRoutes);
|
app.use('/api/interface-gen', interfaceGenRoutes);
|
||||||
|
|
||||||
// 接口配置页面路由
|
|
||||||
app.get('/interface-config', (req, res) => {
|
|
||||||
res.sendFile(path.join(__dirname, 'interface-config.html'));
|
|
||||||
});
|
|
||||||
|
|
||||||
// 启动服务器
|
// 启动服务器
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`D03024003: 服务器运行在 http://localhost:${PORT}`);
|
console.log(`D03024003: 服务器运行在 http://localhost:${PORT}`);
|
||||||
|
@ -63,6 +63,8 @@ try {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`加载 ${loginLibName} 失败:`, error);
|
console.error(`加载 ${loginLibName} 失败:`, error);
|
||||||
|
console.error('登录库是必需的,程序将退出');
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -95,6 +97,8 @@ try {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`加载 ${monitorLibName} 失败:`, error);
|
console.error(`加载 ${monitorLibName} 失败:`, error);
|
||||||
|
console.error('监控库是必需的,程序将退出');
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -135,6 +139,20 @@ try {
|
|||||||
console.error(`加载 ${serviceGenLibName} 失败:`, error);
|
console.error(`加载 ${serviceGenLibName} 失败:`, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取库加载状态
|
||||||
|
* @returns {Object} 包含各个库加载状态的对象
|
||||||
|
*/
|
||||||
|
function getLibraryStatus() {
|
||||||
|
return {
|
||||||
|
loginLib: !!loginLib,
|
||||||
|
monitorLib: !!monitorLib,
|
||||||
|
interfaceGenLib: !!interfaceGenLib,
|
||||||
|
modelGenLib: !!modelGenLib,
|
||||||
|
serviceGenLib: !!serviceGenLib
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// 注册进程退出时的清理函数
|
// 注册进程退出时的清理函数
|
||||||
function performCleanup() {
|
function performCleanup() {
|
||||||
console.log('正在执行清理操作...');
|
console.log('正在执行清理操作...');
|
||||||
@ -1029,6 +1047,7 @@ module.exports = {
|
|||||||
interfaceGenLib,
|
interfaceGenLib,
|
||||||
modelGenLib,
|
modelGenLib,
|
||||||
serviceGenLib,
|
serviceGenLib,
|
||||||
|
getLibraryStatus,
|
||||||
performCleanup,
|
performCleanup,
|
||||||
stringToBuffer,
|
stringToBuffer,
|
||||||
initializeMonitor,
|
initializeMonitor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user