This commit is contained in:
aozhiwei 2023-07-13 15:01:40 +08:00
parent 875f15dc8d
commit b324ba2e7f

View File

@ -42,9 +42,9 @@ async function internalCreateConn(app, name) {
return dbObj.conn;
}
async function getBcEventConn(app, method, ...args) {
async function internalDbConn(app, name, method, ...args) {
try {
const conn = await internalCreateConn(app, constant.BCEVENTDB_NAME);
const conn = await internalCreateConn(app, name);
const ret = await conn[method](...args);
if (ret.err) {
return {
@ -54,7 +54,12 @@ async function getBcEventConn(app, method, ...args) {
'rows': null
};
}
return {
'err': null,
'conn': null,
'row': ret.hasOwnProperty('row') ? ret['row'] : null,
'rows': ret.hasOwnProperty('rows') ? ret['rows'] : null,
};
} catch (err) {
return {
'err': err,
@ -62,7 +67,11 @@ async function getBcEventConn(app, method, ...args) {
'row': null,
'rows': null
};
};
}
async function getBcEventConn(app, method, ...args) {
const conn = await internalCreateConn(app, constant.BCEVENTDB_NAME);
}
async function getBcNftConn(app, method, ...args) {