This commit is contained in:
aozhiwei 2024-06-18 17:30:41 +08:00
parent 80e9329ac6
commit c1606bbe62

View File

@ -24,6 +24,7 @@ class Transfer extends BaseEventProcess {
console.log(airDropMeta);
if (airDropMeta) {
await this.apiMint(to, tokenId, airDropMeta);
await this.adjustHeroId(tokenId);
} else {
await this.ingameActivate(from, to, tokenId, bcconst.BC_NFT_HERO);
}
@ -65,6 +66,39 @@ class Transfer extends BaseEventProcess {
});
}
async adjustHeroId(tokenId) {
const logHead = ' adjustHeroId ';
const {err, row} = await this.gameDbConn(
'ormSelectOne',
't_hero',
[
['token_id', tokenId],
['activate', 1],
]
);
if (err) {
this.throwError('adjustHeroId:' + err);
}
if (row && row['hero_id']) {
const {err} = await this.bcNftDbConn(
'update',
't_nft',
[
['net_id', this.getNetId()],
['contract_address', this.getContractAddress()],
['token_id', tokenId],
['item_id', 0],
],
[
['item_id', row['hero_id']],
]
);
if (err) {
this.throwError(logHead + err);
}
}
}
}
module.exports = Transfer;