feat: 提币条件
This commit is contained in:
@@ -107,13 +107,23 @@ module.exports = {
|
||||
msg: '不支持的提现币种',
|
||||
error: '不支持的提现币种',
|
||||
});
|
||||
const user = await User.findById(userId).exec();
|
||||
const [user, fund] = await Promise.all([User.findById(userId), Fund.findOne({ userId })]);
|
||||
if (
|
||||
(coinId === 'vic' && amount < 1000)
|
||||
||
|
||||
(coinId === 'usdt' && fund.lastWithdraw.usdt || (new Date() - new Date(fund.lastWithdraw.usdt)) / (1000 * 3600 * 24 * 7) >= 1)
|
||||
) {
|
||||
return res.json({
|
||||
code: 4,
|
||||
msg: '不满足提现条件',
|
||||
error: '不满足提现条件',
|
||||
});
|
||||
}
|
||||
if (user.fundPwd !== password) return res.json({
|
||||
code: 1,
|
||||
msg: '资金密码错误',
|
||||
error: '资金密码错误',
|
||||
});
|
||||
const fund = await Fund.findOne({ userId }).exec();
|
||||
const cost = +amount * 1.005;
|
||||
if (fund.asset && +fund.asset[coinId] < cost) return res.json({
|
||||
code: 2,
|
||||
|
||||
Reference in New Issue
Block a user