fix: asset
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user