fix: community
This commit is contained in:
@@ -93,11 +93,12 @@ const doReward = async (user, fund) => {
|
|||||||
vicFundSum: rewardInviter
|
vicFundSum: rewardInviter
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
createAction(2, {
|
createAction(4, {
|
||||||
userId: user.inviter,
|
userId: user.inviter,
|
||||||
tokenType: 'vic2vic', // 新模式标记
|
tokenType: 'vic2vic', // 新模式标记
|
||||||
amount: rewardInviter,
|
amount: rewardInviter,
|
||||||
remain: fund.asset
|
remain: fund.asset,
|
||||||
|
detail: { level: 1, info: '1级奖励' }
|
||||||
}).save();
|
}).save();
|
||||||
}).catch(() => null);
|
}).catch(() => null);
|
||||||
}
|
}
|
||||||
@@ -136,10 +137,10 @@ async function mine (job = mock, done = mock) {
|
|||||||
if (!userFundList || !Array.isArray(userFundList)) return 0;
|
if (!userFundList || !Array.isArray(userFundList)) return 0;
|
||||||
for (let i = 0, len = userFundList.length; i < len; ++i) {
|
for (let i = 0, len = userFundList.length; i < len; ++i) {
|
||||||
const fund = userFundList[i]; // 一条数据库fund表记录
|
const fund = userFundList[i]; // 一条数据库fund表记录
|
||||||
if (fund.lastMine && new Date(fund.lastMine).getDate() === new Date().getDate()) {
|
// if (fund.lastMine && new Date(fund.lastMine).getDate() === new Date().getDate()) {
|
||||||
mylog.info('已经计算过...跳过');
|
// mylog.info('已经计算过...跳过');
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
const user = await User.findById(fund.userId).exec();
|
const user = await User.findById(fund.userId).exec();
|
||||||
mylog.info('No. ', currentIndex, ' - ', i);
|
mylog.info('No. ', currentIndex, ' - ', i);
|
||||||
mylog.info('开始更新用户: ', user.id);
|
mylog.info('开始更新用户: ', user.id);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const User = require('./user.model');
|
const User = require('./user.model');
|
||||||
const Fund = require('../fund/fund.model');
|
const Action = require('../action/action.model');
|
||||||
const VReq = require('../vreq/vreq.model');
|
const VReq = require('../vreq/vreq.model');
|
||||||
const MsgCode = require('../msgCode/msgCode.controller');
|
const MsgCode = require('../msgCode/msgCode.controller');
|
||||||
const changePwd = require('../sign/sign.controller').changePasswd;
|
const changePwd = require('../sign/sign.controller').changePasswd;
|
||||||
@@ -124,13 +124,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
async getGroupBasicInfo (req, res) {
|
async getGroupBasicInfo (req, res) {
|
||||||
const { userId } = res.locals.user;
|
const { userId } = res.locals.user;
|
||||||
const [user, fund] = await Promise.all([User.findById(userId), Fund.findOne({userId})]);
|
const [user, action] = await Promise.all([User.findById(userId), Action.findOne({userId, type: '4'})]);
|
||||||
if (!user) return res.json({
|
if (!user) return res.json({
|
||||||
code: 1,
|
code: 1,
|
||||||
msg: '未知用户'
|
msg: '未知用户'
|
||||||
});
|
});
|
||||||
const follower = user.group && user.group.length || 0;
|
const follower = user.group && user.group.length || 0;
|
||||||
const reward = fund.asset && fund.asset.usdt || 0;
|
const reward = Array.isArray(action) && action.reduce((acc, obj) => acc + +obj.amount, 0) || 0;
|
||||||
// const list = await User.find({ inviter: { $in: user.group } }).exec();
|
// const list = await User.find({ inviter: { $in: user.group } }).exec();
|
||||||
const list = await User.find({ inviter: userId }).exec();
|
const list = await User.find({ inviter: userId }).exec();
|
||||||
const sum = list.reduce((acc, u) => {
|
const sum = list.reduce((acc, u) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user