1
This commit is contained in:
parent
f078aaaa25
commit
16bb6b64fb
@ -2,7 +2,6 @@ const log = require('j7/log');
|
|||||||
const app = require('j7/app');
|
const app = require('j7/app');
|
||||||
const bcutils = require('j7/bcutils');
|
const bcutils = require('j7/bcutils');
|
||||||
const utils = require('j7/utils');
|
const utils = require('j7/utils');
|
||||||
const j7event = require('j7/event');
|
|
||||||
const constant = require('common/constant');
|
const constant = require('common/constant');
|
||||||
const bcconst = require('common/bcconst');
|
const bcconst = require('common/bcconst');
|
||||||
const bchelper = require('common/bchelper');
|
const bchelper = require('common/bchelper');
|
||||||
@ -21,7 +20,7 @@ event TokenMinted(
|
|||||||
|
|
||||||
class Activate721Nft extends BaseEventProcess {
|
class Activate721Nft extends BaseEventProcess {
|
||||||
|
|
||||||
async start(event) {
|
async start() {
|
||||||
const returnValues = this.getReturnValues();
|
const returnValues = this.getReturnValues();
|
||||||
const transId = returnValues['nonce'];
|
const transId = returnValues['nonce'];
|
||||||
const to = returnValues['to'];
|
const to = returnValues['to'];
|
||||||
@ -61,40 +60,31 @@ class Activate721Nft extends BaseEventProcess {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.updateGameDbInfo(transId, itemUniId, itemId, tokenId, tokenType);
|
await this.updateGameDbInfo(transId, itemUniId, itemId, tokenId, tokenType);
|
||||||
|
const nowTime = utils.getUtcTime();
|
||||||
|
const fieldList = [
|
||||||
|
['token_id', tokenId],
|
||||||
|
['token_type', tokenType],
|
||||||
|
['item_id', itemId],
|
||||||
|
['owner_address', bcutils.toNormalAddress(owner)],
|
||||||
|
['creator_address', bcutils.toNormalAddress(owner)],
|
||||||
|
['confirm_block_number', this.getBlockNumber()],
|
||||||
|
['createtime', nowTime],
|
||||||
|
['modifytime', nowTime],
|
||||||
|
];
|
||||||
const {err} = await this.bcNftConn(
|
const {err} = await this.bcNftConn(
|
||||||
'ormSelectOne',
|
'upsert',
|
||||||
't_nft',
|
't_nft',
|
||||||
[
|
[
|
||||||
['token_id', tokenId],
|
['token_id', tokenId],
|
||||||
['net_id', this.getNetId()],
|
['net_id', this.getNetId()],
|
||||||
['contract_address', this.getContractAddress()],
|
['contract_address', this.getContractAddress()],
|
||||||
]
|
],
|
||||||
|
[
|
||||||
|
],
|
||||||
|
fieldList
|
||||||
);
|
);
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error('processEvent:' + err);
|
this.throwError('mintNft transId:' + transId);
|
||||||
throw 'processEvent:' + err;
|
|
||||||
}
|
|
||||||
if (!row) {
|
|
||||||
const nowTime = utils.getUtcTime();
|
|
||||||
const fieldList = [
|
|
||||||
['token_id', tokenId],
|
|
||||||
['token_type', tokenType],
|
|
||||||
['item_id', itemId],
|
|
||||||
['owner_address', bcutils.toNormalAddress(owner)],
|
|
||||||
['creator_address', bcutils.toNormalAddress(owner)],
|
|
||||||
['confirm_block_number', this.getBlockNumber()],
|
|
||||||
['createtime', nowTime],
|
|
||||||
['modifytime', nowTime],
|
|
||||||
];
|
|
||||||
const {err} = await this.bcNftConn(
|
|
||||||
'insert',
|
|
||||||
't_nft',
|
|
||||||
fieldList
|
|
||||||
);
|
|
||||||
if (err) {
|
|
||||||
log.error('processEvent:' + err);
|
|
||||||
throw 'processEvent:' + err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class BaseEventProcess {
|
|||||||
|
|
||||||
constructor(proc, conn, eventDb) {
|
constructor(proc, conn, eventDb) {
|
||||||
this.eventProc = proc;
|
this.eventProc = proc;
|
||||||
this.conn = conn;
|
//this.conn = conn;
|
||||||
this.eventDb = eventDb;
|
this.eventDb = eventDb;
|
||||||
this.returnValues = utils.jsonDecode(this.getEventDb()['return_values']);
|
this.returnValues = utils.jsonDecode(this.getEventDb()['return_values']);
|
||||||
this.bcEventConn = null;
|
this.bcEventConn = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user