This commit is contained in:
aozhiwei 2023-07-11 17:06:22 +08:00
parent f078aaaa25
commit 16bb6b64fb
2 changed files with 19 additions and 29 deletions

View File

@ -2,7 +2,6 @@ const log = require('j7/log');
const app = require('j7/app');
const bcutils = require('j7/bcutils');
const utils = require('j7/utils');
const j7event = require('j7/event');
const constant = require('common/constant');
const bcconst = require('common/bcconst');
const bchelper = require('common/bchelper');
@ -21,7 +20,7 @@ event TokenMinted(
class Activate721Nft extends BaseEventProcess {
async start(event) {
async start() {
const returnValues = this.getReturnValues();
const transId = returnValues['nonce'];
const to = returnValues['to'];
@ -61,20 +60,6 @@ class Activate721Nft extends BaseEventProcess {
return;
}
await this.updateGameDbInfo(transId, itemUniId, itemId, tokenId, tokenType);
const {err} = await this.bcNftConn(
'ormSelectOne',
't_nft',
[
['token_id', tokenId],
['net_id', this.getNetId()],
['contract_address', this.getContractAddress()],
]
);
if (err) {
log.error('processEvent:' + err);
throw 'processEvent:' + err;
}
if (!row) {
const nowTime = utils.getUtcTime();
const fieldList = [
['token_id', tokenId],
@ -87,14 +72,19 @@ class Activate721Nft extends BaseEventProcess {
['modifytime', nowTime],
];
const {err} = await this.bcNftConn(
'insert',
'upsert',
't_nft',
[
['token_id', tokenId],
['net_id', this.getNetId()],
['contract_address', this.getContractAddress()],
],
[
],
fieldList
);
if (err) {
log.error('processEvent:' + err);
throw 'processEvent:' + err;
}
this.throwError('mintNft transId:' + transId);
}
}

View File

@ -11,7 +11,7 @@ class BaseEventProcess {
constructor(proc, conn, eventDb) {
this.eventProc = proc;
this.conn = conn;
//this.conn = conn;
this.eventDb = eventDb;
this.returnValues = utils.jsonDecode(this.getEventDb()['return_values']);
this.bcEventConn = null;