数据格式

This commit is contained in:
hgc 2025-01-04 17:39:20 +08:00
parent 700e96d880
commit 195a78ef16

View File

@ -106,7 +106,7 @@ class GoogleAdsReportService
'revenue' => '-', 'revenue' => '-',
'roas' => '-', 'roas' => '-',
'profit' => '-', 'profit' => '-',
'spend' => array_sum(array_column($allAds, 'spend')) ?: '0.00', 'spend' => number_format(array_sum(array_column($allAds, 'spend')),2) ?: '0.00',
'be_roas' => '-' 'be_roas' => '-'
]; ];
// 获取查询结果 // 获取查询结果
@ -412,7 +412,7 @@ class GoogleAdsReportService
$statistics = [ $statistics = [
'results' => '-', 'results' => '-',
'reach' => array_sum(array_column($allCampaigns, 'reach')) ?: 0, 'reach' => array_sum(array_column($allCampaigns, 'reach')) ?: 0,
'spend' => array_sum(array_column($allCampaigns, 'spend')) ?: '0.00', 'spend' => number_format(array_sum(array_column($allCampaigns, 'spend')),2) ?: '0.00',
'revenue' => '-', 'revenue' => '-',
'roas' => '-', 'roas' => '-',
'profit' => '-', 'profit' => '-',
@ -477,7 +477,7 @@ class GoogleAdsReportService
$dateCondition = "d.date = '" . date('Y-m-d', strtotime('-1 day')) . "'"; $dateCondition = "d.date = '" . date('Y-m-d', strtotime('-1 day')) . "'";
break; break;
case 'Last Week': case 'Last Week':
$dateCondition = "d.date >= '" . date('Y-m-d', strtotime('-1 week')) . "'"; $dateCondition = "d.date >= ' " . date('Y-m-d', strtotime('-1 week')) . "'";
break; break;
case 'Last Month': case 'Last Month':
$dateCondition = "d.date >= '" . date('Y-m-d', strtotime('-1 month')) . "'"; $dateCondition = "d.date >= '" . date('Y-m-d', strtotime('-1 month')) . "'";
@ -732,7 +732,7 @@ class GoogleAdsReportService
$statistics = [ $statistics = [
'results' => '-', 'results' => '-',
'reach' => array_sum(array_column($allAdGroups, 'reach')) ?: 0, 'reach' => array_sum(array_column($allAdGroups, 'reach')) ?: 0,
'spend' => array_sum(array_column($allAdGroups, 'spend')) ?: '0.00', 'spend' => number_format(array_sum(array_column($allAdGroups, 'spend')),2)?: '0.00',
'revenue' => '-', 'revenue' => '-',
'roas' => '-', 'roas' => '-',
'profit' => '-', 'profit' => '-',