|
|
@ -118,14 +118,25 @@ class StatController extends ThinkController
|
|
|
|
|
|
|
|
|
|
|
|
public function multisort($records, $column, $type = 'asc')
|
|
|
|
public function multisort($records, $column, $type = 'asc')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$records = index_by_column($column, $records);
|
|
|
|
$length = count($records);
|
|
|
|
// var_dump($records);die();
|
|
|
|
for ($i = 0; $i < $length; $i ++) {
|
|
|
|
if ($type == 'asc') {
|
|
|
|
for ($j = $i + 1; $j < $length; $j ++) {
|
|
|
|
ksort($records);
|
|
|
|
if ($type == 'asc') {
|
|
|
|
} else {
|
|
|
|
if ($records[$i][$column] > $records[$j][$column]) {
|
|
|
|
krsort($records);
|
|
|
|
$temp = $records[$i];
|
|
|
|
|
|
|
|
$records[$i] = $records[$j];
|
|
|
|
|
|
|
|
$records[$j] = $temp;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if ($type == 'desc') {
|
|
|
|
|
|
|
|
if ($records[$i][$column] < $records[$j][$column]) {
|
|
|
|
|
|
|
|
$temp = $records[$i];
|
|
|
|
|
|
|
|
$records[$i] = $records[$j];
|
|
|
|
|
|
|
|
$records[$j] = $temp;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return array_values($records);
|
|
|
|
return $records;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function userretention()
|
|
|
|
public function userretention()
|
|
|
@ -135,6 +146,16 @@ class StatController extends ThinkController
|
|
|
|
$end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end');
|
|
|
|
$end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end');
|
|
|
|
$dataOrder = I('data_order', '');
|
|
|
|
$dataOrder = I('data_order', '');
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
|
|
|
|
|
$promoteId = I('promote_id', 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$orderType = 'asc';
|
|
|
|
|
|
|
|
$orderColumn = 'date';
|
|
|
|
|
|
|
|
if ($dataOrder != '')
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$dataOrder = explode(',', $dataOrder);
|
|
|
|
|
|
|
|
$orderType = $dataOrder[1];
|
|
|
|
|
|
|
|
$orderColumn = $dataOrder[0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$status = true;
|
|
|
|
$status = true;
|
|
|
|
$data = false;
|
|
|
|
$data = false;
|
|
|
@ -171,7 +192,14 @@ class StatController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = $result['data']['records'];
|
|
|
|
$data = $result['data']['records'];
|
|
|
|
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
|
|
|
|
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
|
|
|
|
|
|
|
|
$gameName = get_game_name($gameId);
|
|
|
|
|
|
|
|
$promoteName = '全部';
|
|
|
|
|
|
|
|
if ($promoteId) {
|
|
|
|
|
|
|
|
$promoteName = get_promote_account($promoteId);
|
|
|
|
|
|
|
|
}
|
|
|
|
foreach ($data as $key => $item) {
|
|
|
|
foreach ($data as $key => $item) {
|
|
|
|
|
|
|
|
$item['promote_name'] = $promoteName;
|
|
|
|
|
|
|
|
$item['game_name'] = $gameName;
|
|
|
|
foreach ($dayList as $day) {
|
|
|
|
foreach ($dayList as $day) {
|
|
|
|
if ($item['register_count'] > 0) {
|
|
|
|
if ($item['register_count'] > 0) {
|
|
|
|
$item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100;
|
|
|
|
$item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100;
|
|
|
@ -182,12 +210,15 @@ class StatController extends ThinkController
|
|
|
|
$data[$key] = $item;
|
|
|
|
$data[$key] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($dataOrder) {
|
|
|
|
if ($dataOrder) {
|
|
|
|
$data = $this->multisort($data, $dataOrder);
|
|
|
|
$data = $this->multisort($data, $orderColumn, $orderType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$this->assign('error', $error);
|
|
|
|
$this->assign('error', $error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assign('data', $data);
|
|
|
|
|
|
|
|
$this->assign('order_type', $orderType);
|
|
|
|
|
|
|
|
$this->assign('order_column', $orderColumn);
|
|
|
|
$this->assign('data', $data);
|
|
|
|
$this->assign('data', $data);
|
|
|
|
$this->meta_title = '留存统计';
|
|
|
|
$this->meta_title = '留存统计';
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|