...
|
...
|
@@ -17,26 +17,25 @@ class BindController extends AbstractAction |
|
|
public function indexAction()
|
|
|
{
|
|
|
$refer = $this->get('refer');
|
|
|
if (!empty($refer))
|
|
|
{
|
|
|
if (!empty($refer)) {
|
|
|
$this->setCookie('refer', $refer);
|
|
|
}
|
|
|
|
|
|
$this->setTitle('绑定手机号');
|
|
|
|
|
|
|
|
|
$openId = $this->get('openId');
|
|
|
$sourceType = $this->get('sourceType');
|
|
|
$nickname = $this->get('nickname');
|
|
|
$data = array(
|
|
|
'bindIndex'=>true,//js标识
|
|
|
'backUrl' => '/', // 返回的URL链接
|
|
|
'bindIndex' => true, //js标识
|
|
|
'backUrl' => Helpers::url('/signin.html'), // 返回的URL链接
|
|
|
'showHeaderImg' => true, // 控制显示头部图片
|
|
|
'isPassportPage' => true, // 模板中模块标识
|
|
|
'sourceType' => $sourceType, // 第三方登录来源
|
|
|
'platform'=>$sourceType,
|
|
|
'platform' => $sourceType,
|
|
|
'openId' => $openId, // openId
|
|
|
'areaCode'=>'+86',//默认区号
|
|
|
'countrys'=>RegData::getAreasData(),//国别码
|
|
|
'areaCode' => '+86', //默认区号
|
|
|
'countrys' => RegData::getAreasData(), //国别码
|
|
|
'nickname' => $nickname, //昵称
|
|
|
);
|
|
|
|
...
|
...
|
@@ -49,26 +48,25 @@ class BindController extends AbstractAction |
|
|
*/
|
|
|
public function codeAction()
|
|
|
{
|
|
|
|
|
|
$this->setTitle('验证手机');
|
|
|
$openId = $this->get('openId');
|
|
|
$sourceType = $this->get('sourceType');
|
|
|
$nickname = $this->get('nickname');
|
|
|
$areaCode = $this->get('areaCode', '86');
|
|
|
$isReg = $this->get('isReg');
|
|
|
$phoneNum=$this->get('phoneNum');
|
|
|
|
|
|
$phoneNum = $this->get('phoneNum');
|
|
|
|
|
|
$data = array(
|
|
|
'bindCode'=>true,//js标识
|
|
|
'backUrl' => '/', // 返回的URL链接
|
|
|
'bindCode' => true, //js标识
|
|
|
'backUrl' => Helpers::url('/signin.html'), // 返回的URL链接
|
|
|
'showHeaderImg' => true, // 控制显示头部图片
|
|
|
'isPassportPage' => true, // 模板中模块标识
|
|
|
'sourceType' => $sourceType, // 第三方登录来源
|
|
|
'openId' => $openId, // openId
|
|
|
'nickname' => $nickname, //昵称
|
|
|
'isReg' => $isReg, //是否是已注册过的手机号
|
|
|
'areaCode' => $areaCode, //国别码
|
|
|
'phoneNum'=>$phoneNum,//手机号码
|
|
|
'areaCode' => $areaCode, //国别码
|
|
|
'phoneNum' => $phoneNum, //手机号码
|
|
|
);
|
|
|
|
|
|
// 渲染模板
|
...
|
...
|
@@ -80,22 +78,21 @@ class BindController extends AbstractAction |
|
|
*/
|
|
|
public function passwordAction()
|
|
|
{
|
|
|
|
|
|
$this->setTitle('重新设置登录密码');
|
|
|
$openId = $this->get('openId');
|
|
|
$sourceType = $this->get('sourceType');
|
|
|
$nickname = $this->get('nickname');
|
|
|
$areaCode = $this->get('areaCode', '86');
|
|
|
$phoneNum=$this->get('phoneNum');
|
|
|
$phoneNum = $this->get('phoneNum');
|
|
|
$data = array(
|
|
|
'bindPwd'=>true,//js标识
|
|
|
'backUrl' => '/', // 返回的URL链接
|
|
|
'bindPwd' => true, //js标识
|
|
|
'backUrl' => Helpers::url('/signin.html'), // 返回的URL链接
|
|
|
'showHeaderImg' => true, // 控制显示头部图片
|
|
|
'isPassportPage' => true, // 模板中模块标识
|
|
|
'sourceType' => $sourceType, // 第三方登录来源
|
|
|
'openId' => $openId, // openId
|
|
|
'nickname' => $nickname, //昵称
|
|
|
'areaCode' => $areaCode, //国别码
|
|
|
'areaCode' => $areaCode, //国别码
|
|
|
'phoneNum' => $phoneNum //国别码
|
|
|
);
|
|
|
|
...
|
...
|
@@ -108,11 +105,9 @@ class BindController extends AbstractAction |
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do
|
|
|
{
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -123,27 +118,21 @@ class BindController extends AbstractAction |
|
|
$nickname = $this->post('nickname');
|
|
|
|
|
|
|
|
|
if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType)
|
|
|
{
|
|
|
if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$res = BindData::bindCheck($phoneNum, $openId, $sourceType);
|
|
|
if (!isset($res['code']))
|
|
|
{
|
|
|
if (!isset($res['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
if ($res['code'] == 200)
|
|
|
{
|
|
|
if ($res['code'] == 200) {
|
|
|
$next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'phoneNum' => $phoneNum));
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next));
|
|
|
} else {
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : '');
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data'])?$res['data']:'');
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
@@ -153,29 +142,24 @@ class BindController extends AbstractAction |
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do
|
|
|
{
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$phoneNum = $this->post('phoneNum');
|
|
|
$areaCode = $this->post('areaCode');
|
|
|
|
|
|
if (!is_numeric($phoneNum))
|
|
|
{
|
|
|
if (!is_numeric($phoneNum)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::sendBindMsg($areaCode,$phoneNum);
|
|
|
if (!isset($data['code']))
|
|
|
{
|
|
|
$data = BindData::sendBindMsg($areaCode, $phoneNum);
|
|
|
if (!isset($data['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
@@ -185,11 +169,9 @@ class BindController extends AbstractAction |
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do
|
|
|
{
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -197,18 +179,15 @@ class BindController extends AbstractAction |
|
|
$code = $this->post('code');
|
|
|
$areaCode = $this->post('areaCode');
|
|
|
|
|
|
if (!is_numeric($phoneNum) || !$code)
|
|
|
{
|
|
|
if (!is_numeric($phoneNum) || !$code) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::checkBindCode($areaCode,$phoneNum, $code);
|
|
|
if (!isset($data['code']))
|
|
|
{
|
|
|
$data = BindData::checkBindCode($areaCode, $phoneNum, $code);
|
|
|
if (!isset($data['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
@@ -218,11 +197,9 @@ class BindController extends AbstractAction |
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do
|
|
|
{
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -233,42 +210,33 @@ class BindController extends AbstractAction |
|
|
$nickname = $this->post('nickname');
|
|
|
$password = $this->post('password');
|
|
|
|
|
|
if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode)
|
|
|
{
|
|
|
if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password);
|
|
|
if (!isset($res['code']))
|
|
|
{
|
|
|
if (!isset($res['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
//绑定成功,跳转页面
|
|
|
$refer = $this->getCookie('refer');
|
|
|
if (empty($refer))
|
|
|
{
|
|
|
if (empty($refer)) {
|
|
|
$refer = SITE_MAIN . '/?go=1';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
} else {
|
|
|
$refer = rawurldecode($refer);
|
|
|
}
|
|
|
|
|
|
if (isset($res['code']) && $res['code'] == 200 && !empty($res['data']['uid']))
|
|
|
{
|
|
|
|
|
|
if (isset($res['code']) && $res['code'] == 200 && !empty($res['data']['uid'])) {
|
|
|
$token = Helpers::makeToken($res['data']['uid']);
|
|
|
$this->setCookie('_TOKEN', $token);
|
|
|
$this->setSession('_TOKEN', $token);
|
|
|
$refer = Helpers::syncUserSession($res['data']['uid'], $refer);
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
} else {
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer));
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
|