job touch

This commit is contained in:
chaosBreaking
2019-10-19 17:23:19 +08:00
parent 59aa9b75f4
commit 230c77394e
4 changed files with 59 additions and 131 deletions

View File

@@ -56,7 +56,14 @@ async function awardMine(user, fund) {
});
return 0;
}
sum += +fund.fundList[i].amount * tokenReleaseRate;
const profit = +fund.fundList[i].amount * tokenReleaseRate;
await Fund.findByIdAndUpdate(fund.id, {
$inc: {
[`fundList.${i}.mineCount`]: 1,
[`fundList.${i}.releasedAmout`]: profit,
},
});
sum += profit;
}
return sum.toFixed(2);
}
@@ -156,14 +163,17 @@ async function mine (job = mock, done = mock) {
value: -1
}
});
typeof process.send === 'function' && process.send('tick');
}
currentIndex += 10;
probe.currentIndex = currentIndex;
}
mylog.info('收益计算分配完成');
typeof process.send === 'function' && process.send('tick');
await system.findOneAndUpdate({
key: 'userIndex4job'
}, { $set: { value: 0 } }).exec();
typeof process.send === 'function' && process.send('tick');
await system.findOneAndUpdate({
key: 'mineCount',
}, {
@@ -171,12 +181,13 @@ async function mine (job = mock, done = mock) {
value: 1
}
}, { upsert: true });
typeof process.send === 'function' && process.send('tick');
await system.findOneAndUpdate({
key: 'lastMine',
}, {
value: new Date().toISOString()
}, { upsert: true });
typeof process.send === 'function' && process.send('tick');
typeof done === 'function' && done('收益计算分配完成');
process.exit();
}