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