From 2e35fe1aa5e61f9106b31f6edd52ab9ea00d3c39 Mon Sep 17 00:00:00 2001 From: chaosBreaking Date: Fri, 4 Oct 2019 17:21:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=94=BE=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/sign/sign.controller.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/modules/sign/sign.controller.js b/src/modules/sign/sign.controller.js index c483981..0dbc1d3 100644 --- a/src/modules/sign/sign.controller.js +++ b/src/modules/sign/sign.controller.js @@ -72,26 +72,22 @@ module.exports = { signUpReqInviter: inject(function(SysConfig) { const { JWT_SECRET, PWD_HASH_SALT } = SysConfig; return async (req, res) => { - // return res.json({ - // code: 404, - // msg: '暂停注册' - // }); let { phone, code, inviter, password } = req.body; if (!phone || !code || !password || !inviter) return res.json({ code: 1, - msg: 'Missing required parameters' + msg: '非法请求' }); phone = String.prototype.trim.call(phone); const isValidPhone = phone.startsWith('+86-') ? phoneRegCN.test(phone) : true; //国际手机暂不检测 if (!isValidPhone) return res.json({ code: 5, - msg: 'Invalid phone', + msg: '无效手机号', }); const isValidCode = await Code.verifyCode({ id: phone, code, type: CODE_TYPE['signUp'] }); if (!isValidCode) { return res.json({ code: 2, - msg: 'Invalid code', + msg: '验证码错误', }); } let validInviter = ''; @@ -201,10 +197,6 @@ module.exports = { }; }), sendMsgCode: async (req, res) => { - return res.json({ - code: 404, - msg: '暂停注册' - }); // 可作为通用的发送验证码接口 let { phone, type } = req.body; // 注意此处的type是字面值不是数值,应该是例如'signIn'等 @@ -212,12 +204,12 @@ module.exports = { if (exec && exec.code === 0) { res.json({ code: 0, - msg: 'Code sended' + msg: '验证码已发送' }); } else { res.json({ code: exec.code ? exec.code : 1, - error: exec.error ? exec.error : 'failed' + error: exec.error ? exec.error : '发送失败' }); } },