Authored by zhoushuo

SSO 新增方法 auth 获取没有缓存

... ... @@ -263,7 +263,8 @@ class Facade_Auth
}
//TODO 判断是否存在当前账号是否已经存在
$exist_auth = self::getAuthByTypeAndAid($auth_type, $auth_id);
//$exist_auth = self::getAuthByTypeAndAid($auth_type, $auth_id);
$exist_auth = self::getAuthByTypeAndAidNocache($auth_type, $auth_id);
if(!empty($exist_auth))
{
$ret = array('code' => Config_Code::$error['account_exist']['code'], 'message' => Config_Code::$error['account_exist']['message']);
... ... @@ -365,7 +366,35 @@ class Facade_Auth
return $result;
}
/**
* 获取登录账号的信息 没缓存
*
* @param type $type 登录类型
* @param type $auth_id 登录账号
* @return array
*/
public static function getAuthByTypeAndAidNocache($type, $auth_id)
{
$result = array();
if (isset($auth_id) && is_numeric($type))
{
$result = self::service()->getAuthByTypeAndAidNocache($type, $auth_id);
if(!$result)
{
if($type==self::AUTH_TYPE_FACEBOOK)
{
$auth_id = self::service()->getFacebookRela($auth_id);
$result = self::service()->getAuthByTypeAndAidNocache($type, $auth_id);
}
}
}
return $result;
}
/**
* 获取所有口令列表
*/
... ...
... ... @@ -91,6 +91,19 @@ class Service_Auth extends Lib_Service
}
/**
* 根据账号名称获取用户账号信息 没缓存
* @param unknown $type
* @param unknown $auth_id
*/
public function getAuthByTypeAndAidNocache($type, $auth_id)
{
$tag = self::$_tag_auth . strval($type);
$key = sprintf(self::$_key_auth . '%s_%s', $type, $auth_id);
$param = array('type' => $type, 'auth_id' => $auth_id);
return self::service(self::ROUTER)->cache(false)->fetchRow('getAuthByTypeAndAid', $param);
}
/**
* 绑定登录账号
* @param unknown $uid
* @param unknown $type
... ...