...
|
...
|
@@ -30,22 +30,6 @@ let checkCode = (req, res, next) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 检查手机格式
|
|
|
*/
|
|
|
let checkMobileMiddleware = (req, res, next) => {
|
|
|
let mobile = +req.body.mobile;
|
|
|
let area = +req.body.area;
|
|
|
|
|
|
if (!_.isNumber(mobile) || !_.isNumber(area)) {
|
|
|
return res.json({
|
|
|
code: 400,
|
|
|
message: '手机号码格式不正确'
|
|
|
});
|
|
|
}
|
|
|
next();
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 检查密码格式
|
|
|
*/
|
|
|
let checkPassword = (req, res, next) => {
|
...
|
...
|
@@ -96,8 +80,8 @@ let checkMobile = (req, res, next) => { |
|
|
let data = {
|
|
|
code: 400
|
|
|
};
|
|
|
let mobile = +req.body.mobile;
|
|
|
let area = +req.body.area;
|
|
|
let mobile = req.body.mobile;
|
|
|
let area = req.body.area;
|
|
|
|
|
|
// 判断手机号是否检查超过指定次数
|
|
|
let regCheckKey = 'regCheckMobileNum_' + passportHelper.makeAreaMobile(area, mobile);
|
...
|
...
|
@@ -149,8 +133,8 @@ let sendBindMsg = (req, res, next) => { |
|
|
data: ''
|
|
|
};
|
|
|
|
|
|
let mobile = +req.body.mobile;
|
|
|
let area = +req.body.area;
|
|
|
let mobile = req.body.mobile;
|
|
|
let area = req.body.area;
|
|
|
|
|
|
// 检查是否检查过
|
|
|
let checkNum = yield cache.get(`regCheckMobileNum_${passportHelper.makeAreaMobile(area, mobile)}`);
|
...
|
...
|
@@ -193,9 +177,9 @@ let msgCaptcha = (req, res, next) => { |
|
|
message: '',
|
|
|
data: ''
|
|
|
};
|
|
|
let area = +req.body.area;
|
|
|
let mobile = +req.body.mobile;
|
|
|
let code = +req.body.code; // 短信验证码
|
|
|
let area = req.body.area;
|
|
|
let mobile = req.body.mobile;
|
|
|
let code = req.body.code; // 短信验证码
|
|
|
|
|
|
regService.validMobileCode(area, mobile, code).then((result) => {
|
|
|
if (result.code) {
|
...
|
...
|
@@ -243,9 +227,9 @@ let mobileRegister = (req, res, next) => { |
|
|
|
|
|
yield cache.set(ipKey, ipTimes + 1, 3600);
|
|
|
|
|
|
let area = +req.body.area;
|
|
|
let mobile = +req.body.mobile;
|
|
|
let code = +req.body.code; // 短信验证码
|
|
|
let area = req.body.area;
|
|
|
let mobile = req.body.mobile;
|
|
|
let code = req.body.code; // 短信验证码
|
|
|
let password = req.body.password;
|
|
|
let result = yield regService.validMobileCode(area, mobile, code); // 验证注册的标识码是否有效
|
|
|
|
...
|
...
|
@@ -295,7 +279,6 @@ let success = (req, res) => { |
|
|
|
|
|
module.exports = {
|
|
|
checkCode,
|
|
|
checkMobileMiddleware,
|
|
|
checkPassword,
|
|
|
index,
|
|
|
success,
|
...
|
...
|
|