fix: asset

This commit is contained in:
chaosBreaking
2019-10-28 11:05:34 +08:00
parent 094a859f62
commit 590b2b5c0a
3 changed files with 8 additions and 8 deletions

View File

@@ -82,9 +82,9 @@ const doReward = async (user, fund) => {
}).then(async () => {
rewardMine > 0 && createAction(1, {
userId: user.id,
tokenType: 'vic2vic', // 新模式标记
tokenType: 'vic', // 新模式标记
amount: rewardMine,
remain: fund.asset
remain: fund.vicFundSum
}).save();
if (user.inviter) {
const inviter = await Fund.findOne({ userId: user.inviter });
@@ -98,9 +98,9 @@ const doReward = async (user, fund) => {
}),
createAction(4, {
userId: user.inviter,
tokenType: 'vic2vic', // 新模式标记
tokenType: 'vic', // 新模式标记
amount: rewardInviter,
remain: fund.asset,
remain: fund.vicFundSum,
detail: { level: 1, info: '1级奖励' }
}).save()
]).catch((err) => mylog.error(err.errmsg));

View File

@@ -135,7 +135,7 @@ module.exports = {
});
}
const cost = +amount * 1.005;
if (fund.asset && +fund.asset[coinId] < cost) return res.json({
if (fund.vicFundSum < cost) return res.json({
code: 2,
msg: '资金不足',
error: 'insufficient fund'
@@ -149,7 +149,7 @@ module.exports = {
msg: '资金密码错误',
error: '资金密码错误',
});
const action = createAction(3, { userId, amount, remain: fund.asset, op: 0, detail: { targetAddress, coinId } });
const action = createAction(3, { userId, amount, remain: fund.vicFundSum, op: 0, detail: { targetAddress, coinId } });
const ticket = createTicket('withdraw', { userId, amount: +amount, action, targetAddress, coinId });
try {
await fund.decFund(cost);