fix 三个平台取有access_token的广告账户
This commit is contained in:
parent
1f4b15316a
commit
19731fcae9
@ -116,18 +116,27 @@ class BpsAdController
|
|||||||
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
|
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
|
||||||
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
|
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
|
||||||
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
|
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
|
||||||
$status = $options['conditions']['status'] ?? 0; // 平台类型
|
$status = $options['conditions']['status'] ?? 0; // 平台类型
|
||||||
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
||||||
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
||||||
// $dateRange = 'Last Week'; // 默认日期范围
|
// $dateRange = 'Last Week'; // 默认日期范围
|
||||||
|
|
||||||
// 根据 platformType 获取广告账户
|
// 根据 platformType 获取广告账户
|
||||||
if ($platformType === 1) {
|
if ($platformType === 1) {
|
||||||
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_facebook) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token_facebook]);
|
||||||
} elseif ($platformType === 2) {
|
} elseif ($platformType === 2) {
|
||||||
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_google) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token_google]);
|
||||||
} elseif ($platformType === 3) {
|
} elseif ($platformType === 3) {
|
||||||
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_tiktok) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token_tiktok]);
|
||||||
} else {
|
} else {
|
||||||
// TODO: 匹配jwt的商户id还是登录用户id
|
// TODO: 匹配jwt的商户id还是登录用户id
|
||||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
||||||
@ -156,41 +165,6 @@ class BpsAdController
|
|||||||
return $this->successResponse($result, $request);
|
return $this->successResponse($result, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function listAssets(Request $request)
|
|
||||||
{
|
|
||||||
$options = $request->all();
|
|
||||||
|
|
||||||
// 获取请求参数
|
|
||||||
$page = $options['pageNo'] ?? 1; // 页码
|
|
||||||
$pageSize = $options['pageSize'] ?? 10; // 每页数量
|
|
||||||
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
|
|
||||||
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
|
||||||
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
|
||||||
$dateRange = 'Last Week'; // 默认日期范围
|
|
||||||
|
|
||||||
// $customerId = 4060397299;
|
|
||||||
$customers = $this->googleOAuthService->getGoogleAdCustomers(['refresh_token' => $request->refresh_token]);
|
|
||||||
$customerIds = array_column($customers, 'customer_id');
|
|
||||||
//dump( $customerIds, // 客户 ID 数组
|
|
||||||
// $page, // 页码
|
|
||||||
// $pageSize, // 每页数量
|
|
||||||
// $keyword, // 关键字
|
|
||||||
// $dateRange,
|
|
||||||
// $startDate, // 开始日期
|
|
||||||
// $endDate);
|
|
||||||
// 调用 Service 层查询
|
|
||||||
$result = $this->googleAdsReportService->getAssetConversionData(
|
|
||||||
$customerIds, // 客户 ID 数组
|
|
||||||
$page, // 页码
|
|
||||||
$pageSize, // 每页数量
|
|
||||||
$keyword, // 关键字
|
|
||||||
$dateRange,
|
|
||||||
$startDate, // 开始日期
|
|
||||||
$endDate);
|
|
||||||
return $this->successResponse($result, $request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function listCampaigns(Request $request)
|
public function listCampaigns(Request $request)
|
||||||
{
|
{
|
||||||
$options = $request->all();
|
$options = $request->all();
|
||||||
@ -201,17 +175,26 @@ class BpsAdController
|
|||||||
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
|
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
|
||||||
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
|
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
|
||||||
$platformType = $options['conditions']['platformType'] ?? 0; // 关键字搜索
|
$platformType = $options['conditions']['platformType'] ?? 0; // 关键字搜索
|
||||||
$status = $options['conditions']['status'] ?? 0; // 平台类型
|
$status = $options['conditions']['status'] ?? 0; // 平台类型
|
||||||
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
||||||
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
||||||
// $dateRange = 'Last Week'; // 默认日期范围
|
// $dateRange = 'Last Week'; // 默认日期范围
|
||||||
// 根据 platformType 获取广告账户
|
// 根据 platformType 获取广告账户
|
||||||
if ($platformType === 1) {
|
if ($platformType === 1) {
|
||||||
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_facebook) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token_facebook]);
|
||||||
} elseif ($platformType === 2) {
|
} elseif ($platformType === 2) {
|
||||||
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_google) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token_google]);
|
||||||
} elseif ($platformType === 3) {
|
} elseif ($platformType === 3) {
|
||||||
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_tiktok) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token_tiktok]);
|
||||||
} else {
|
} else {
|
||||||
// TODO: 匹配jwt的商户id还是登录用户id
|
// TODO: 匹配jwt的商户id还是登录用户id
|
||||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
||||||
@ -248,18 +231,27 @@ class BpsAdController
|
|||||||
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
|
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
|
||||||
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
|
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
|
||||||
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
|
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
|
||||||
$status = $options['conditions']['status'] ?? 0; // 平台类型
|
$status = $options['conditions']['status'] ?? 0; // 平台类型
|
||||||
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
||||||
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
||||||
// $dateRange = 'Last Week'; // 默认日期范围
|
// $dateRange = 'Last Week'; // 默认日期范围
|
||||||
|
|
||||||
// 根据 platformType 获取广告账户
|
// 根据 platformType 获取广告账户
|
||||||
if ($platformType === 1) {
|
if ($platformType === 1) {
|
||||||
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_facebook) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token_facebook]);
|
||||||
} elseif ($platformType === 2) {
|
} elseif ($platformType === 2) {
|
||||||
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_google) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token_google]);
|
||||||
} elseif ($platformType === 3) {
|
} elseif ($platformType === 3) {
|
||||||
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_tiktok) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token_tiktok]);
|
||||||
} else {
|
} else {
|
||||||
// TODO: 匹配jwt的商户id还是登录用户id
|
// TODO: 匹配jwt的商户id还是登录用户id
|
||||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
||||||
@ -288,7 +280,7 @@ class BpsAdController
|
|||||||
return $this->successResponse($result, $request);
|
return $this->successResponse($result, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listCreatives(Request $request)
|
public function listCreatives(Request $request)
|
||||||
{
|
{
|
||||||
$options = $request->all();
|
$options = $request->all();
|
||||||
$options['jwtClaims'] = $request->jwtClaims;
|
$options['jwtClaims'] = $request->jwtClaims;
|
||||||
@ -304,11 +296,20 @@ class BpsAdController
|
|||||||
|
|
||||||
// 根据 platformType 获取广告账户
|
// 根据 platformType 获取广告账户
|
||||||
if ($platformType === 1) {
|
if ($platformType === 1) {
|
||||||
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_facebook) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token_facebook]);
|
||||||
} elseif ($platformType === 2) {
|
} elseif ($platformType === 2) {
|
||||||
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_google) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token_google]);
|
||||||
} elseif ($platformType === 3) {
|
} elseif ($platformType === 3) {
|
||||||
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_tiktok) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token_tiktok]);
|
||||||
} else {
|
} else {
|
||||||
// TODO: 匹配jwt的商户id还是登录用户id
|
// TODO: 匹配jwt的商户id还是登录用户id
|
||||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
||||||
@ -336,13 +337,13 @@ class BpsAdController
|
|||||||
return $this->successResponse($result, $request);
|
return $this->successResponse($result, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listCharts(Request $request)
|
public function listCharts(Request $request)
|
||||||
{
|
{
|
||||||
$options = $request->all();
|
$options = $request->all();
|
||||||
$options['jwtClaims'] = $request->jwtClaims;
|
$options['jwtClaims'] = $request->jwtClaims;
|
||||||
|
|
||||||
// 获取请求参数
|
// 获取请求参数
|
||||||
$cycle = $options['conditions']['cycle'] ?? 3; // 页码
|
$cycle = $options['conditions']['cycle'] ?? 3; // 页码
|
||||||
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
|
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
|
||||||
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
|
||||||
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
|
||||||
@ -350,11 +351,20 @@ class BpsAdController
|
|||||||
|
|
||||||
// 根据 platformType 获取广告账户
|
// 根据 platformType 获取广告账户
|
||||||
if ($platformType === 1) {
|
if ($platformType === 1) {
|
||||||
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_facebook) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getMetaAdAccounts(['refresh_token' => $request->refresh_token_facebook]);
|
||||||
} elseif ($platformType === 2) {
|
} elseif ($platformType === 2) {
|
||||||
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_google) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getGoogleAdAccounts(['refresh_token' => $request->refresh_token_google]);
|
||||||
} elseif ($platformType === 3) {
|
} elseif ($platformType === 3) {
|
||||||
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token]);
|
if (!$request->refresh_token_tiktok) {
|
||||||
|
return $this->errorResponse(0, 'no data');
|
||||||
|
}
|
||||||
|
$accounts = $this->bpsAdAccountService->getTiktokAdAccounts(['refresh_token' => $request->refresh_token_tiktok]);
|
||||||
} else {
|
} else {
|
||||||
// TODO: 匹配jwt的商户id还是登录用户id
|
// TODO: 匹配jwt的商户id还是登录用户id
|
||||||
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
$accounts = $this->bpsAdAccountService->getAllAdAccounts(['uid' => $options['jwtClaims']['uid']]);
|
||||||
|
@ -38,14 +38,14 @@ class BpsAdAccountService
|
|||||||
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
||||||
->where('tu.third_type', 'google') // 筛选 third_type 为 google 的记录
|
->where('tu.third_type', 'google') // 筛选 third_type 为 google 的记录
|
||||||
->where('tu.access_token', $refreshToken) // 筛选 third_type 为 google 的记录
|
->where('tu.access_token', $refreshToken) // 筛选 third_type 为 google 的记录
|
||||||
->field('CAST(tua.advertiser_id AS BIGINT) as account_id,tua.google_login_customer_id as login_customer_id,tua.google_test_account as test_account,tua.google_manager as manager, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
->field('tua.advertiser_id as account_id,tua.google_login_customer_id as login_customer_id,tua.google_test_account as test_account,tua.google_manager as manager, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
||||||
->select(); // 执行查询
|
->select(); // 执行查询
|
||||||
} else {
|
} else {
|
||||||
// 获取符合条件的客户ID数组
|
// 获取符合条件的客户ID数组
|
||||||
$customers = ThirdUserAdvertiser::alias('tua')
|
$customers = ThirdUserAdvertiser::alias('tua')
|
||||||
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
||||||
->where('tu.third_type', 'google') // 筛选 third_type 为 google 的记录
|
->where('tu.third_type', 'google') // 筛选 third_type 为 google 的记录
|
||||||
->field('CAST(tua.advertiser_id AS BIGINT) as account_id,tua.google_login_customer_id as login_customer_id,tua.google_test_account as test_account,tua.google_manager as manager, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
->field('tua.advertiser_id as account_id,tua.google_login_customer_id as login_customer_id,tua.google_test_account as test_account,tua.google_manager as manager, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
||||||
->select(); // 执行查询
|
->select(); // 执行查询
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,14 +74,14 @@ class BpsAdAccountService
|
|||||||
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
||||||
->where('tu.third_type', 'facebook') // 筛选 third_type 为 google 的记录
|
->where('tu.third_type', 'facebook') // 筛选 third_type 为 google 的记录
|
||||||
->where('tu.access_token', $refreshToken) // 筛选 third_type 为 google 的记录
|
->where('tu.access_token', $refreshToken) // 筛选 third_type 为 google 的记录
|
||||||
->field('CAST(tua.advertiser_id AS BIGINT) as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
->field('tua.advertiser_id as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
||||||
->select(); // 执行查询
|
->select(); // 执行查询
|
||||||
} else {
|
} else {
|
||||||
// 获取符合条件的客户ID数组
|
// 获取符合条件的客户ID数组
|
||||||
$customers = ThirdUserAdvertiser::alias('tua')
|
$customers = ThirdUserAdvertiser::alias('tua')
|
||||||
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
||||||
->where('tu.third_type', 'facebook') // 筛选 third_type 为 google 的记录
|
->where('tu.third_type', 'facebook') // 筛选 third_type 为 google 的记录
|
||||||
->field('CAST(tua.advertiser_id AS BIGINT) as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
->field('tua.advertiser_id as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
||||||
->select(); // 执行查询
|
->select(); // 执行查询
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,14 +110,14 @@ class BpsAdAccountService
|
|||||||
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
||||||
->where('tu.third_type', 'tiktok') // 筛选 third_type 为 google 的记录
|
->where('tu.third_type', 'tiktok') // 筛选 third_type 为 google 的记录
|
||||||
->where('tu.access_token', $refreshToken) // 筛选 third_type 为 google 的记录
|
->where('tu.access_token', $refreshToken) // 筛选 third_type 为 google 的记录
|
||||||
->field('CAST(tua.advertiser_id AS BIGINT) as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
->field('tua.advertiser_id as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
||||||
->select(); // 执行查询
|
->select(); // 执行查询
|
||||||
} else {
|
} else {
|
||||||
// 获取符合条件的客户ID数组
|
// 获取符合条件的客户ID数组
|
||||||
$customers = ThirdUserAdvertiser::alias('tua')
|
$customers = ThirdUserAdvertiser::alias('tua')
|
||||||
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
||||||
->where('tu.third_type', 'tiktok') // 筛选 third_type 为 google 的记录
|
->where('tu.third_type', 'tiktok') // 筛选 third_type 为 google 的记录
|
||||||
->field('CAST(tua.advertiser_id AS BIGINT) as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
->field('tua.advertiser_id as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
||||||
->select(); // 执行查询
|
->select(); // 执行查询
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ class BpsAdAccountService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量获取全部meta广告账号数据
|
* 批量获取全部广告账号数据
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function getAllAdAccounts($options = [])
|
public function getAllAdAccounts($options = [])
|
||||||
@ -143,7 +143,8 @@ class BpsAdAccountService
|
|||||||
$customers = ThirdUserAdvertiser::alias('tua')
|
$customers = ThirdUserAdvertiser::alias('tua')
|
||||||
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
|
||||||
->where('tu.user_id', $options['uid']) // 筛选 third_type 为 google 的记录
|
->where('tu.user_id', $options['uid']) // 筛选 third_type 为 google 的记录
|
||||||
->field('CAST(tua.advertiser_id AS BIGINT) as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
->where('tu.access_token', '<>', '') // 筛选 access_token 不为空的记录
|
||||||
|
->field('tua.advertiser_id as account_id, tu.access_token as refresh_token') // 获取 advertiser_id 字段
|
||||||
->select(); // 执行查询
|
->select(); // 执行查询
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user