fixed
This commit is contained in:
parent
2f14ba9cd7
commit
77cee14cbf
@ -327,25 +327,7 @@ class BpsAdController
|
||||
$requireSpend = (bool)($options['conditions']['requireSpend'] ?? false);
|
||||
// $dateRange = 'Last Week'; // 默认日期范围
|
||||
// 根据 platformType 获取广告账户
|
||||
if ($platformType === 1) {
|
||||
if (!$request->refresh_token_facebook) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token_facebook]);
|
||||
} elseif ($platformType === 2) {
|
||||
if (!$request->refresh_token_google) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token_google]);
|
||||
} elseif ($platformType === 3) {
|
||||
if (!$request->refresh_token_tiktok) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token_tiktok]);
|
||||
} else {
|
||||
// TODO: 匹配jwt的商户id还是登录用户id
|
||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['merchant_id' => $options['jwtClaims']['merchant_id']]);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['merchant_id' => $options['jwtClaims']['merchant_id'], 'platform' => $platformType]);
|
||||
|
||||
if (empty($accounts)) {
|
||||
$data = [
|
||||
@ -520,25 +502,7 @@ class BpsAdController
|
||||
// $dateRange = 'Last Week'; // 默认日期范围
|
||||
|
||||
// 根据 platformType 获取广告账户
|
||||
if ($platformType === 1) {
|
||||
if (!$request->refresh_token_facebook) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token_facebook]);
|
||||
} elseif ($platformType === 2) {
|
||||
if (!$request->refresh_token_google) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token_google]);
|
||||
} elseif ($platformType === 3) {
|
||||
if (!$request->refresh_token_tiktok) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token_tiktok]);
|
||||
} else {
|
||||
// TODO: 匹配jwt的商户id还是登录用户id
|
||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['merchant_id' => $options['jwtClaims']['merchant_id']]);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['merchant_id' => $options['jwtClaims']['merchant_id'], 'platform' => $platformType]);
|
||||
|
||||
if (empty($accounts)) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
@ -578,25 +542,7 @@ class BpsAdController
|
||||
// $dateRange = 'Last Week'; // 默认日期范围
|
||||
|
||||
// 根据 platformType 获取广告账户
|
||||
if ($platformType === 1) {
|
||||
if (!$request->refresh_token_facebook) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token_facebook]);
|
||||
} elseif ($platformType === 2) {
|
||||
if (!$request->refresh_token_google) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token_google]);
|
||||
} elseif ($platformType === 3) {
|
||||
if (!$request->refresh_token_tiktok) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token_tiktok]);
|
||||
} else {
|
||||
// TODO: 匹配jwt的商户id还是登录用户id
|
||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['merchant_id' => $options['jwtClaims']['merchant_id']]);
|
||||
}
|
||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['merchant_id' => $options['jwtClaims']['merchant_id'], 'platform' => $platformType]);
|
||||
|
||||
if (empty($accounts)) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
|
@ -47,7 +47,7 @@ class BpsAdAccountService
|
||||
*/
|
||||
public function getGoogleAdAccounts($options = [])
|
||||
{
|
||||
if (!empty($options)) {
|
||||
if (!empty($options) && isset($options['merchant_id'])) {
|
||||
$merchant_id = $options['merchant_id'];
|
||||
$account_id = $options['account_id'] ?? null; // 从 $options 中获取 account_id,如果没有则默认为 null
|
||||
$query = BpsAdsMerchantRelation::alias('bamr')
|
||||
@ -127,7 +127,7 @@ class BpsAdAccountService
|
||||
*/
|
||||
public function getMetaAdAccounts($options = [])
|
||||
{
|
||||
if (!empty($options)) {
|
||||
if (!empty($options) && isset($options['merchant_id'])) {
|
||||
$merchant_id = $options['merchant_id'];
|
||||
// 获取符合条件的客户ID数组
|
||||
$customers = BpsAdsMerchantRelation::alias('bamr')
|
||||
@ -199,7 +199,7 @@ class BpsAdAccountService
|
||||
*/
|
||||
public function getTiktokAdAccounts($options = [])
|
||||
{
|
||||
if (!empty($options)) {
|
||||
if (!empty($options) && isset($options['merchant_id'])) {
|
||||
// 获取符合条件的客户ID数组
|
||||
$merchant_id = $options['merchant_id'];
|
||||
$customers = BpsAdsMerchantRelation::alias('bamr')
|
||||
|
Loading…
Reference in New Issue
Block a user