This commit is contained in:
aozhiwei 2023-07-10 13:16:34 +08:00
parent 90333e6933
commit 6c84e42010
2 changed files with 19 additions and 1 deletions

View File

@ -148,7 +148,7 @@ CREATE TABLE `t_erc721_refresh` (
`contract_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_address',
`contract_name` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_name',
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
`state` int(11) NOT NULL DEFAULT '0' COMMENT 'state',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '0: dirty',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),

View File

@ -5,6 +5,8 @@ const log = require('j7/log');
const constant = require('common/constant');
const BaseService = require('./baseservice');
const LIMIT_COUNT = 100;
class Erc721Refresher extends BaseService {
async init(bc, net, refresher) {
@ -27,6 +29,22 @@ class Erc721Refresher extends BaseService {
async pullEvent() {
const logHead = this.genLogHead('pullEvent ');
try {
const {err, rows} = await this.conn.execQuery(
'SELECT * FROM t_erc721_refresh WHERE ' +
'AND net_id = ? AND contract_address = ? ' +
'LIMIT ' + LIMIT_COUNT,
[
this.getNetId(),
this.getContractAddress()
]);
if (err) {
throw err;
}
} catch (err) {
log.error(logHead + err);
await utils.sleep(5000 + utils.randRange(1000, 3000));
}
}
getNetId() {