Authored by htoooth

Merge branch 'feature/add-ip' into release/6.0.2

... ... @@ -264,6 +264,8 @@ let mobileRegister = (req, res, next) => {
let mobile = req.body.mobile;
let code = req.body.code; // 短信验证码
let password = req.body.password;
let inviteCode = req.body.inviteCode;
let clientIp = req.yoho.clientIp;
let result = yield regService.validMobileCode(area, mobile, code); // 验证注册的标识码是否有效
if (!result.code || result.code !== 200) {
... ... @@ -272,7 +274,9 @@ let mobileRegister = (req, res, next) => {
}
/* 手机注册: 调用注册接口*/
let regResult = yield regService.regMobileAes(area, mobile, password, code, cookie.getShoppingKey(req), req.body); // eslint-disable-line
let regResult = yield regService.regMobileAes(
area, mobile, password, code, cookie.getShoppingKey(req), inviteCode, clientIp
);
if (!regResult.code || regResult.code !== 200) {
data.message = '注册失败';
... ...
... ... @@ -31,7 +31,7 @@ let validMobileCode = (area, mobile, code) => {
return api.post('', params);
};
let regMobileAes = (area, mobile, password, code, shoppingKey, extParam)=> {
let regMobileAes = (area, mobile, password, code, shoppingKey, inviteCode, clientIp)=> {
let params = {
method: 'app.passport.registerAES',
area: area,
... ... @@ -44,13 +44,16 @@ let regMobileAes = (area, mobile, password, code, shoppingKey, extParam)=> {
params.shopping_key = shoppingKey;
}
if (extParam) {
if (extParam.inviteCode) {
params.inviteCode = extParam.inviteCode;
}
if (inviteCode) {
params.inviteCode = inviteCode;
}
return api.post('', params);
return api.post('', params, {
headers: {
'user-agent': 'yoho/nodejs',
'X-YOHO-IP': clientIp
}
});
};
module.exports = {
... ...