diff --git a/app/service/AdsDashboardService.php b/app/service/AdsDashboardService.php index 7442c97..420d68c 100644 --- a/app/service/AdsDashboardService.php +++ b/app/service/AdsDashboardService.php @@ -138,7 +138,7 @@ class AdsDashboardService $fieldMapping = [ 'meta' => [ 'meta_ads' => 'spend', // 示例映射 - 'roas' => 'roas', + 'roas' => 'meta_roas', 'cpc' => 'cpc', 'cpm' => 'cpm', 'meta_purchases' => 'platform_purchase', @@ -221,6 +221,7 @@ class AdsDashboardService // 计算指标 $roas = ($spend == 0) ? 0 : $revenue / $spend; + $meta_roas = ($spend == 0) ? 0 : $platform_purchase_value / $spend; $google_roas = ($spend == 0) ? 0 : $purchases_value / $spend; $ctr = ($impressions == 0) ? 0 : $clicks / $impressions; $cpoc = ($platform_purchase == 0) ? 0 : $platform_purchase_value / $platform_purchase; @@ -261,6 +262,9 @@ class AdsDashboardService case 'roas': $value = round($roas, 2) . 'x'; break; + case 'meta_roas': + $value = round($meta_roas, 2) . 'x'; + break; case 'google_roas': $value = round($google_roas, 2) . 'x'; break;