|
|
|
@ -24,34 +24,54 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$lastweek=$this->total(6);
|
|
|
|
|
$lastmounth=$this->total(7);
|
|
|
|
|
$lastyear=$this->total(8);
|
|
|
|
|
//昨天
|
|
|
|
|
$yesterdaydate=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
|
|
|
|
|
$promoteyesterdaydate=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
|
|
|
|
|
// 游戏排行
|
|
|
|
|
$type=$_REQUEST['type'];
|
|
|
|
|
if($type==1 || $type==''){
|
|
|
|
|
$type=$_REQUEST['type']?:1;
|
|
|
|
|
if($type==1){
|
|
|
|
|
$list_data=$this->data_order($today,$yesterday,true);
|
|
|
|
|
$gamedateinfo = explode(" ",$today);
|
|
|
|
|
$yesterdaydate=$gamedateinfo[2];
|
|
|
|
|
}elseif($type==2){
|
|
|
|
|
$list_data=$this->data_order($thisweek,$lastweek);
|
|
|
|
|
$gamedateinfo = explode(" ",$thisweek);
|
|
|
|
|
}elseif($type==3){
|
|
|
|
|
$list_data=$this->data_order($thismounth,$lastmounth);
|
|
|
|
|
$gamedateinfo = explode(" ",$thismounth);
|
|
|
|
|
}elseif($type==4){
|
|
|
|
|
$list_data=$this->data_order($thisyear,$lastyear);
|
|
|
|
|
$gamedateinfo = explode(" ",$thisyear);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 推广员排行
|
|
|
|
|
switch($_REQUEST['category']) {
|
|
|
|
|
case 2:{$promote_data = $this->promote_data_order($thisweek,$lastweek);};break;
|
|
|
|
|
case 3:{$promote_data = $this->promote_data_order($thismounth,$lastmounth);};break;
|
|
|
|
|
case 4:{$promote_data = $this->promote_data_order($thisyear,$lastyear);};break;
|
|
|
|
|
default:
|
|
|
|
|
$category = $_REQUEST['category']?:1;
|
|
|
|
|
if($category==1){
|
|
|
|
|
$promote_data = $this->promote_data_order($today,$yesterday,true);
|
|
|
|
|
$promotedateinfo = explode(" ",$today);
|
|
|
|
|
$promoteyesterdaydate = $promotedateinfo[2];
|
|
|
|
|
}elseif($category==2){
|
|
|
|
|
$promote_data = $this->promote_data_order($thisweek,$lastweek);
|
|
|
|
|
$promotedateinfo = explode(" ",$thisweek);
|
|
|
|
|
}elseif($category==3){
|
|
|
|
|
$promote_data = $this->promote_data_order($thismounth,$lastmounth);
|
|
|
|
|
$promotedateinfo = explode(" ",$thismounth);
|
|
|
|
|
}elseif($category==4){
|
|
|
|
|
$promote_data = $this->promote_data_order($thisyear,$lastyear);
|
|
|
|
|
$promotedateinfo = explode(" ",$thisyear);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign('zhuce',$list_data['reg']);
|
|
|
|
|
$this->assign('active',$list_data['active']);
|
|
|
|
|
$this->assign('pay',$list_data['pay']);
|
|
|
|
|
$this->assign('game_chart',$list_data['chart']);
|
|
|
|
|
$this->assign('game_date_info',"统计[ ".date("Y/m/d",$gamedateinfo[2])." -- ".date("Y/m/d",$yesterdaydate)." ]之间数据");
|
|
|
|
|
|
|
|
|
|
$this->assign('promotereg',$promote_data['reg']);
|
|
|
|
|
$this->assign('promoteactive',$promote_data['active']);
|
|
|
|
|
$this->assign('promotepay',$promote_data['pay']);
|
|
|
|
|
$this->assign('promote_chart', $promote_data['chart']);
|
|
|
|
|
$this->assign('promote_date_info',"统计[ ".date("Y/m/d",$promotedateinfo[2])." -- ".date("Y/m/d",$promoteyesterdaydate)." ]之间数据");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 日历
|
|
|
|
@ -288,7 +308,7 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$map = ["puid"=>0,"fgame_id"=>["gt",0]];//0不是小号
|
|
|
|
|
$new_user_count = M("User","tab_")->field('COUNT(1) AS cg,promote_id,promote_account')->where($map)->where("register_time {$starttime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}else{
|
|
|
|
|
$new_user_count = $PromoteCount->field("promote_id,promote_account,sum(new_user_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
$new_user_count = $PromoteCount->field("promote_id,promote_account,sum(new_user_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}
|
|
|
|
|
$old_user_count = $PromoteCount->field("promote_id,promote_account,sum(new_user_count) cg")->where("`date` {$endtime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
//2.设置排名
|
|
|
|
@ -305,7 +325,7 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
->order("cg desc")
|
|
|
|
|
->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}else{
|
|
|
|
|
$new_active_count = $PromoteCount->field("promote_id,promote_account,sum(active_user_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
$new_active_count = $PromoteCount->field("promote_id,promote_account,sum(active_user_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
if(count($new_active_count) > 0){
|
|
|
|
|
$listarr = array();
|
|
|
|
|
$promote_id_str = '';
|
|
|
|
@ -343,7 +363,7 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$map = ["pay_status"=>1,"promote_id"=>["gt",0]];
|
|
|
|
|
$new_money_count = M("Spend","tab_")->field('sum(pay_amount) AS cg,promote_id,promote_account')->where($map)->where("pay_time {$starttime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}else{
|
|
|
|
|
$new_money_count = $PromoteCount->field("promote_id,promote_account,sum(pay_money_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
$new_money_count = $PromoteCount->field("promote_id,promote_account,sum(pay_money_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$old_money_count = $PromoteCount->field("promote_id,promote_account,sum(pay_money_count) cg")->where("`date` {$endtime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
@ -527,7 +547,7 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$map = ["puid"=>0,"fgame_id"=>["gt",0]];//0不是小号
|
|
|
|
|
$new_user_count = M("User","tab_")->field('COUNT(1) AS cg,fgame_id game_id,fgame_name game_name')->where($map)->where("register_time {$starttime}")->group("fgame_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}else{
|
|
|
|
|
$new_user_count = $GameCount->field("game_id,game_name,sum(new_user_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
$new_user_count = $GameCount->field("game_id,game_name,sum(new_user_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}
|
|
|
|
|
$old_user_count = $GameCount->field("game_id,game_name,sum(new_user_count) cg")->where("`date` {$endtime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
//2.设置排名
|
|
|
|
@ -539,7 +559,7 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$map = ["game_id"=>["gt",0]];
|
|
|
|
|
$new_active_count = M("user_login_record","tab_")->field('COUNT(DISTINCT user_id) AS cg,game_id,game_name')->where($map)->where("login_time {$starttime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}else{
|
|
|
|
|
$new_active_count = $GameCount->field("game_id,game_name,sum(active_user_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
$new_active_count = $GameCount->field("game_id,game_name,sum(active_user_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
if(count($new_active_count) > 0){
|
|
|
|
|
$listarr = array();
|
|
|
|
|
$promote_id_str = '';
|
|
|
|
@ -577,7 +597,7 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$map = ["pay_status"=>1,"game_id"=>["gt",0]];
|
|
|
|
|
$new_money_count = M("Spend","tab_")->field('sum(pay_amount) AS cg,game_id,game_name')->where($map)->where("pay_time {$starttime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}else{
|
|
|
|
|
$new_money_count = $GameCount->field("game_id,game_name,sum(pay_money_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
$new_money_count = $GameCount->field("game_id,game_name,sum(pay_money_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$old_money_count = $GameCount->field("game_id,game_name,sum(pay_money_count) cg")->where("`date` {$endtime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
|
|
|
|
@ -1005,6 +1025,7 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
}
|
|
|
|
|
return $time;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function total($type) {
|
|
|
|
|
switch ($type) {
|
|
|
|
|
case 1: { // 今天
|
|
|
|
@ -1065,6 +1086,10 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$start = mktime(0,0,0,date('m'),date('d')-29,date('Y'));
|
|
|
|
|
$end=mktime(23,59,59,date('m'),date('d'),date('Y'));
|
|
|
|
|
};break;
|
|
|
|
|
case 11: { // 前天
|
|
|
|
|
$start=mktime(0,0,0,date('m'),date('d')-2,date('Y'));
|
|
|
|
|
$end=mktime(0,0,0,date('m'),date('d')-1,date('Y'))-1;
|
|
|
|
|
};break;
|
|
|
|
|
default:
|
|
|
|
|
$start='';$end='';
|
|
|
|
|
}
|
|
|
|
|