芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/cloud.pulsehost.co.uk/modules/OAuthIntegratorWebclient/Manager.php
where('Type', $sType); if (!empty($sEmail)) { $oQuery = $oQuery->where('Email', $sEmail); } try { $mResult = $oQuery->first(); } catch (\Aurora\System\Exceptions\BaseException $oException) { $mResult = false; $this->setLastException($oException); } return $mResult; } /** * @param string $sIdSocial * @param string $sType * * @return OauthAccount|bool */ public function getAccountById($sIdSocial, $sType) { $mResult = false; try { $mResult = OauthAccount::where('IdSocial', $sIdSocial)->where('Type', $sType)->first(); } catch (\Aurora\System\Exceptions\BaseException $oException) { $mResult = false; $this->setLastException($oException); } return $mResult; } /** * @param int $iIdUser * * @return array */ public function getAccounts($iIdUser) { $aResult = false; try { $aResult = OauthAccount::where('IdUser', $iIdUser)->get(); } catch (\Aurora\System\Exceptions\BaseException $oException) { $aResult = false; $this->setLastException($oException); } return $aResult; } /** * @param \Aurora\Modules\OAuthIntegratorWebclient\Models\OauthAccount &$oAccount * * @return bool */ public function createAccount(OauthAccount &$oAccount) { $bResult = false; try { if ($oAccount->validate()) { if (!$this->isExists($oAccount)) { if (!$oAccount->save()) { throw new \Aurora\System\Exceptions\ManagerException(0); } } else { throw new \Aurora\System\Exceptions\ManagerException(0); } } $bResult = true; } catch (\Aurora\System\Exceptions\BaseException $oException) { $bResult = false; $this->setLastException($oException); } return $bResult; } /** * @param \Aurora\Modules\OAuthIntegratorWebclient\Models\OauthAccount &$oAccount * * @return bool */ public function updateAccount(OauthAccount &$oAccount) { $bResult = false; try { if ($oAccount->validate()) { if (!$oAccount->save()) { throw new \Aurora\System\Exceptions\ManagerException(0); } } $bResult = true; } catch (\Aurora\System\Exceptions\BaseException $oException) { $bResult = false; $this->setLastException($oException); } return $bResult; } /** * @param int $iIdUser * @param string $sType * * @return bool */ public function deleteAccount($iIdUser, $sType, $sEmail) { $bResult = false; try { $oSocial = $this->getAccount($iIdUser, $sType, $sEmail); if ($oSocial) { if (!$oSocial->delete()) { throw new \Aurora\System\Exceptions\ManagerException(0); } $bResult = true; } } catch (\Aurora\System\Exceptions\BaseException $oException) { $bResult = false; $this->setLastException($oException); } return $bResult; } /** * @param int $iIdUser * * @return bool */ public function deleteAccountByUserId($iIdUser) { return !!OauthAccount::where('IdUser', $iIdUser)->delete(); } /** * @param \Aurora\Modules\OAuthIntegratorWebclient\Models\OauthAccount &$oAccount * * @return bool */ public function isExists(OauthAccount $oAccount) { return (OauthAccount::find($oAccount->Id) instanceof OauthAccount); } }