1
This commit is contained in:
parent
9b69e95f0f
commit
9760a5452e
@ -142,67 +142,47 @@ class Erc721Refresher extends BaseService {
|
|||||||
async updateConfirmed(newOwner, blockNumber, row) {
|
async updateConfirmed(newOwner, blockNumber, row) {
|
||||||
const logHead = this.genLogHead('updateConfirmed ');
|
const logHead = this.genLogHead('updateConfirmed ');
|
||||||
const tokenId = row['token_id'];
|
const tokenId = row['token_id'];
|
||||||
const {err, conn} = await app.getDbConn(constant.BCNFTDB_NAME);
|
const {err} = await dbpool.execBcNftConn(
|
||||||
|
app,
|
||||||
|
'update',
|
||||||
|
't_nft',
|
||||||
|
[
|
||||||
|
['net_id', row['net_id']],
|
||||||
|
['token_id', row['token_id']],
|
||||||
|
['contract_address', row['contract_address']],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
['owner_address', bcutils.toNormalAddress(newOwner)],
|
||||||
|
['!confirm_count', () => {
|
||||||
|
return 'confirm_count + 1';
|
||||||
|
}],
|
||||||
|
['confirm_block_number', blockNumber]
|
||||||
|
]);
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error(logHead + tokenId + ' err:' + err);
|
log.error(logHead + tokenId + ' err:' + err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const nftDbConn = conn;
|
|
||||||
try {
|
|
||||||
{
|
|
||||||
const {err} = await nftDbConn.update(
|
|
||||||
't_nft',
|
|
||||||
[
|
|
||||||
['net_id', row['net_id']],
|
|
||||||
['token_id', row['token_id']],
|
|
||||||
['contract_address', row['contract_address']],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
['owner_address', bcutils.toNormalAddress(newOwner)],
|
|
||||||
['!confirm_count', () => {
|
|
||||||
return 'confirm_count + 1';
|
|
||||||
}],
|
|
||||||
['confirm_block_number', blockNumber]
|
|
||||||
]);
|
|
||||||
if (err) {
|
|
||||||
log.error(logHead + tokenId + ' err:' + err);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
nftDbConn.release();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async tokenIsExists(rawRow) {
|
async tokenIsExists(rawRow) {
|
||||||
const logHead = this.genLogHead('tokenIsExists ');
|
const logHead = this.genLogHead('tokenIsExists ');
|
||||||
const tokenId = rawRow['token_id'];
|
const tokenId = rawRow['token_id'];
|
||||||
const {err, conn} = await app.getDbConn(constant.BCNFTDB_NAME);
|
const {err, row} = await dbpool.execBcNftConn(
|
||||||
|
app,
|
||||||
|
'ormSelectOne',
|
||||||
|
't_nft',
|
||||||
|
[
|
||||||
|
['net_id', rawRow['net_id']],
|
||||||
|
['token_id', rawRow['token_id']],
|
||||||
|
['contract_address', rawRow['contract_address']],
|
||||||
|
]);
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error(logHead + tokenId + ' err:' + err);
|
log.error(logHead + tokenId + ' err:' + err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const nftDbConn = conn;
|
if (row) {
|
||||||
try {
|
return true;
|
||||||
{
|
|
||||||
const {err, row} = await nftDbConn.ormSelectOne(
|
|
||||||
't_nft',
|
|
||||||
[
|
|
||||||
['net_id', rawRow['net_id']],
|
|
||||||
['token_id', rawRow['token_id']],
|
|
||||||
['contract_address', rawRow['contract_address']],
|
|
||||||
]);
|
|
||||||
if (err) {
|
|
||||||
log.error(logHead + tokenId + ' err:' + err);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (row) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
nftDbConn.release();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user