master
ELF 4 years ago
parent a9ec0f0116
commit 45460144f2

@ -4597,14 +4597,12 @@ class ExportController extends Controller
array('total_amt','充值金额'),
array('user_count','活跃用户'),
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_14','LTV14'),
array('ltv_30','LTV30'),
array('ltv_60','LTV60'),
array('ltv_90','LTV90'),
array('ltv_180','LTV180'),
);
$start_time = $start = strtotime($start);
@ -4650,18 +4648,16 @@ class ExportController extends Controller
$result = [];
foreach ($users as $index => $item) {
$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("
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 * 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 * 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 * 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
FROM
tab_spend
@ -4676,14 +4672,12 @@ class ExportController extends Controller
'total_amt'=>$ltv[0]['total_amt'] ?: 0,
'user_count'=>$item['total_count'] ?: 0,
'ltv_1'=>$ltv[0]['ltv_1'] ?: 0,
'ltv_2'=>$ltv[0]['ltv_2'] ?: 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_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]);
}
@ -4699,14 +4693,12 @@ class ExportController extends Controller
'total_amt'=> 0,
'user_count'=> 0,
'ltv_1'=> 0,
'ltv_2'=> 0,
'ltv_3'=> 0,
'ltv_4'=> 0,
'ltv_5'=> 0,
'ltv_6'=> 0,
'ltv_7'=> 0,
'ltv_14'=> 0,
'ltv_30'=> 0
'ltv_30'=> 0,
'ltv_60'=> 0,
'ltv_90'=> 0,
'ltv_180'=> 0,
];
}
}

@ -1068,18 +1068,16 @@ class StatisticsController extends ThinkController {
$result = [];
foreach ($users as $index => $item) {
$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("
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 * 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 * 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 * 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 {$ltv_start} and ".($ltv_start+86400 * 30).", pay_amount, 0)) as total_amt
FROM
tab_spend
@ -1094,14 +1092,12 @@ class StatisticsController extends ThinkController {
'total_amt'=>$ltv[0]['total_amt'] ?: 0,
'user_count'=>$item['total_count'] ?: 0,
'ltv_1'=>$ltv[0]['ltv_1'] ?: 0,
'ltv_2'=>$ltv[0]['ltv_2'] ?: 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_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]);
}
@ -1117,14 +1113,12 @@ class StatisticsController extends ThinkController {
'total_amt'=> 0,
'user_count'=> 0,
'ltv_1'=> 0,
'ltv_2'=> 0,
'ltv_3'=> 0,
'ltv_4'=> 0,
'ltv_5'=> 0,
'ltv_6'=> 0,
'ltv_7'=> 0,
'ltv_14'=> 0,
'ltv_30'=> 0
'ltv_30'=> 0,
'ltv_60'=> 0,
'ltv_90'=> 0,
'ltv_180'=> 0,
];
}
}

@ -118,7 +118,7 @@
<tbody>
<empty name="data" >
<tr>
<td colspan="13" class="text-center"><?= $error ? '<span style="color: #ff0000;">' . $error . '</span>': 'aOh! 暂时还没有内容!' ?></td>
<td colspan="15" class="text-center"><?= $error ? '<span style="color: #ff0000;">' . $error . '</span>': 'aOh! 暂时还没有内容!' ?></td>
</tr>
<else />
<volist name="data" id="vo">

@ -86,20 +86,18 @@
<th>充值金额</th>
<th>活跃用户</th>
<th>LTV1</th>
<th>LTV2</th>
<th>LTV3</th>
<th>LTV4</th>
<th>LTV5</th>
<th>LTV6</th>
<th>LTV7</th>
<th>LTV14</th>
<th>LTV30</th>
<th>LTV60</th>
<th>LTV90</th>
<th>LTV180</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="data">
<tr><td colspan="12" class="text-center">aOh! 暂时还没有内容!</td></tr>
<tr><td colspan="10" class="text-center">aOh! 暂时还没有内容!</td></tr>
<else/>
<volist name="data" id="vo">
<tr>
@ -107,14 +105,12 @@
<td>{$vo.total_amt}</td>
<td>{$vo.user_count}</td>
<td>{$vo.ltv_1}</td>
<td>{$vo.ltv_2}</td>
<td>{$vo.ltv_3}</td>
<td>{$vo.ltv_4}</td>
<td>{$vo.ltv_5}</td>
<td>{$vo.ltv_6}</td>
<td>{$vo.ltv_7}</td>
<td>{$vo.ltv_14}</td>
<td>{$vo.ltv_30}</td>
<td>{$vo.ltv_60}</td>
<td>{$vo.ltv_90}</td>
<td>{$vo.ltv_180}</td>
</tr>
</volist>
</empty>
@ -176,8 +172,8 @@ $(function(){
if(interval < 0 || start == ''){
layer.msg('请选择搜索时间');
return false;
}else if(interval>90){
layer.msg('请选择90日内的时间段');
}else if(interval>180){
layer.msg('请选择180日内的时间段');
return false;
}

Loading…
Cancel
Save