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