没有任何广告账号则自动解绑授权
This commit is contained in:
parent
c076d26cbb
commit
4dbc21ebfa
@ -4,6 +4,7 @@ namespace app\controller;
|
|||||||
|
|
||||||
use app\service\GoogleOAuthService;
|
use app\service\GoogleOAuthService;
|
||||||
use app\service\BpsAdAccountService;
|
use app\service\BpsAdAccountService;
|
||||||
|
use app\service\GoogleAdsAccountService;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use support\Response;
|
use support\Response;
|
||||||
use DI\Annotation\Inject;
|
use DI\Annotation\Inject;
|
||||||
@ -32,6 +33,12 @@ class OAuthController
|
|||||||
*/
|
*/
|
||||||
private $bpsAdAccountService;
|
private $bpsAdAccountService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Inject
|
||||||
|
* @var GoogleAdsAccountService
|
||||||
|
*/
|
||||||
|
private $googleAdsAccountService;
|
||||||
|
|
||||||
|
|
||||||
public function getAuthCode(Request $request)
|
public function getAuthCode(Request $request)
|
||||||
{
|
{
|
||||||
@ -97,8 +104,20 @@ class OAuthController
|
|||||||
}
|
}
|
||||||
return $this->errorResponse(300, 'Refresh Token getting failed');
|
return $this->errorResponse(300, 'Refresh Token getting failed');
|
||||||
} else {
|
} 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->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
|
||||||
$uuid = $this->generateUuid();
|
$uuid = $this->generateUuid();
|
||||||
|
Loading…
Reference in New Issue
Block a user