diff --git a/app/controller/OAuthController.php b/app/controller/OAuthController.php index 73b6a9c..3ecddbc 100644 --- a/app/controller/OAuthController.php +++ b/app/controller/OAuthController.php @@ -107,13 +107,16 @@ class OAuthController //如果这个授权用户名下没有任何广告账号 $option = []; $option['refresh_token'] = $tokens['refresh_token']; - - $listAccessibleCustomers = $this->googleAdsAccountService->runListAccessibleCustomers($option); + try { + $listAccessibleCustomers = $this->googleAdsAccountService->runListAccessibleCustomers($option); + }catch (\Exception $e) { + return $this->errorResponse(300, 'The Google account (@gmail.com user) that generated the OAuth access tokens is not associated with any Ads accounts. Create a new account, or add the Google account to an existing Ads account.'); + } if (empty($listAccessibleCustomers)) { $googleOAuthService = new GoogleOAuthService(); $googleOAuthService->revokeToken($tokens['refresh_token'], $merchantId); - return $this->errorResponse(300, 'has not any google ads account'); + return $this->errorResponse(300, 'The Google account (@gmail.com user) that generated the OAuth access tokens is not associated with any active Ads accounts. Create a active account and try again.'); } // $googleOAuthService->saveRefreshToken($tokens['refresh_token'], $state); //作废2025-2-13