...
|
...
|
@@ -2,12 +2,9 @@ |
|
|
|
|
|
use Action\AbstractAction;
|
|
|
use LibModels\Web\Passport\RegData;
|
|
|
use LibModels\Web\Passport\LoginData;
|
|
|
use LibModels\Web\Home\IndexData;
|
|
|
use LibModels\Wap\Passport\BindData;
|
|
|
use Passport\PassportModel as PassportModel;
|
|
|
use Plugin\Helpers;
|
|
|
use Plugin\Images;
|
|
|
use Plugin\Partner\Factory;
|
|
|
|
|
|
class AutouserinfoController extends AbstractAction
|
|
|
{
|
...
|
...
|
@@ -19,9 +16,9 @@ class AutouserinfoController extends AbstractAction |
|
|
public function indexAction()
|
|
|
{
|
|
|
$this->setTitle('联合登录补全信息');
|
|
|
$nickname = $this->get('nickname');
|
|
|
$openId = $this->get('openId');
|
|
|
$sourceType = $this->get('sourceType');
|
|
|
// $nickname = $this->get('nickname');
|
|
|
$openId = trim($this->get('openId'));
|
|
|
$sourceType = trim($this->get('sourceType'));
|
|
|
|
|
|
//登录后跳转页面
|
|
|
$refer = $this->getCookie('refer');
|
...
|
...
|
@@ -43,15 +40,26 @@ class AutouserinfoController extends AbstractAction |
|
|
$username = $this->_uname;
|
|
|
}
|
|
|
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
|
|
|
$cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE);
|
|
|
|
|
|
//整合
|
|
|
$data = array(
|
|
|
'loginPage' => true,
|
|
|
'registerPage' => true,
|
|
|
'simpleHeader' => $simpleHeader,
|
|
|
'passport' => array(
|
|
|
'coverHref' => '',
|
|
|
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
|
|
|
),
|
|
|
'actionUrl' => Helpers::url('/autouserinfo/bind'),
|
|
|
'region' => RegData::getAreasData(),
|
|
|
'location' => '+86',
|
|
|
'captchaUrl' => Helpers::url('/passport/images?t=' . time()),
|
|
|
'itemUrl' => Helpers::url('/help/?category_id=9'),
|
|
|
'referUrl' => $refer,
|
|
|
'skipUrl' => SITE_MAIN,
|
|
|
'coverHref' => $cover['url'],
|
|
|
'coverImg' => !empty($cover['img']) ? $cover['img'] : 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
|
|
|
'regBtnText' => '完善信息',
|
|
|
'openId' => $openId,
|
|
|
'sourceType' => $sourceType
|
|
|
)
|
|
|
);
|
|
|
|
|
|
$this->_view->display('index', $data);
|
...
|
...
|
@@ -77,12 +85,13 @@ class AutouserinfoController extends AbstractAction |
|
|
$username = $this->_uname;
|
|
|
}
|
|
|
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
|
|
|
$cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE);
|
|
|
//整合
|
|
|
$data = array(
|
|
|
'simpleHeader' => $simpleHeader,
|
|
|
'passport' => array(
|
|
|
'coverHref' => '',
|
|
|
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
|
|
|
'coverHref' => $cover['url'],
|
|
|
'coverImg' => !empty($cover['img']) ? $cover['img'] : 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
|
|
|
'goShoppingUrl' => SITE_MAIN,
|
|
|
'completeInfoUrl' => Helpers::url('/passport/autouserinfo/index', array('openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname)),
|
|
|
),
|
...
|
...
|
@@ -91,19 +100,197 @@ class AutouserinfoController extends AbstractAction |
|
|
$this->_view->display('userinfo', $data);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 发送绑定验证吗
|
|
|
/**
|
|
|
* 绑定前手机号校验
|
|
|
*/
|
|
|
|
|
|
/*
|
|
|
* 验证图形验证码
|
|
|
public function bindCheckAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$phoneNum = trim($this->post('phoneNum'));
|
|
|
$openId = trim($this->post('openId'));
|
|
|
$areaCode = trim($this->post('areaCode', '86'));
|
|
|
$sourceType = trim($this->post('sourceType'));
|
|
|
|
|
|
|
|
|
if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$res = BindData::bindCheck($phoneNum, $openId, $sourceType, $areaCode);
|
|
|
if (!isset($res['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
if ($res['code'] == 200) {
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register']));
|
|
|
}
|
|
|
else {
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : '');
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送验证码
|
|
|
*/
|
|
|
public function sendBindMsgAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$phoneNum = trim($this->post('phoneNum'));
|
|
|
$areaCode = trim($this->post('areaCode'));
|
|
|
$verifyCode = trim($this->post('verifyCode'));
|
|
|
|
|
|
//校验手机号格式
|
|
|
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
|
|
|
$data['code'] = 401;
|
|
|
$data['message'] = '手机号码格式不正确';
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
//检测验证码不正确
|
|
|
if (!PassportModel::verifyCode($verifyCode)) {
|
|
|
$data['code'] = 402;
|
|
|
$data['message'] = '图形验证码不正确';
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::sendBindMsg($areaCode, $phoneNum);
|
|
|
if (!isset($data['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 验证短信验证码
|
|
|
* 校验图形验证码
|
|
|
*/
|
|
|
|
|
|
/*
|
|
|
public function checkPicCodeAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
$verifyCode = $phoneNum = trim($this->post('verifyCode'));
|
|
|
$picFlag = PassportModel::verifyCode($verifyCode);
|
|
|
if ($picFlag) {
|
|
|
$data = array('code' => 200, 'message' => '验证码正确', 'data' => '');
|
|
|
}
|
|
|
else {
|
|
|
$data = array('code' => 400, 'message' => '验证码错误', 'data' => '');
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 校验短信验证码
|
|
|
*/
|
|
|
public function checkBindMsgAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$phoneNum = trim($this->post('phoneNum'));
|
|
|
$areaCode = trim($this->post('areaCode'));
|
|
|
$code = trim($this->post('code')); //短信验证码
|
|
|
//校验手机号格式
|
|
|
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
|
|
|
$data['code'] = 401;
|
|
|
$data['message'] = '手机号码格式不正确';
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::checkBindCode($areaCode, $phoneNum, $code);
|
|
|
if (!isset($data['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 绑定手机号
|
|
|
*/
|
|
|
public function bindMobileAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$phoneNum = trim($this->post('phoneNum'));
|
|
|
$areaCode = trim($this->post('areaCode', '86'));
|
|
|
$openId = trim($this->post('openId'));
|
|
|
$sourceType = trim($this->post('sourceType'));
|
|
|
$code = trim($this->post('code')); //短信验证码
|
|
|
$verifyCode = trim($this->post('verifyCode')); //图形验证码
|
|
|
// $nickname = trim($this->post('nickname'));//nickname不同步信息
|
|
|
$password = trim($this->post('password'));
|
|
|
$password = empty($password) ? '' : $password;
|
|
|
|
|
|
//校验手机号格式
|
|
|
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
|
|
|
$data['code'] = 401;
|
|
|
$data['message'] = '手机号码格式不正确';
|
|
|
break;
|
|
|
}
|
|
|
$picFlag = PassportModel::verifyCode($verifyCode);
|
|
|
if (!$picFlag) {
|
|
|
$data['code'] = 402;
|
|
|
$data['message'] = '图形验证码不正确';
|
|
|
break;
|
|
|
}
|
|
|
$bindMsgFlag = BindData::checkBindCode($areaCode, $phoneNum, $code);
|
|
|
if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) {
|
|
|
$data['code'] = 403;
|
|
|
$data['message'] = '短信验证码不正确';
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$res = BindData::bindMobile($openId, $sourceType, $phoneNum, $areaCode, $password);
|
|
|
if (!isset($res['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message']);
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|