...
|
...
|
@@ -3,6 +3,8 @@ |
|
|
use Action\WebAction;
|
|
|
use LibModels\Web\Passport\RegData;
|
|
|
use LibModels\Wap\Passport\BindData;
|
|
|
use LibModels\Web\Home\UserData;
|
|
|
use WebPlugin\Images;
|
|
|
use Passport\PassportModel as PassportModel;
|
|
|
use WebPlugin\Helpers;
|
|
|
|
...
|
...
|
@@ -10,7 +12,7 @@ class AutouserinfoController extends WebAction |
|
|
{
|
|
|
|
|
|
/**
|
|
|
* 第三方登录完善个人信息:
|
|
|
* 第三方登录完善个人信息(旧)
|
|
|
* 绑定手机号
|
|
|
*/
|
|
|
public function indexAction()
|
...
|
...
|
@@ -29,16 +31,6 @@ class AutouserinfoController extends WebAction |
|
|
$refer = rawurldecode($refer);
|
|
|
}
|
|
|
|
|
|
//获取用户
|
|
|
$uid = $this->getUid(true);
|
|
|
if (!$uid) {
|
|
|
$isLogin = false;
|
|
|
$username = '';
|
|
|
}
|
|
|
else {
|
|
|
$isLogin = true;
|
|
|
$username = $this->_uname;
|
|
|
}
|
|
|
$simpleHeader = PassportModel::getSimpleHeader();
|
|
|
$cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE);
|
|
|
|
...
|
...
|
@@ -66,12 +58,10 @@ class AutouserinfoController extends WebAction |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 完善信息页面
|
|
|
* 完善信息页面(中间跳转页-旧)
|
|
|
*/
|
|
|
public function userInfoAction()
|
|
|
{
|
|
|
//获取用户
|
|
|
$uid = $this->getUid(false);
|
|
|
$nickname = $this->get('nickname');
|
|
|
$openId = $this->get('openId');
|
|
|
$sourceType = $this->get('sourceType');
|
...
|
...
|
@@ -94,6 +84,8 @@ class AutouserinfoController extends WebAction |
|
|
|
|
|
/**
|
|
|
* 绑定前手机号校验
|
|
|
* 若已注册,则查询用户头像,昵称信息
|
|
|
*
|
|
|
*/
|
|
|
public function bindCheckAction()
|
|
|
{
|
...
|
...
|
@@ -105,22 +97,34 @@ class AutouserinfoController extends WebAction |
|
|
break;
|
|
|
}
|
|
|
|
|
|
$phoneNum = trim($this->post('mobile'));
|
|
|
$mobile = trim($this->post('mobile'));
|
|
|
$openId = trim($this->post('openId'));
|
|
|
$areaCode = trim($this->post('area', '86'));
|
|
|
$area = trim($this->post('area', '86'));
|
|
|
$sourceType = trim($this->post('sourceType'));
|
|
|
|
|
|
|
|
|
if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType) {
|
|
|
if (!is_numeric($mobile) || !$openId || !$area || !$sourceType) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$res = BindData::bindCheck($phoneNum, $openId, $sourceType, $areaCode);
|
|
|
$res = BindData::bindCheck($mobile, $openId, $sourceType, $area);
|
|
|
if (!isset($res['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
//未注册 未绑定
|
|
|
if ($res['code'] == 200) {
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register']));
|
|
|
$next = Helpers::url('/thirdlogin/index', array(
|
|
|
'openId' => $openId,
|
|
|
'sourceType' => $sourceType,
|
|
|
'area' => $area,
|
|
|
'mobile' => $mobile,
|
|
|
));
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('next' => $next));
|
|
|
}
|
|
|
//506 - 已注册 未绑定 / 505 - 已注册 已绑定
|
|
|
elseif ($res['code'] == 506 || $res['code'] == 505) {
|
|
|
$user = self::getUserInfo($area, $mobile);
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('user' => $user));
|
|
|
}
|
|
|
else {
|
|
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : '');
|
...
|
...
|
@@ -131,6 +135,20 @@ class AutouserinfoController extends WebAction |
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
public static function getUserInfo($area, $mobile)
|
|
|
{
|
|
|
$userInfo = UserData::getUserInfoByMobile($area, $mobile);
|
|
|
$user = array('username' => '', 'headImg' => '');
|
|
|
$userTmp = current($userInfo['data']);
|
|
|
if ($userTmp) {
|
|
|
$user = array(
|
|
|
'username' => $userTmp['profile_name'],
|
|
|
'headImg' => (!empty($userTmp['head_ico'])) ? Images::getImageUrl($userTmp['head_ico'], 100, 100, 2, 'headimg') : '',
|
|
|
);
|
|
|
}
|
|
|
return $user;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送验证码
|
|
|
*/
|
...
|
...
|
@@ -146,8 +164,6 @@ class AutouserinfoController extends WebAction |
|
|
|
|
|
$phoneNum = trim($this->post('mobile'));
|
|
|
$areaCode = trim($this->post('area'));
|
|
|
$verifyCode = trim($this->post('verifyCode'));
|
|
|
|
|
|
//校验手机号格式
|
|
|
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
|
|
|
$data['code'] = 400;
|
...
|
...
|
@@ -155,13 +171,6 @@ class AutouserinfoController extends WebAction |
|
|
break;
|
|
|
}
|
|
|
|
|
|
//检测验证码不正确
|
|
|
if (!PassportModel::verifyCode($verifyCode)) {
|
|
|
$data['code'] = 400;
|
|
|
$data['message'] = '图形验证码不正确';
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::sendBindMsg($areaCode, $phoneNum);
|
|
|
if (!isset($data['code'])) {
|
|
|
break;
|
...
|
...
|
@@ -172,32 +181,6 @@ class AutouserinfoController extends WebAction |
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 校验图形验证码
|
|
|
*/
|
|
|
public function checkPicCodeAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
$verifyCode = 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);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 校验短信验证码
|
|
|
*/
|
...
|
...
|
@@ -249,8 +232,6 @@ class AutouserinfoController extends WebAction |
|
|
$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;
|
|
|
|
...
|
...
|
@@ -260,13 +241,6 @@ class AutouserinfoController extends WebAction |
|
|
$data['message'] = '手机号码格式不正确';
|
|
|
break;
|
|
|
}
|
|
|
//校验图形验证码
|
|
|
$picFlag = PassportModel::verifyCode($verifyCode);
|
|
|
if (!$picFlag) {
|
|
|
$data['code'] = 400;
|
|
|
$data['message'] = '图形验证码不正确';
|
|
|
break;
|
|
|
}
|
|
|
//校验手机验证码
|
|
|
$bindMsgFlag = BindData::checkBindCode($areaCode, $phoneNum, $code);
|
|
|
if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) {
|
...
|
...
|
|