本文整理汇总了PHP中api_Utils::GetGoogleUserInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP api_Utils::GetGoogleUserInfo方法的具体用法?PHP api_Utils::GetGoogleUserInfo怎么用?PHP api_Utils::GetGoogleUserInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_Utils
的用法示例。
在下文中一共展示了api_Utils::GetGoogleUserInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AjaxSocialCreate
/**
* @return array
*/
public function AjaxSocialCreate()
{
$oAccount = $this->GetDefaultAccount();
$mResult = false;
if ($oAccount) {
$sType = trim($this->getParamValue('Type', ''));
$sAccessToken = trim($this->getParamValue('AccessToken', ''));
if ('' !== $sType && !empty($sAccessToken)) {
$oTenant = null;
if ($this->oApiTenants) {
$oTenant = 0 < $oAccount->IdTenant ? $this->oApiTenants->GetTenantById($oAccount->IdTenant) : $this->oApiTenants->GetDefaultGlobalTenant();
}
$oUserInfo = null;
if ('google' === $sType && $oTenant) {
$oSocial = $oTenant->GetSocialByName('google');
if ($oSocial) {
$oUserInfo = \api_Utils::GetGoogleUserInfo($oSocial->SocialApiKey, $sAccessToken);
}
}
if ($oUserInfo) {
$oApiSocial = \CApi::Manager('social');
$oSocial = new \CSocial();
$oSocial->IdAccount = $oAccount->IdAccount;
$oSocial->TypeStr = $sType;
$oSocial->IdSocial = $oUserInfo->id;
$oSocial->Name = $oUserInfo->name;
$mResult = $oApiSocial->CreateSocial($oSocial);
}
}
}
return $this->DefaultResponse(null, __FUNCTION__, $mResult);
}
示例2: AjaxSocialCreate
/**
* @return array
*/
public function AjaxSocialCreate()
{
$oAccount = $this->GetDefaultAccount();
$mResult = false;
if ($oAccount)
{
$iType = (int) trim($this->getParamValue('Type', \ESocialType::Unknown));
$sAccessToken = trim($this->getParamValue('AccessToken', ''));
if (\ESocialType::Unknown !== $iType && !empty($sAccessToken))
{
$oTenant = null;
if ($this->oApiTenants)
{
$oTenant = (0 < $oAccount->IdTenant) ? $this->oApiTenants->GetTenantById($oAccount->IdTenant) :
$this->oApiTenants->GetDefaultGlobalTenant();
}
$oUserInfo = null;
if (\ESocialType::Google === $iType && $oTenant)
{
$oUserInfo = \api_Utils::GetGoogleUserInfo($oTenant->SocialGoogleApiKey, $sAccessToken);
}
if ($oUserInfo)
{
$oApiSocial = /* @var $oApiSocial \CApiSocialManager */ \CApi::Manager('social');
$oSocial = new \CSocial();
$oSocial->IdAccount = $oAccount->IdAccount;
$oSocial->Type = $iType;
$oSocial->IdSocial = $oUserInfo->id;
$oSocial->Name = $oUserInfo->name;
$mResult = $oApiSocial->CreateSocial($oSocial);
}
}
}
return $this->DefaultResponse(null, __FUNCTION__, $mResult);
}