筛选状态

This commit is contained in:
huangguancheng 2025-01-10 15:19:38 +08:00
parent 7ca83c6c8e
commit 4029a20e3c
3 changed files with 29 additions and 11 deletions

View File

@ -116,6 +116,7 @@ class BpsAdController
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
$status = $options['conditions']['status'] ?? 0; // 平台类型
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
// $dateRange = 'Last Week'; // 默认日期范围
@ -147,7 +148,8 @@ class BpsAdController
$pageSize, // 每页数量
$keyword, // 关键字
$startDate, // 开始日期
$endDate // 结束日期
$endDate, // 结束日期
$status
);
// 返回结果
@ -199,6 +201,7 @@ class BpsAdController
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
$platformType = $options['conditions']['platformType'] ?? 0; // 关键字搜索
$status = $options['conditions']['status'] ?? 0; // 平台类型
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
// $dateRange = 'Last Week'; // 默认日期范围
@ -228,7 +231,8 @@ class BpsAdController
$pageSize, // 每页数量
$keyword, // 关键字
$startDate, // 开始日期
$endDate // 结束日期
$endDate, // 结束日期
$status
);
return $this->successResponse($result, $request);
// return $this->errorResponse(300,'授权失败');
@ -244,6 +248,7 @@ class BpsAdController
$pageSize = $options['pageSize'] ?? 1000; // 每页数量
$keyword = $options['conditions']['keyword'] ?? ''; // 关键字搜索
$platformType = $options['conditions']['platformType'] ?? 0; // 平台类型
$status = $options['conditions']['status'] ?? 0; // 平台类型
$startDate = $options['conditions']['startDate'] ?? null; // 开始日期
$endDate = $options['conditions']['endDate'] ?? null; // 结束日期
// $dateRange = 'Last Week'; // 默认日期范围
@ -275,7 +280,8 @@ class BpsAdController
$pageSize, // 每页数量
$keyword, // 关键字
$startDate, // 开始日期
$endDate // 结束日期
$endDate, // 结束日期
$status
);
// 返回结果

View File

@ -30,7 +30,7 @@ class AdsInsightService
/**
* 获取广告系列列表
*/
public static function getCampaignList($platformType, $customerIds, $page, $pageSize, $keyword, $startDate = null, $endDate = null)
public static function getCampaignList($platformType, $customerIds, $page, $pageSize, $keyword, $startDate = null, $endDate = null,$status =0)
{
// 检查 customerIds 是否为空,直接返回空结构
if (empty($customerIds)) {
@ -74,7 +74,9 @@ class AdsInsightService
-1 as conversion_rate, -1 as roas, -1 as ctr,-1 as net_profit,-1 as net_profit_margin,-1 as net_profit_on_ad_spend')
->group('c.campaign_id, c.status, c.account_id, c.name')
->where('c.account_id', 'in', $customerIds); // 添加 customerIds 条件
if ($status !== 0) {
$query->where('c.status', '=', $status);
}
// 添加关键字过滤条件
$query->where(function ($query) use ($keyword, $platformType) {
if ($keyword) {
@ -167,7 +169,7 @@ class AdsInsightService
/**
* 获取广告组列表
*/
public static function getAdsetList($platformType, $customerIds, $page, $pageSize, $keyword, $startDate = null, $endDate = null)
public static function getAdsetList($platformType, $customerIds, $page, $pageSize, $keyword, $startDate = null, $endDate = null, $status = 0)
{
// 检查 customerIds 是否为空,直接返回空结构
if (empty($customerIds)) {
@ -211,6 +213,9 @@ class AdsInsightService
-1 as conversion_rate, -1 as roas, -1 as ctr,-1 as net_profit,-1 as net_profit_margin,-1 as net_profit_on_ad_spend')
->group('s.ad_set_id, s.status, s.account_id, s.name')
->where('s.account_id', 'in', $customerIds); // 添加 customerIds 条件
if ($status !== 0) {
$query->where('s.status', '=', $status);
}
// 添加关键字过滤条件
$query->where(function ($query) use ($keyword, $platformType) {
@ -302,7 +307,7 @@ class AdsInsightService
];
}
public static function getAdList($platformType, $customerIds, $page, $pageSize, $keyword, $startDate = null, $endDate = null)
public static function getAdList($platformType, $customerIds, $page, $pageSize, $keyword, $startDate = null, $endDate = null, $status = 0)
{
// 检查 customerIds 是否为空,直接返回空结构
if (empty($customerIds)) {
@ -345,7 +350,10 @@ class AdsInsightService
-1 as conversion_rate, -1 as roas, -1 as ctr, -1 as net_profit, -1 as net_profit_margin, -1 as net_profit_on_ad_spend')
->group('a.ad_id, a.status, a.account_id, a.name')
->where('a.account_id', 'in', $customerIds); // 添加 customerIds 条件
// 如果传入了 status 参数,按状态筛选
if ($status !== 0) {
$query->where('a.status', '=', $status);
}
// 添加关键字过滤条件
$query->where(function ($query) use ($keyword, $platformType) {
if ($keyword) {

View File

@ -168,7 +168,8 @@ class BpsAdAccountService
$users = ThirdUserAdvertiser::alias('tua')
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
->where('tu.third_type', 'facebook') // 筛选 third_type 为 facebook 的记录
->where('tu.user_id', $uid) // 使用 UID 筛选用户
->where('tu.user_id', $uid) // 筛选 user_id 的记录
->where('tu.access_token', '<>', '') // 筛选 access_token 不为空的记录
->field('tu.id, tu.access_token as refresh_token') // 获取相关字段
->select();
} else {
@ -199,7 +200,8 @@ class BpsAdAccountService
$users = ThirdUserAdvertiser::alias('tua')
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
->where('tu.third_type', 'google') // 筛选 third_type 为 google 的记录
->where('tu.user_id', $uid) // 筛选 third_type 为 google 的记录
->where('tu.user_id', $uid) // 筛选 user_id 的记录
->where('tu.access_token', '<>', '') // 筛选 access_token 不为空的记录
->field('tu.id, tu.access_token as refresh_token') // 获取相关字段
->select();
} else {
@ -230,7 +232,8 @@ class BpsAdAccountService
$users = ThirdUserAdvertiser::alias('tua')
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
->where('tu.third_type', 'tiktok') // 筛选 third_type 为 tiktok 的记录
->where('tu.access_token', $uid) // 筛选 third_type 为 tiktok 的记录
->where('tu.user_id', $uid) // 筛选 user_id 的记录
->where('tu.access_token', '<>', '') // 筛选 access_token 不为空的记录
->field('tu.id, tu.access_token as refresh_token') // 获取相关字段
->select();
} else {
@ -259,6 +262,7 @@ class BpsAdAccountService
$users = ThirdUserAdvertiser::alias('tua')
->join('bps.bps_third_user tu', 'tua.doc_ = tu.id') // 连接 bps_third_user 表
->where('tu.user_id', $userId) // 筛选 user_id 的记录
->where('tu.access_token', '<>', '') // 筛选 access_token 不为空的记录
->field('tu.id, tu.access_token as refresh_token') // 获取相关字段
->select();