diff --git a/Application/Admin/Controller/IndexController.class.php b/Application/Admin/Controller/IndexController.class.php index f779e3c5f..8a47b995f 100644 --- a/Application/Admin/Controller/IndexController.class.php +++ b/Application/Admin/Controller/IndexController.class.php @@ -260,14 +260,24 @@ class IndexController extends AdminController { $count1 = array(); $active_user_list = []; $pay_user_list = []; - $dbdata = M("IndexChart","tab_")->field("new_user_count,active_user_count,active_user_list,pay_user_count,pay_user_list,pay_money_count,promote_new_count") - ->where($map)->select(); + $dbdata = M("IndexChart","tab_")->field("FROM_UNIXTIME(`date`, '%Y-%m-%d') as time,new_user_count,active_user_count,active_user_list,pay_user_count,pay_user_list,pay_money_count,promote_new_count") + ->where($map) + ->group("time") + ->select(); + //替换数据 + $temparr = array(); + for ($i=0; $i < count($datelist); $i++) { + $temparr[$datelist[$i]]['news'] = 0; + $temparr[$datelist[$i]]['active'] = 0; + $temparr[$datelist[$i]]['player'] = 0; + $temparr[$datelist[$i]]['money'] = 0; + } foreach($dbdata as $k => $v) { - $data['news'][$k] = $v['new_user_count']; - $data['active'][$k] = $v['active_user_count']; - $data['player'][$k] = $v['pay_user_count']; - $data['money'][$k] = $v['pay_money_count']; + $temparr[$v['time']]['news'] =$v['new_user_count']; + $temparr[$v['time']]['active'] =$v['active_user_count']; + $temparr[$v['time']]['player'] =$v['pay_user_count']; + $temparr[$v['time']]['money'] =$v['pay_money_count']; $active_user_list += json_decode($v['active_user_list'],true); unset($v['active_user_list']); unset($dbdata[$k]['active_user_list']); @@ -278,6 +288,14 @@ class IndexController extends AdminController { $count1['pay_money_count'] += $v['pay_money_count']; $count1['promote_new_count'] += $v['promote_new_count']; } + foreach ($temparr as $key => $value) { + # code... + $data['news'][] = $value['news']; + $data['active'][] = $value['active']; + $data['player'][] = $value['player']; + $data['money'][] = $value['money']; + } + unset($dbdata); $count1['active_user_count'] = count(array_flip(array_flip($active_user_list))); unset($active_user_list);