Merge remote-tracking branch 'origin/main'

This commit is contained in:
hgc 2025-02-22 18:58:37 +08:00
commit e8c55e6c8a

View File

@ -4,6 +4,7 @@ namespace app\controller;
use app\service\GoogleOAuthService;
use app\service\BpsAdAccountService;
use app\service\GoogleAdsAccountService;
use support\Request;
use support\Response;
use DI\Annotation\Inject;
@ -32,6 +33,12 @@ class OAuthController
*/
private $bpsAdAccountService;
/**
* @Inject
* @var GoogleAdsAccountService
*/
private $googleAdsAccountService;
public function getAuthCode(Request $request)
{
@ -97,8 +104,20 @@ class OAuthController
}
return $this->errorResponse(300, 'Refresh Token getting failed');
} else {
//如果这个授权用户名下没有任何广告账号
$option = [];
$option['refresh_token'] = $tokens['refresh_token'];
$listAccessibleCustomers = $this->googleAdsAccountService->runListAccessibleCustomers($option);
if (empty($listAccessibleCustomers)) {
$googleOAuthService = new GoogleOAuthService();
$googleOAuthService->revokeToken($tokens['refresh_token'], $merchantId);
return $this->errorResponse(300, 'has not any google ads account');
}
// $googleOAuthService->saveRefreshToken($tokens['refresh_token'], $state); //作废2025-2-13
$googleOAuthService->saveRefreshTokenNew($tokens['refresh_token'],$tokens['access_token'], $merchantId,$userId);
$googleOAuthService->saveRefreshTokenNew($tokens['refresh_token'], $tokens['access_token'], $merchantId, $userId);
// 生成 UUID
$uuid = $this->generateUuid();