From a9edbe96cbfa4e36301602759db245df00bbae9f Mon Sep 17 00:00:00 2001 From: huangguancheng Date: Tue, 21 Jan 2025 15:43:26 +0800 Subject: [PATCH] =?UTF-8?q?fix=20Creative=20roas=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/AdsInsightService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/service/AdsInsightService.php b/app/service/AdsInsightService.php index d0ee10d..e56f026 100644 --- a/app/service/AdsInsightService.php +++ b/app/service/AdsInsightService.php @@ -1931,7 +1931,7 @@ class AdsInsightService $statistics = [ 'spend' => '$' . number_format($statisticsData['spend'], 2), // 格式化金额 'purchases_value' => '$' . number_format($statisticsData['purchases_value'], 2), // 格式化金额 - 'roas' => $statisticsData['spend'] == 0 ? '-' : round($statisticsData['revenue'] / $statisticsData['spend'], 2) . 'X', + 'roas' => $statisticsData['spend'] == 0 ? '-' : round($statisticsData['purchases_value'] / $statisticsData['spend'], 2) . 'X', 'cpa' => $statisticsData['purchases'] == 0 ? '-' : '$' . number_format($statisticsData['spend'] / $statisticsData['purchases'], 2), 'cpc_link_click' => $statisticsData['link_clicks'] == 0 ? '-' : '$' . number_format($statisticsData['spend'] / $statisticsData['link_clicks'], 2), 'cpm' => $statisticsData['impressions'] == 0 ? '-' : '$' . number_format($statisticsData['spend'] * 1000 / $statisticsData['impressions'], 2), // sum(spend) * 1000 / sum(Impression) @@ -2001,7 +2001,7 @@ class AdsInsightService 'thumbnail_url' => $item['thumbnail_url'], 'spend' => '$' . number_format($item['spend'], 2), 'purchases_value' => '$' . number_format($item['purchases_value'], 2), - 'roas' => $item['spend'] == 0 ? '-' : round($item['revenue'] / $item['spend'], 2) . 'X', + 'roas' => $item['spend'] == 0 ? '-' : round($item['purchases_value'] / $item['spend'], 2) . 'X', 'cpa' => $item['purchases'] == 0 ? '-' : '$' . number_format($item['spend'] / $item['purchases'], 2), 'cpc_link_click' => $item['link_clicks'] == 0 ? '-' : '$' . number_format($item['spend'] / $item['link_clicks'], 2), 'cpm' => $item['impressions'] == 0 ? '-' : '$' . number_format($item['spend'] * 1000 / $item['impressions'], 2),