Authored by 郭成尧

Merge branch 'feature/passportctx' into 'release/6.3'

bind-code-add



See merge request !1167
... ... @@ -190,13 +190,9 @@ const bind = {
let from = req.cookies.from || 'yohobuy';
if (_.isNumber(parseInt(phoneNum, 0)) && openId && sourceType && nickname && areaCode && code) {
req.ctx(BindServiceModel).checkBindCode(areaCode, phoneNum, code).then(result => {
if (result && result.code && result.code === 200) {
return req.ctx(BindServiceModel).bindMobile(openId, sourceType,
phoneNum, areaCode, password, from, nickname);
} else {
return { code: 400, message: '短信验证码错误', data: '' };
}
req.ctx(BindServiceModel).bindMobile({
openId, sourceType, phoneNum,
areaCode, password, from, nickname, code
}).then(result => {
let refer = helpers.urlFormat('/passport/bind/success?type=bind');
... ...
... ... @@ -50,25 +50,26 @@ class BindServiceModel extends global.yoho.BaseModel {
}});
}
bindMobile(openId, sourceType, mobile, area, password, from, nickname) {
let params = {
bindMobile(params) {
let finalParams = {
method: 'app.passport.bind',
mobile: mobile,
open_id: openId,
source_type: sourceType,
area: area,
business_line: FROM[from].business_line
mobile: params.phoneNum,
code: params.code,
open_id: params.openId,
source_type: params.sourceType,
area: params.areaCode,
business_line: FROM[params.from].business_line
};
if (password) {
params.password = password;
if (params.password) {
finalParams.password = params.password;
}
if (nickname) {
params.nickname = nickname;
if (params.nickname) {
finalParams.nickname = params.nickname;
}
return this.get({ data: params });
return this.get({ data: finalParams });
}
relateMobile(openId, sourceType, mobile, area) {
... ...