...
|
...
|
@@ -218,6 +218,9 @@ const bindCheck = (req, res, next) => { |
|
|
} else if (result.code === 200 && result.data.is_register === 1) {
|
|
|
return UserService.getUserInfoAsync(area, mobile).then(user => {
|
|
|
// 绑定流程:code=201 已注册 绑定过其他第三方
|
|
|
req.session.thirdBind = {
|
|
|
mobile: mobile
|
|
|
};
|
|
|
return { code: 201, message: result.message, data: { user: user } };
|
|
|
});
|
|
|
} else if (result.code === 200 && result.data.is_register === 3) {
|
...
|
...
|
@@ -284,25 +287,29 @@ const bindMobile = (req, res, next) => { |
|
|
let sourceType = _.trim(req.body.sourceType);
|
|
|
let password = _.trim(req.body.password) || '';
|
|
|
|
|
|
BindService.bindMobileAsync(openId, sourceType, mobile, area, password).then(result => {
|
|
|
if (result && result.code) {
|
|
|
if (result.code === 200 && result.data && result.data.uid) {
|
|
|
let refer = helpers.urlFormat('/passport/thirdlogin/bindsuccess', {
|
|
|
sourceType: sourceType + '_bind'
|
|
|
});
|
|
|
|
|
|
return LoginService.syncUserSession(result.data.uid, req, res).then(() => {
|
|
|
return { code: 200, message: result.message, data: { refer: refer } };
|
|
|
});
|
|
|
if (req.session.thirdBind && req.session.thirdBind.mobile === mobile) {
|
|
|
BindService.bindMobileAsync(openId, sourceType, mobile, area, password).then(result => {
|
|
|
if (result && result.code) {
|
|
|
if (result.code === 200 && result.data && result.data.uid) {
|
|
|
let refer = helpers.urlFormat('/passport/thirdlogin/bindsuccess', {
|
|
|
sourceType: sourceType + '_bind'
|
|
|
});
|
|
|
|
|
|
return LoginService.syncUserSession(result.data.uid, req, res).then(() => {
|
|
|
return { code: 200, message: result.message, data: { refer: refer } };
|
|
|
});
|
|
|
} else {
|
|
|
return { code: result.code, message: result.message, data: { refer: '' } };
|
|
|
}
|
|
|
} else {
|
|
|
return { code: result.code, message: result.message, data: { refer: '' } };
|
|
|
return { code: 400, message: '', data: '' };
|
|
|
}
|
|
|
} else {
|
|
|
return { code: 400, message: '', data: '' };
|
|
|
}
|
|
|
}).then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
}).then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
} else {
|
|
|
res.json({ code: 400, message: '', data: '' });
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
|