三个广告平台更换账号表 fixed

This commit is contained in:
huangguancheng 2025-02-15 18:36:20 +08:00
parent 973df3866e
commit e59e187af6
2 changed files with 4 additions and 1 deletions

View File

@ -127,6 +127,7 @@ class BpsAdController
// 调用 Service 层查询广告列表
$result = $this->adsInsightService::getAccountList(
$platformType, // 平台类型
$options['jwtClaims']['merchant_id'], // 店铺
$accountIds, // 客户 ID 数组
$page, // 页码
$pageSize, // 每页数量

View File

@ -1163,7 +1163,7 @@ class AdsInsightService
}
}
public static function getAccountList($platformType, $customerIds, $page, $pageSize, $keyword, $startDate = null, $endDate = null, $requireSpend = false, $countOnly = false)
public static function getAccountList($platformType, $merchantId, $customerIds, $page, $pageSize, $keyword, $startDate = null, $endDate = null, $requireSpend = false, $countOnly = false)
{
// 检查 customerIds 是否为空,直接返回计数为 0
if (empty($customerIds)) {
@ -1186,8 +1186,10 @@ class AdsInsightService
// ->where('a.advertiser_id', 'in', $customerIds);
$query = BpsAdsMerchantRelation::alias('bamr')
->cache(false)
->where('bamr.merchant_id', '=', $merchantId)
->where('bamr.account_id', 'in', $customerIds);
// 仅计数时优化查询
if ($countOnly) {
return $query->count('distinct(bamr.account_id)'); // 只查询总记录数