|
@@ -10,6 +10,7 @@ const report = require("../model/report") //导入 db.js
|
|
|
const BigNumber = require('bignumber.js')
|
|
|
const czz = require('../model/czz')
|
|
|
var remote_config_db = require("../model/db/remote_config_db");
|
|
|
+const account_mysql = require("../model/db/account_info_db") //导入 db.js
|
|
|
/**
|
|
|
* 获取代币价格
|
|
|
* @param {*} ctx
|
|
@@ -296,7 +297,7 @@ async function withdraw_task() {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- logger.info('withdraw exec obj',exec_obj)
|
|
|
+ logger.info('withdraw exec obj', exec_obj)
|
|
|
//是否是黑名单
|
|
|
var isBlackList = await remote_config_db.isBlackList('withdraw', exec_obj.chain, exec_obj.receiver)
|
|
|
if (isBlackList) {
|
|
@@ -394,7 +395,6 @@ async function withdraw_task() {
|
|
|
update_obj.nonce = nonce
|
|
|
update_obj.gas_price = curGasPrice.toString()
|
|
|
update_obj.gas_limit = curGasLimit.toString()
|
|
|
-
|
|
|
try {
|
|
|
update_obj.value = utils.scientificNotationToString(value).toString()
|
|
|
} catch (error) {
|
|
@@ -713,6 +713,48 @@ async function timer_transfer_czz_task() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+async function bsc_log_monitoring() {
|
|
|
+ var delay = 60 * 1000
|
|
|
+ while (1) {
|
|
|
+ var exec_obj = await redis.redis_pop(reids_token_config.BSC_LOG_MONITORING_KEY)
|
|
|
+ if (!exec_obj) {
|
|
|
+ await utils.sleep(10000)
|
|
|
+ logger.log("no new check tasks")
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+ logger.info('bsc_log_monitoring exec start:', exec_obj)
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (typeof exec_obj === 'string')
|
|
|
+ exec_obj = JSON.parse(exec_obj)
|
|
|
+ } catch (error) {
|
|
|
+ logger.error('bsc_log_monitoring:', error)
|
|
|
+ }
|
|
|
+
|
|
|
+ var tryCount = 5
|
|
|
+ do {
|
|
|
+ if (tryCount == 0) {
|
|
|
+ logger.error('数据在5分钟未更新', JSON.stringify(exec_obj))
|
|
|
+ break
|
|
|
+ }
|
|
|
+ if (exec_obj.transactionHash) {
|
|
|
+ var ret = await account_mysql.getAccountTransactions({
|
|
|
+ type: 'only_hash',
|
|
|
+ transaction_hash: exec_obj.transactionHash
|
|
|
+ })
|
|
|
+ if (ret && ret.code == 0 && ret.data.total > 0) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ --tryCount
|
|
|
+ logger.debug('getAccountTransactions', tryCount, exec_obj)
|
|
|
+ await utils.sleep(delay)
|
|
|
+ } while (tryCount >= 0);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//获取交易记录
|
|
|
router.post('/getTransfers', getTransfers)
|
|
|
router.post('/getTransfersV2', getTransfersV2)
|
|
@@ -741,12 +783,14 @@ withdraw_task();
|
|
|
collect_conis_task();
|
|
|
//czz 504 检查
|
|
|
check_czz_withdraw_task();
|
|
|
+// bsc 监控
|
|
|
+bsc_log_monitoring()
|
|
|
|
|
|
if (process.env.NODE_ENV == 'dev' || process.env.NODE_ENV == 'test') {
|
|
|
- // timer_transfer_bsc_task()
|
|
|
- // timer_transfer_czz_task()
|
|
|
- // timer_collect_conis_bsc_task()
|
|
|
- // timer_collect_conis_czz_task()
|
|
|
+ timer_transfer_bsc_task()
|
|
|
+ timer_transfer_czz_task()
|
|
|
+ timer_collect_conis_bsc_task()
|
|
|
+ timer_collect_conis_czz_task()
|
|
|
}
|
|
|
|
|
|
module.exports = router
|