优化
This commit is contained in:
parent
805b1ba1aa
commit
f9168896ed
@ -53,19 +53,7 @@ class OAuthController
|
||||
} else {
|
||||
$googleOAuthService->saveRefreshToken($tokens['refresh_token'], $state);
|
||||
}
|
||||
// if (getenv('GOOGLE_DEVELOP_TOKEN_LEVEL') === 'test') {
|
||||
// $option['manager_customer_id'] = '1401879025'; //开发者
|
||||
// $option['login_customer_id'] = '1401879025';
|
||||
// }
|
||||
// $option['refresh_token'] = $tokens['refresh_token'];
|
||||
//
|
||||
// $thirdUser = ThirdUser::where('access_token', $tokens['refresh_token'])->find(); // 获取第一个结果
|
||||
// if ($thirdUser) {
|
||||
// $option['third_user_id'] = $thirdUser->id;
|
||||
// Event::emit(GoogleAdsCustomers::CUSTOMERADD, $option);
|
||||
// } else {
|
||||
// return $this->errorResponse(300, 'Invalid state parameter');
|
||||
// }
|
||||
|
||||
return $this->successResponse($tokens,$request);
|
||||
|
||||
}
|
||||
@ -82,7 +70,7 @@ class OAuthController
|
||||
|
||||
$tokens = $googleOAuthService->getRefreshToken($authCode);
|
||||
if (!isset($tokens['refresh_token'])) {
|
||||
return $this->successResponse($tokens);
|
||||
return $this->successResponse($tokens,$request);
|
||||
}
|
||||
// 保存refresh token到数据库
|
||||
// $googleOAuthService->saveRefreshToken($tokens['refresh_token'], $tokens['access_token'], $request->user_id);
|
||||
@ -96,7 +84,7 @@ class OAuthController
|
||||
$googleOAuthService = new GoogleOAuthService();
|
||||
|
||||
$newAccessToken = $googleOAuthService->useRefreshToken($refreshToken);
|
||||
return $this->successResponse(['access_token' => $newAccessToken]);
|
||||
return $this->successResponse(['access_token' => $newAccessToken],$request);
|
||||
}
|
||||
|
||||
public function revokeRefreshToken(Request $request)
|
||||
@ -126,16 +114,16 @@ class OAuthController
|
||||
//保存某个主体的全部access广告账号
|
||||
public function saveAdvertisers(Request $request)
|
||||
{
|
||||
$customerIds = $request->input('third_user_list_customers'); // customer_id_list每个元素包含advertiser_id
|
||||
// $customerIds = $request->input('third_user_list_customers'); // customer_id_list每个元素包含advertiser_id
|
||||
|
||||
|
||||
// $thirdUserId = $request->input('third_user_id'); // bps_third_user的id
|
||||
$googleOAuthService = new GoogleOAuthService();
|
||||
$hasThirdUser = $googleOAuthService->bindThirdUserAdvertiser($customerId, $thirdUserId);
|
||||
if (!$hasThirdUser) {
|
||||
return $this->errorResponse(300, 'Invalid state parameter');
|
||||
}
|
||||
return $this->successResponse($hasThirdUser);
|
||||
// $googleOAuthService = new GoogleOAuthService();
|
||||
// $hasThirdUser = $googleOAuthService->bindThirdUserAdvertiser($customerId, $thirdUserId);
|
||||
// if (!$hasThirdUser) {
|
||||
// return $this->errorResponse(300, 'Invalid state parameter');
|
||||
// }
|
||||
// return $this->successResponse($hasThirdUser);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user