...
|
...
|
@@ -9,6 +9,7 @@ use Configs\ChannelConfig; |
|
|
use WebPlugin\Images;
|
|
|
use WebPlugin\Captcha;
|
|
|
use WebPlugin\Cache;
|
|
|
use WebPlugin\Helpers;
|
|
|
|
|
|
/**
|
|
|
* web登录注册等相关数据构建
|
...
|
...
|
@@ -28,7 +29,6 @@ class PassportModel |
|
|
const AUTOUSERINFO_LEFT_BANNER_CODE = 'c62d5da06d843b6ed78d8d27e87fa143'; //完善信息页左边的banner
|
|
|
const BACK_FIND_SECRET_KEY = '_+@#$%^';
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取左侧banner
|
|
|
*
|
...
|
...
|
@@ -98,13 +98,13 @@ class PassportModel |
|
|
*/
|
|
|
public static function getUserInfoByMobile($area, $mobile)
|
|
|
{
|
|
|
$key = WebCacheConfig::KEY_PASSPORT_USER_DATA.'_'.$area.'_'.$mobile;
|
|
|
$key = WebCacheConfig::KEY_PASSPORT_USER_DATA . '_' . $area . '_' . $mobile;
|
|
|
$ret = Cache::get($key);
|
|
|
if(empty($ret)) {
|
|
|
if (empty($ret)) {
|
|
|
$data = UserData::getUserInfoByMobile($area, $mobile);
|
|
|
if ($data['code'] == 200) {
|
|
|
if (!empty($data['data'])) {
|
|
|
$ret = current($data['data']);
|
|
|
$ret = $data['data'];
|
|
|
Cache::set($key, $ret, 600);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -120,13 +120,13 @@ class PassportModel |
|
|
*/
|
|
|
public static function getUserInfoByEmail($email)
|
|
|
{
|
|
|
$key = WebCacheConfig::KEY_PASSPORT_USER_DATA.'_'.$email;
|
|
|
$key = WebCacheConfig::KEY_PASSPORT_USER_DATA . '_' . $email;
|
|
|
$ret = Cache::get($key);
|
|
|
if(empty($ret)) {
|
|
|
if (empty($ret)) {
|
|
|
$data = UserData::getUserInfoByEmail($email);
|
|
|
if ($data['code'] == 200) {
|
|
|
if (!empty($data['data'])) {
|
|
|
$ret = current($data['data']);
|
|
|
$ret = $data['data'];
|
|
|
Cache::set($key, $ret, 600);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -141,15 +141,15 @@ class PassportModel |
|
|
public static function emailBindCheck($email)
|
|
|
{
|
|
|
$ret = false;
|
|
|
$key = WebCacheConfig::KEY_PASSPORT_USER_DATA.'_bind_'.$email;
|
|
|
$key = WebCacheConfig::KEY_PASSPORT_USER_DATA . '_bind_' . $email;
|
|
|
$userInfo = Cache::get($key);
|
|
|
if(empty($userInfo)) {
|
|
|
if (empty($userInfo)) {
|
|
|
$userInfo = UserData::getUserInfoByEmail($email);
|
|
|
if($userInfo['code'] == 200 && !empty($userInfo['data'])) {
|
|
|
if ($userInfo['code'] == 200 && !empty($userInfo['data'])) {
|
|
|
Cache::set($key, $userInfo, 600);
|
|
|
}
|
|
|
}
|
|
|
$user = isset($userInfo['data']) ? current($userInfo['data']) : '';
|
|
|
$user = isset($userInfo['data']) ? $userInfo['data'] : '';
|
|
|
if (isset($user['mobile']) && !$user['mobile']) {
|
|
|
$ret = true;
|
|
|
}
|
...
|
...
|
@@ -161,15 +161,44 @@ class PassportModel |
|
|
*/
|
|
|
public static function redirectHome($url)
|
|
|
{
|
|
|
$ret=false;
|
|
|
$ret = false;
|
|
|
$keyArr = ChannelConfig::$loginUrlKeys;
|
|
|
foreach ($keyArr as $key) {
|
|
|
if(strstr($url, $key)){
|
|
|
$ret=true;
|
|
|
if (strstr($url, $key)) {
|
|
|
$ret = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 第三方登录 根据手机号获取用户相关信息
|
|
|
*/
|
|
|
public static function getUserInfo($area, $mobile)
|
|
|
{
|
|
|
$userInfo = UserData::getUserInfoByMobile($area, $mobile);
|
|
|
$user = array('username' => '', 'headImg' => '', 'bindLogin' => '');
|
|
|
$userTmp = array();
|
|
|
if (isset($userInfo['data'])) {
|
|
|
$userTmp = $userInfo['data'];
|
|
|
}
|
|
|
if ($userTmp) {
|
|
|
//*号临时处理
|
|
|
$profileName = isset($userTmp['profile_name']) ? trim($userTmp['profile_name']) : '';
|
|
|
if (!$profileName) {
|
|
|
$profileName = $mobile;
|
|
|
}
|
|
|
if ((strlen($profileName) == 11 && !strpos('*', $profileName)) || (strpos($profileName, "-") && !strpos('*', $profileName))) {
|
|
|
$profileName = substr_replace($profileName, '****', 3, 4);
|
|
|
}
|
|
|
$user = array(
|
|
|
'username' => $profileName,
|
|
|
'headImg' => (isset($userTmp['head_ico']) && !empty($userTmp['head_ico'])) ? Images::getImageUrl($userTmp['head_ico'], 100, 100, 2, 'yhb-head') : ChannelConfig::$headDefaultImgIco,
|
|
|
'bindLogin' => Helpers::url('/signin.html', array('bindMobile' => $mobile, 'bindArea' => $area)),
|
|
|
);
|
|
|
}
|
|
|
return $user;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|