This commit is contained in:
aozhiwei 2023-06-13 15:34:33 +08:00
parent 7256e7850f
commit e1caaf5f35
5 changed files with 10 additions and 10 deletions

View File

@ -96,7 +96,7 @@ function init() {
'Contract' 'Contract'
); );
registerMetaClass(configDir + 'marketdb_mysql.json', registerMetaClass(configDir + 'blockchaindb_mysql.json',
'', '',
'MarketDb' 'MarketDb'
); );

View File

@ -18,7 +18,7 @@ class Log extends BaseModel {
fields.push([key, params[key]]); fields.push([key, params[key]]);
} }
} }
await this.getSession().marketConn await this.getSession().blockChainConn
( (
'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().marketConn const lastId = await this.getSession().blockChainConn
( (
'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().marketConn const err = await this.getSession().blockChainConn
( (
'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().marketConn await this.getSession().blockChainConn
( (
'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().marketConn const {err, row} = await this.getSession().blockChainConn
( (
'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 getMarketDb() { async getBlockChainDb() {
const idx = 0; const idx = 0;
const dbKey = 'MarketDb' + idx; const dbKey = 'BlockChainDb' + 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 marketConn(method, ...args) { async blockChainConn(method, ...args) {
const conn = await this.getMarketDb(); const conn = await this.getBlockChainDb();
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');