1
This commit is contained in:
parent
9b69e95f0f
commit
9760a5452e
@ -142,67 +142,47 @@ class Erc721Refresher extends BaseService {
|
||||
async updateConfirmed(newOwner, blockNumber, row) {
|
||||
const logHead = this.genLogHead('updateConfirmed ');
|
||||
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) {
|
||||
log.error(logHead + tokenId + ' err:' + err);
|
||||
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;
|
||||
}
|
||||
|
||||
async tokenIsExists(rawRow) {
|
||||
const logHead = this.genLogHead('tokenIsExists ');
|
||||
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) {
|
||||
log.error(logHead + tokenId + ' err:' + err);
|
||||
return false;
|
||||
}
|
||||
const nftDbConn = conn;
|
||||
try {
|
||||
{
|
||||
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();
|
||||
if (row) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user