|
|
@ -4597,14 +4597,12 @@ class ExportController extends Controller
|
|
|
|
array('total_amt','充值金额'),
|
|
|
|
array('total_amt','充值金额'),
|
|
|
|
array('user_count','活跃用户'),
|
|
|
|
array('user_count','活跃用户'),
|
|
|
|
array('ltv_1','LTV1'),
|
|
|
|
array('ltv_1','LTV1'),
|
|
|
|
array('ltv_2','LTV2'),
|
|
|
|
|
|
|
|
array('ltv_3','LTV3'),
|
|
|
|
|
|
|
|
array('ltv_4','LTV4'),
|
|
|
|
|
|
|
|
array('ltv_5','LTV5'),
|
|
|
|
|
|
|
|
array('ltv_6','LTV6'),
|
|
|
|
|
|
|
|
array('ltv_7','LTV7'),
|
|
|
|
array('ltv_7','LTV7'),
|
|
|
|
array('ltv_14','LTV14'),
|
|
|
|
array('ltv_14','LTV14'),
|
|
|
|
array('ltv_30','LTV30'),
|
|
|
|
array('ltv_30','LTV30'),
|
|
|
|
|
|
|
|
array('ltv_60','LTV60'),
|
|
|
|
|
|
|
|
array('ltv_90','LTV90'),
|
|
|
|
|
|
|
|
array('ltv_180','LTV180'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$start_time = $start = strtotime($start);
|
|
|
|
$start_time = $start = strtotime($start);
|
|
|
@ -4650,18 +4648,16 @@ class ExportController extends Controller
|
|
|
|
$result = [];
|
|
|
|
$result = [];
|
|
|
|
foreach ($users as $index => $item) {
|
|
|
|
foreach ($users as $index => $item) {
|
|
|
|
$ltv_start = strtotime($item['reg_date']);
|
|
|
|
$ltv_start = strtotime($item['reg_date']);
|
|
|
|
$ltv_end = strtotime($item['reg_date']) + 30 * 86400;
|
|
|
|
$ltv_end = strtotime($item['reg_date']) + 180 * 86400;
|
|
|
|
$ltv = M()->query("
|
|
|
|
$ltv = M()->query("
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 1).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_1,
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 1).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_1,
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 2).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_2,
|
|
|
|
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 3).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_3,
|
|
|
|
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 4).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_4,
|
|
|
|
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 5).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_5,
|
|
|
|
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 6).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_6,
|
|
|
|
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 7).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_7,
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 7).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_7,
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 14).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_14,
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 14).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_14,
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 30).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_30,
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 30).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_30,
|
|
|
|
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 60).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_60,
|
|
|
|
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 90).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_90,
|
|
|
|
|
|
|
|
ROUND(SUM(if (pay_time BETWEEN {$ltv_start} and ".($ltv_start+86400 * 180).", pay_amount, 0))/{$item['total_count']}, 2) as ltv_180,
|
|
|
|
SUM(if (pay_time BETWEEN {$start_time} and ".($end_time).", pay_amount, 0)) as total_amt
|
|
|
|
SUM(if (pay_time BETWEEN {$start_time} and ".($end_time).", pay_amount, 0)) as total_amt
|
|
|
|
FROM
|
|
|
|
FROM
|
|
|
|
tab_spend
|
|
|
|
tab_spend
|
|
|
@ -4676,14 +4672,12 @@ class ExportController extends Controller
|
|
|
|
'total_amt'=>$ltv[0]['total_amt'] ?: 0,
|
|
|
|
'total_amt'=>$ltv[0]['total_amt'] ?: 0,
|
|
|
|
'user_count'=>$item['total_count'] ?: 0,
|
|
|
|
'user_count'=>$item['total_count'] ?: 0,
|
|
|
|
'ltv_1'=>$ltv[0]['ltv_1'] ?: 0,
|
|
|
|
'ltv_1'=>$ltv[0]['ltv_1'] ?: 0,
|
|
|
|
'ltv_2'=>$ltv[0]['ltv_2'] ?: 0,
|
|
|
|
'ltv_7'=>$ltv[0]['ltv_7'] ?: 0,
|
|
|
|
'ltv_3'=>$ltv[0]['ltv_3'] ?: 0,
|
|
|
|
|
|
|
|
'ltv_4'=>$ltv[0]['ltv_4'] ?: 0,
|
|
|
|
|
|
|
|
'ltv_5'=>$ltv[0]['ltv_5'] ?: 0,
|
|
|
|
|
|
|
|
'ltv_6'=>$ltv[0]['ltv_6'] ?: 0,
|
|
|
|
|
|
|
|
'ltv_7'=>$ltv[0]['ltv_7'] ?: 0,
|
|
|
|
|
|
|
|
'ltv_14'=>$ltv[0]['ltv_14'] ?: 0,
|
|
|
|
'ltv_14'=>$ltv[0]['ltv_14'] ?: 0,
|
|
|
|
'ltv_30'=>$ltv[0]['ltv_30'] ?: 0
|
|
|
|
'ltv_30'=>$ltv[0]['ltv_30'] ?: 0,
|
|
|
|
|
|
|
|
'ltv_60'=>$ltv[0]['ltv_60'] ?: 0,
|
|
|
|
|
|
|
|
'ltv_90'=>$ltv[0]['ltv_90'] ?: 0,
|
|
|
|
|
|
|
|
'ltv_180'=>$ltv[0]['ltv_180'] ?: 0,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
unset($user[$index]);
|
|
|
|
unset($user[$index]);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4698,15 +4692,13 @@ class ExportController extends Controller
|
|
|
|
'date'=>date("Y-m-d", $i),
|
|
|
|
'date'=>date("Y-m-d", $i),
|
|
|
|
'total_amt'=> 0,
|
|
|
|
'total_amt'=> 0,
|
|
|
|
'user_count'=> 0,
|
|
|
|
'user_count'=> 0,
|
|
|
|
'ltv_1'=> 0,
|
|
|
|
'ltv_1'=> 0,
|
|
|
|
'ltv_2'=> 0,
|
|
|
|
'ltv_7'=> 0,
|
|
|
|
'ltv_3'=> 0,
|
|
|
|
|
|
|
|
'ltv_4'=> 0,
|
|
|
|
|
|
|
|
'ltv_5'=> 0,
|
|
|
|
|
|
|
|
'ltv_6'=> 0,
|
|
|
|
|
|
|
|
'ltv_7'=> 0,
|
|
|
|
|
|
|
|
'ltv_14'=> 0,
|
|
|
|
'ltv_14'=> 0,
|
|
|
|
'ltv_30'=> 0
|
|
|
|
'ltv_30'=> 0,
|
|
|
|
|
|
|
|
'ltv_60'=> 0,
|
|
|
|
|
|
|
|
'ltv_90'=> 0,
|
|
|
|
|
|
|
|
'ltv_180'=> 0,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|