1
This commit is contained in:
parent
40d769e55e
commit
ede26a9ef3
@ -253,6 +253,29 @@ CREATE TABLE `t_721nft_transfer` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_721nft_spec_transfer`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_721nft_spec_transfer`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_721nft_spec_transfer` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`net_id` bigint NOT NULL DEFAULT '0' COMMENT 'net_id',
|
||||
`contract_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_address',
|
||||
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
|
||||
`from_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'from_address',
|
||||
`to_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'to_address',
|
||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status 0:待处理 1:已处理',
|
||||
`src_idx` bigint NOT NULL DEFAULT '0' COMMENT 'src_idx',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY (`src_idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_nftmarket`
|
||||
--
|
||||
|
@ -364,21 +364,55 @@ class BaseEventProcess {
|
||||
|
||||
async update721NftOwner(tokenId, contractAddress, ownerAddress, lastOwnerAddress) {
|
||||
const logHead = this.genLogHead(' update721NftOwner ');
|
||||
const {err} = await this.bcNftDbConn(
|
||||
'update',
|
||||
't_nft',
|
||||
[
|
||||
['token_id', tokenId],
|
||||
['net_id', this.getNetId()],
|
||||
['contract_address', contractAddress],
|
||||
],
|
||||
[
|
||||
['owner_address', bcutils.toNormalAddress(ownerAddress)],
|
||||
['last_owner_address', bcutils.toNormalAddress(lastOwnerAddress)],
|
||||
]
|
||||
);
|
||||
if (err) {
|
||||
this.throwError(logHead + err);
|
||||
{
|
||||
const {err} = await this.bcNftDbConn(
|
||||
'update',
|
||||
't_nft',
|
||||
[
|
||||
['token_id', tokenId],
|
||||
['net_id', this.getNetId()],
|
||||
['contract_address', contractAddress],
|
||||
],
|
||||
[
|
||||
['owner_address', bcutils.toNormalAddress(ownerAddress)],
|
||||
['last_owner_address', bcutils.toNormalAddress(lastOwnerAddress)],
|
||||
]
|
||||
);
|
||||
if (err) {
|
||||
this.throwError(logHead + err);
|
||||
}
|
||||
}
|
||||
{
|
||||
const nowTime = utils.getUtcTime();
|
||||
const from = lastOwnerAddress;
|
||||
const to = ownerAddress;
|
||||
const lockAddress = this.getContractAddressByName('GoldBrick');
|
||||
const srcIdx = this.eventDb['src_idx'];
|
||||
if (bcutils.isSysAddress(from) || from == lockAddress ||
|
||||
to == lockAddress) {
|
||||
const {err} = await this.bcNftDbConn(
|
||||
'upsert',
|
||||
't_721nft_spec_transfer',
|
||||
[
|
||||
['src_idx', srcIdx],
|
||||
],
|
||||
[
|
||||
],
|
||||
[
|
||||
['net_id', this.eventDb['net_id']],
|
||||
['contract_address', this.eventDb['contract_address']],
|
||||
['token_id', tokenId],
|
||||
['from_address', from],
|
||||
['to_address', to],
|
||||
['src_idx', srcIdx],
|
||||
['createtime', nowTime],
|
||||
['modifytime', nowTime],
|
||||
]
|
||||
);
|
||||
if (err) {
|
||||
this.throwError(logHead + err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user