接口500后重新连接数据库,待测试

This commit is contained in:
gaofy 2023-11-10 18:25:13 +08:00
parent e433811f1d
commit d1be1673d9
3 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,7 @@ const getTable = () => app.post('/getaimedicine', function (req, res) {
connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) {
if (error) {
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
connection(database).connect();
return res.status(500).send(error);
} else {
res.send(results);

View File

@ -14,6 +14,7 @@ const getTable = () => app.post('/getdoctormedicine', function (req, res) {
connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) {
if (error) {
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
connection(database).connect();
return res.status(500).send(error);
} else {
res.send(results);

View File

@ -14,6 +14,7 @@ const getTable = () => app.post('/getfeature', function (req, res) {
connection(database).query(m_get(table, Clause, order, start, end), function (error, results, fields) {
if (error) {
console.log(`${nowTime()} 错误:${JSON.stringify(error)}`);
connection(database).connect();
return res.status(500).send(error);
} else {
res.send(results);