This commit is contained in:
aozhiwei 2023-07-12 12:02:00 +08:00
parent b68db27bdb
commit 5592c7ac73
5 changed files with 11 additions and 11 deletions

View File

@ -1,8 +1,8 @@
const utils = require('j7/utils'); const utils = require('j7/utils');
const basewrap = require('./basewrap'); const basewrap = require('./basewrap');
class BlockChainDb extends basewrap.BaseWrap { class BcEventDb extends basewrap.BaseWrap {
} }
module.exports = BlockChainDb; module.exports = BcEventDb;

View File

@ -18,7 +18,7 @@ class Log extends BaseModel {
fields.push([key, params[key]]); fields.push([key, params[key]]);
} }
} }
await this.getSession().blockChainConn await this.getSession().bcEventConn
( (
'insert', 'insert',
't_log', 't_log',

View File

@ -9,7 +9,7 @@ class Transaction extends BaseModel {
seqId: 0 seqId: 0
}; };
const nowTime = utils.getUtcTime(); const nowTime = utils.getUtcTime();
const lastId = await this.getSession().blockChainConn const lastId = await this.getSession().bcEventConn
( (
'insertEx', 'insertEx',
't_transaction', 't_transaction',
@ -26,7 +26,7 @@ class Transaction extends BaseModel {
} }
async update(idx, fields) { async update(idx, fields) {
const err = await this.getSession().blockChainConn const err = await this.getSession().bcEventConn
( (
'update', 'update',
't_transaction', 't_transaction',

View File

@ -14,7 +14,7 @@ class UsedTokenId extends BaseModel {
['createtime', nowTime], ['createtime', nowTime],
['modifytime', nowTime], ['modifytime', nowTime],
]; ];
await this.getSession().blockChainConn await this.getSession().bcEventConn
( (
'insert', 'insert',
't_used_token_id', 't_used_token_id',
@ -23,7 +23,7 @@ class UsedTokenId extends BaseModel {
} }
async find(tokenId) { async find(tokenId) {
const {err, row} = await this.getSession().blockChainConn const {err, row} = await this.getSession().bcEventConn
( (
'ormSelectOne', 'ormSelectOne',
't_used_token_id', 't_used_token_id',

View File

@ -65,9 +65,9 @@ class Session {
return utils.jsonEncode(this.req.query); return utils.jsonEncode(this.req.query);
} }
async getBlockChainDb() { async getBcEventDb() {
const idx = 0; const idx = 0;
const dbKey = 'BlockChainDb' + idx; const dbKey = 'BcEventDb' + idx;
if (this.useConns[dbKey]) { if (this.useConns[dbKey]) {
return this.useConns[dbKey]; return this.useConns[dbKey];
} }
@ -106,8 +106,8 @@ class Session {
return metaFactory[name](this, ...args); return metaFactory[name](this, ...args);
} }
async blockChainConn(method, ...args) { async bcEventConn(method, ...args) {
const conn = await this.getBlockChainDb(); const conn = await this.getBcEventDb();
const ret = await conn[method](...args); const ret = await conn[method](...args);
if (ret.err){ if (ret.err){
this.throwError(500, 'internal error'); this.throwError(500, 'internal error');