...
|
...
|
@@ -9,6 +9,7 @@ |
|
|
|
|
|
const helpers = require(global.library + '/helpers');
|
|
|
const RegService = require('../models/reg-service');
|
|
|
const BindService = require('../models/bind-service');
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const Sources = {
|
...
|
...
|
@@ -32,7 +33,7 @@ const bind = { |
|
|
let sourceType = req.query.sourceType;
|
|
|
|
|
|
res.render('bind/index', {
|
|
|
bindIndex: true, //js标识
|
|
|
bindIndex: true, // js标识
|
|
|
backUrl: helpers.urlFormat('/signin.html'), // 返回的URL链接
|
|
|
showHeaderImg: true, // 控制显示头部图片
|
|
|
isPassportPage: true, // 模板中模块标识
|
...
|
...
|
@@ -40,9 +41,9 @@ const bind = { |
|
|
platform: Sources[sourceType],
|
|
|
isWechatLogin: sourceType === 'wechat',
|
|
|
openId: openId, // openId
|
|
|
areaCode: '+86', //默认区号
|
|
|
countrys: RegService.getAreaData(), //国别码
|
|
|
serviceUrl: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=', //在线客服
|
|
|
areaCode: '+86', // 默认区号
|
|
|
countrys: RegService.getAreaData(), // 国别码
|
|
|
serviceUrl: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=', // 在线客服
|
|
|
module: 'passport',
|
|
|
page: 'bind',
|
|
|
title: '绑定手机号'
|
...
|
...
|
@@ -79,8 +80,37 @@ const bind = { |
|
|
let areaCode = req.body.areaCode || '86';
|
|
|
let sourceType = req.body.sourceType;
|
|
|
|
|
|
if (!(_.isNumber(parseInt(phoneNum, 0)) && openId && areaCode && sourceType)) {
|
|
|
|
|
|
if (_.isNumber(parseInt(phoneNum, 0)) && openId && areaCode && sourceType) {
|
|
|
BindService.bindCheck(phoneNum, openId, sourceType, areaCode).then(result => {
|
|
|
let data = {
|
|
|
code: result.code,
|
|
|
message: result.message,
|
|
|
data: {}
|
|
|
};
|
|
|
|
|
|
if (result.code === 200) {
|
|
|
let nextUrl = helpers.urlFormat('/passport/bind/code', {
|
|
|
isReg: res.data.is_register, // esline-disable-line
|
|
|
openId: openId,
|
|
|
sourceType: sourceType,
|
|
|
areaCode: areaCode,
|
|
|
phoneNum: phoneNum
|
|
|
});
|
|
|
|
|
|
data.data.isReg = res.data.is_register;
|
|
|
data.data.next = nextUrl;
|
|
|
} else {
|
|
|
data.data = result.data;
|
|
|
}
|
|
|
|
|
|
res.json(data);
|
|
|
});
|
|
|
} else {
|
|
|
res.json({
|
|
|
code: 400,
|
|
|
message: '',
|
|
|
data: ''
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|