This commit is contained in:
chaosBreaking
2019-10-17 10:51:29 +08:00
parent db6467f013
commit 8b94f641b0

View File

@@ -48,7 +48,7 @@ async function awardMine(user, fund) {
for (let i = 0, len = fund.fundList.length; i < len; ++i) { for (let i = 0, len = fund.fundList.length; i < len; ++i) {
const released = fund.releasedAmout || 0; const released = fund.releasedAmout || 0;
if (released === fund.releasedAmout) { if (released === fund.releasedAmout) {
console.log('矿晶失效,开始标记'); mylog.info('矿晶失效,开始标记');
await Fund.findByIdAndUpdate(fund.id, { await Fund.findByIdAndUpdate(fund.id, {
$set: { $set: {
[`fundList.${i}.status`]: 2 //标记失效 [`fundList.${i}.status`]: 2 //标记失效
@@ -77,8 +77,8 @@ const doReward = async (user, fund) => {
// const rewardInvite = awardInvite(user, fund); // const rewardInvite = awardInvite(user, fund);
const rewardInvite = 0; const rewardInvite = 0;
const reward = +rewardMine + rewardInvite; const reward = +rewardMine + rewardInvite;
console.log('挖矿奖励: ', rewardMine); mylog.info('挖矿奖励: ', rewardMine);
console.log('社群奖励: ', rewardInvite); mylog.info('社群奖励: ', rewardInvite);
reward && await Fund.findByIdAndUpdate(fund.id, { reward && await Fund.findByIdAndUpdate(fund.id, {
$inc: { $inc: {
'asset.vic': reward, 'asset.vic': reward,
@@ -105,8 +105,8 @@ const doReward = async (user, fund) => {
}); });
}; };
const mock = { const mock = {
touch: () => {console.log('-----------------\n');}, touch: () => {mylog.info('-----------------\n');},
done: () => {console.log('done');}, done: () => {mylog.info('done');},
}; };
async function mine (job = mock, done = mock) { async function mine (job = mock, done = mock) {
//todo: 程序内检查是否可以执行,保证不会启动时错误的自动执行一次 //todo: 程序内检查是否可以执行,保证不会启动时错误的自动执行一次
@@ -140,7 +140,7 @@ async function mine (job = mock, done = mock) {
// continue; // continue;
// } // }
const user = await User.findById(fund.userId).exec(); const user = await User.findById(fund.userId).exec();
console.log('No. ', currentIndex, ' - ', i); mylog.info('No. ', currentIndex, ' - ', i);
mylog.info('开始更新用户: ', user.id); mylog.info('开始更新用户: ', user.id);
await doReward(user, fund); await doReward(user, fund);
mylog.info('用户: ', user.id, '更新完毕\n'); mylog.info('用户: ', user.id, '更新完毕\n');