...
|
...
|
@@ -17,7 +17,8 @@ class BindController extends AbstractAction |
|
|
public function indexAction()
|
|
|
{
|
|
|
$refer = $this->get('refer');
|
|
|
if (!empty($refer)) {
|
|
|
if (!empty($refer))
|
|
|
{
|
|
|
$this->setCookie('refer', $refer);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -105,9 +106,11 @@ class BindController extends AbstractAction |
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
do
|
|
|
{
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -118,21 +121,27 @@ 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 {
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : '');
|
|
|
}
|
|
|
} while (false);
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
@@ -142,24 +151,29 @@ 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) || !$areaCode)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::sendBindMsg($areaCode, $phoneNum);
|
|
|
if (!isset($data['code'])) {
|
|
|
if (!isset($data['code']))
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
} while (false);
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
@@ -169,9 +183,11 @@ class BindController extends AbstractAction |
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
do
|
|
|
{
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -179,15 +195,18 @@ class BindController extends AbstractAction |
|
|
$code = $this->post('code');
|
|
|
$areaCode = $this->post('areaCode');
|
|
|
|
|
|
if (!is_numeric($phoneNum) || !$code) {
|
|
|
if (!is_numeric($phoneNum) || !$code || !$areaCode)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::checkBindCode($areaCode, $phoneNum, $code);
|
|
|
if (!isset($data['code'])) {
|
|
|
if (!isset($data['code']))
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
} while (false);
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
@@ -197,9 +216,11 @@ class BindController extends AbstractAction |
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
do
|
|
|
{
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -210,33 +231,107 @@ 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);
|
|
|
}
|
|
|
|
|
|
//换绑check
|
|
|
public function changeCheckAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do
|
|
|
{
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$phoneNum = $this->post('phoneNum');
|
|
|
$areaCode = $this->post('areaCode');
|
|
|
|
|
|
if (!is_numeric($phoneNum) || !$areaCode)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::changeCheck($phoneNum, $areaCode);
|
|
|
if (!isset($data['code']))
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
//换绑mobile
|
|
|
public function changeMobileAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do
|
|
|
{
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
$uid = $this->getUid(true);
|
|
|
$phoneNum = $this->post('phoneNum');
|
|
|
$areaCode = $this->post('areaCode');
|
|
|
$code = $this->post('code');
|
|
|
|
|
|
if (!is_numeric($phoneNum) || !$areaCode || !$code || !$uid)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::changeMobile($uid, $phoneNum, $areaCode, $code);
|
|
|
if (!isset($data['code']))
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
|