Commit a892a03e authored by ml's avatar ml

Merge remote-tracking branch 'origin/master'

parents a5b9e71b beaf9704
......@@ -22,7 +22,8 @@ let job = schedule.scheduleJob('*/15 * * * * ?', async function () {
await syncCoin();
running = true;
logger.info("coinAndPair sync job finish");
} catch (e) {
}
catch (e) {
logger.info(e)
}
running = false;
......@@ -33,8 +34,8 @@ const syncPair = async () => {
let now = new Date();
let res = await spotPairs.prototype.findAll({
where: {
status:1,
updatedAt:{[ormDB.Op.lt]:new Date(now.getTime()-10*1000)} // 10秒之前的
status: 1,
updatedAt: { [ormDB.Op.lt]: new Date(now.getTime() - 10 * 1000) } // 10秒之前的
},
raw: true
})
......@@ -57,6 +58,8 @@ const syncPair = async () => {
logger.info(symbol, "sync config success")
}
}
}
......@@ -64,15 +67,15 @@ const syncCoin = async () => {
let now = new Date();
let res = await coinType.prototype.findAll({
where: {
is_main:1,
main_status:1,
updatedAt:{[ormDB.Op.lt]:new Date(now.getTime()-10*1000)} // 10秒之前的
is_main: 1,
main_status: 1,
updatedAt: { [ormDB.Op.lt]: new Date(now.getTime() - 10 * 1000) } // 10秒之前的
},
raw: true
})
for (const coin of res) {
const { general_name:symbol, id } = coin;
const { general_name: symbol, id } = coin;
let cfg = await getCoinFromCore(symbol);
if (cfg) {
await coinType.prototype.update({
......@@ -84,6 +87,25 @@ const syncCoin = async () => {
logger.info(symbol, "sync config success")
}
}
// 更新is_main等于0的状态
let dbsyncres = await coinType.prototype.findAll({
attributes: ['general_name','asset_id'],
where: {
is_main: 1,
main_status: 2,
},
raw: true
})
for (const coin of dbsyncres) {
await coinType.prototype.update({ main_status: 2,asset_id:coin.asset_id }, {
where: {
general_name: coin.general_name, is_main: 0, main_status: 0
}
})
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment