From a31f0956990fd03775705ff21f71b321de062323 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Sun, 29 Sep 2019 20:49:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=90=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/fund/fund.controller.js | 7 ++++--- src/modules/fund/fund.service.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/fund/fund.controller.js b/src/modules/fund/fund.controller.js index 646e6a7..dededca 100644 --- a/src/modules/fund/fund.controller.js +++ b/src/modules/fund/fund.controller.js @@ -101,7 +101,8 @@ module.exports = { msg: '缺少必要参数', error: '缺少必要参数' }); - if (!Number.isFinite(+amount) || !Number.isSafeInteger(+amount) || Number.isNaN(+amount)) return res.json({ + // 非常危险 限制了1000万额度 + if (!Number.isFinite(+amount) || !Number.isSafeInteger(+amount) || Number.isNaN(+amount) || +amount > 10000000) return res.json({ code: 5, msg: '非法额度', error: '非法额度' @@ -113,9 +114,9 @@ module.exports = { }); const [user, fund] = await Promise.all([User.findById(userId), Fund.findOne({ userId })]); if ( - (coinId === 'vic' && amount < 1000) + (coinId === 'vic' && +amount < 1000) || - (coinId === 'usdt' && fund.lastWithdraw.usdt || (new Date() - new Date(fund.lastWithdraw.usdt)) / (1000 * 3600 * 24 * 7) >= 1) + +amount > (fund && +fund.fundSum || 10000) ) { return res.json({ code: 4, diff --git a/src/modules/fund/fund.service.js b/src/modules/fund/fund.service.js index 24724c3..32b6aa1 100644 --- a/src/modules/fund/fund.service.js +++ b/src/modules/fund/fund.service.js @@ -34,7 +34,7 @@ const services = [ }, { url: '/withdraw', - method: 'GET', + method: 'POST', controller: controller.withdraw }, {