fixed
This commit is contained in:
parent
5d3c2e269e
commit
03aa4c73ab
@ -8,6 +8,7 @@ use app\service\GoogleAdsGroupService;
|
||||
|
||||
//use app\service\GoogleAdsReportService;
|
||||
use app\service\AdsInsightService;
|
||||
use app\service\LandingUrlInsightService;
|
||||
use app\service\GoogleOAuthService;
|
||||
use app\service\BpsAdAccountService;
|
||||
use DI\Annotation\Inject;
|
||||
@ -24,6 +25,12 @@ class BpsAdController
|
||||
*/
|
||||
private $adsInsightService;
|
||||
|
||||
/**
|
||||
* @Inject
|
||||
* @var LandingUrlInsightService
|
||||
*/
|
||||
private $landingUrlInsightService;
|
||||
|
||||
/**
|
||||
* @Inject
|
||||
* @var GoogleAdsGroupService
|
||||
@ -693,6 +700,63 @@ class BpsAdController
|
||||
return $this->successResponse($result, $request);
|
||||
}
|
||||
|
||||
public function listLandingUrls(Request $request)
|
||||
{
|
||||
$options = $request->all();
|
||||
$options['jwtClaims'] = $request->jwtClaims;
|
||||
|
||||
// 获取请求参数
|
||||
$page = $options['pageNo'] ?? 1; // 页码
|
||||
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
|
||||
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
|
||||
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
|
||||
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
||||
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
||||
// $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(['uid' => $options['jwtClaims']['uid']]);
|
||||
}
|
||||
|
||||
if (empty($accounts)) {
|
||||
return $this->successResponse(['data' => []], $request);
|
||||
}
|
||||
|
||||
// 获取客户ID数组
|
||||
$accountIds = array_unique(array_column($accounts, 'account_id'));
|
||||
// dump($accountIds);
|
||||
// 调用 Service 层查询广告组列表
|
||||
$result = $this->landingUrlInsightService::getLandingUrlInsightData(
|
||||
$platformType,
|
||||
$accountIds, // 客户 ID 数组
|
||||
$page, // 页码
|
||||
$pageSize, // 每页数量
|
||||
$keyword, // 关键字
|
||||
$startDate, // 开始日期
|
||||
$endDate // 结束日期
|
||||
);
|
||||
|
||||
// 返回结果
|
||||
return $this->successResponse($result, $request);
|
||||
}
|
||||
|
||||
public function listCharts(Request $request)
|
||||
{
|
||||
$options = $request->all();
|
||||
|
Loading…
Reference in New Issue
Block a user