调整dashboard的meta_roas统计口径

This commit is contained in:
huangguancheng 2025-02-15 10:39:11 +08:00
parent c4cfd60c7a
commit 6af935ff23

View File

@ -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;