如果这个授权用户名下没有任何广告账号 则解绑

This commit is contained in:
hgc 2025-02-22 20:18:28 +08:00
parent 6341a93e55
commit a282acc437

View File

@ -110,13 +110,15 @@ class OAuthController
try { try {
$listAccessibleCustomers = $this->googleAdsAccountService->runListAccessibleCustomers($option); $listAccessibleCustomers = $this->googleAdsAccountService->runListAccessibleCustomers($option);
}catch (\Exception $e) { }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.'); $googleOAuthService = new GoogleOAuthService();
$googleOAuthService->revokeToken($tokens['refresh_token'], $merchantId);
return $this->errorResponse(300, 'The Google account not associated with any Ads accounts');
} }
if (empty($listAccessibleCustomers)) { if (empty($listAccessibleCustomers)) {
$googleOAuthService = new GoogleOAuthService(); $googleOAuthService = new GoogleOAuthService();
$googleOAuthService->revokeToken($tokens['refresh_token'], $merchantId); $googleOAuthService->revokeToken($tokens['refresh_token'], $merchantId);
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.'); return $this->errorResponse(300, 'The Google account not associated with any active Ads accounts');
} }
// $googleOAuthService->saveRefreshToken($tokens['refresh_token'], $state); //作废2025-2-13 // $googleOAuthService->saveRefreshToken($tokens['refresh_token'], $state); //作废2025-2-13