From 2bc1f3c567860ccddcbfe97f2c84669b33d9b34e Mon Sep 17 00:00:00 2001 From: "elf@home" <360197197@qq.com> Date: Mon, 7 Oct 2019 23:44:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/QueryController.class.php | 2 +- Application/Home/Event/UserEvent.class.php | 371 +++++++++--------- .../View/default/Query/arpu_analysis.html | 18 +- .../View/default/Query/userRecharges.html | 22 +- .../Home/View/default/Query/userRoles.html | 6 +- 5 files changed, 211 insertions(+), 208 deletions(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 40298c6f8..3382bdd5b 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1731,7 +1731,7 @@ class QueryController extends BaseController $map['game_id'] = $gameId; } if ($serverId != 0) { - $map['serverId'] = $serverId; + $map['server_id'] = $serverId; } if ($roleName != '') { $map['role_name'] = ['like', '%' . $roleName . '%']; diff --git a/Application/Home/Event/UserEvent.class.php b/Application/Home/Event/UserEvent.class.php index 3bb224364..b645c7480 100644 --- a/Application/Home/Event/UserEvent.class.php +++ b/Application/Home/Event/UserEvent.class.php @@ -721,211 +721,214 @@ class UserEvent extends BaseEvent { public function arpu_analysis() { - if (IS_POST && $_POST['time_start'] && $_POST['time_end']) { - $request = $_REQUEST; - $game_id = $request['game_id']; - $promote_id = $request['promote_id']; - $this->assign('promote_arpu',$promote_id); - $start = strtotime($request['time_start']); - $end = strtotime($request['time_end'])+24*60*60-1; - if ($start>$end) { - $start = $end; - $_REQUEST['time_start'] = $request['time_end']; - $_REQUEST['time_end'] = $request['time_start']; - $end = strtotime($request['time_start']); - } + $promote = M('promote', 'tab_')->where(['id' => session('promote_auth.pid')])->find(); + $map = [ + '_logic' => 'or', + 'id' => $promote['id'], + 'parent_id' => $promote['id'], + 'grand_id' => $promote['id'], + ]; + $ids = M('promote', 'tab_')->where($map)->getField('id', true); + + if (IS_POST && $_POST['time_start'] && $_POST['time_end']) { + $request = $_REQUEST; + $game_id = $request['game_id']; + $promote_id = $request['promote_id']; + $this->assign('promote_arpu', $promote_id); + $start = strtotime($request['time_start']); + $end = strtotime($request['time_end'])+24*60*60-1; + if ($start>$end) { + $start = $end; + $_REQUEST['time_start'] = $request['time_end']; + $_REQUEST['time_end'] = $request['time_start']; + $end = strtotime($request['time_start']); + } - } else { - $game_id = empty($request['game_id'])?0:$request['game_id']; - $promote_id = empty($request['promote_id'])?0:$request['promote_id']; - $start = mktime(0,0,0,date('m'),date('d')-6,date('Y')); - $_REQUEST['time_start'] = date('Y-m-d',$start); - $end = time(); - $_REQUEST['time_end'] = date('Y-m-d'); - } + } else { + $game_id = empty($request['game_id'])?0:$request['game_id']; + $promote_id = empty($request['promote_id'])?0:$request['promote_id']; + $start = mktime(0,0,0,date('m'),date('d')-6,date('Y')); + $_REQUEST['time_start'] = date('Y-m-d',$start); + $end = time(); + $_REQUEST['time_end'] = date('Y-m-d'); + } - //包含绑币 和 排除绑币 - if (I('bind_coin') == 1){ - $bangbi = true; - }else{ - $bangbi = false; - } + //包含绑币 和 排除绑币 + if (I('bind_coin') == 1){ + $bangbi = true; + }else{ + $bangbi = false; + } - if ($end-$start<=7776000 ) { + if ($end - $start <= 7776000 ) { if ($promote_id <1) { - $pid = D('Promote')->get_child_promote(PID,'id'); - if (empty($pid[0])) { - $promote_id = PID; - } else { - $id = implode(',',array_column($pid,'id')); - $promote_id = PID.','.$id; - } + $pid = D('Promote')->get_child_promote(PID,'id'); + if (empty($pid[0])) { + $promote_id = PID; + } else { + $id = implode(',',array_column($pid,'id')); + $promote_id = PID.','.$id; + } } else { + if(PID == $promote_id) { - if(PID == $promote_id) { - - } else { - - - $pro_id1=get_prmoote_chlid_account($promote_id); - $pro_arr = array_column($pro_id1,'id'); - $pro_arr[] = $promote_id; - $promote_id=implode(',',$pro_arr); - } - - - } - $datelist = get_date_list($start,$end); - $user = D('User'); - $spend = D('Spend'); - /*付费游戏数*/ - $paygame = $spend->pay_game_by_time($start,$end,$game_id,$promote_id,$bangbi); - - $newslist = $user->register_list_by_time($start,$end,$game_id,$promote_id,'time',''); - - /* 活跃玩家 */ - $activelist = $user->login_count_by_time($start,$end,$game_id,$promote_id); - - /* 充值金额 */ - $incomelist = $spend -> money_amount_by_time($start,$end,$game_id,$promote_id,$bangbi); - - /* 付费玩家 */ - $paylist = $spend->pay_count_by_time($start,$end,$game_id,$promote_id,$bangbi); - - /* 新付费玩家 */ - $newspay = $spend->pay_count_by_time_class_game($datelist,$game_id,$promote_id,1,$bangbi); - /*新付费金额*/ - $newspaysum = $spend->pay_sum_by_time_class_game($datelist,$game_id,$promote_id,1,$bangbi); - /* 开始时间前的付费玩家 */ - $totalPayPlayer = $spend->payUsersStatisticsAgo($start,$game_id,$promote_id,$bangbi); - - /* 留存 */ - $ratention1 = $user->ratention_rate($newslist,$game_id,$promote_id); - - /* 数据整理 */ - foreach($datelist as $dv) { - $newPayUsers[$dv]=$activeUsers[$dv]=$newUsers[$dv]=$payUsers[$dv]=$usersIncome[$dv]=$ratentionRate1[$dv]=0; - - $data[$dv]['newPayUsers']=$data[$dv]['activeUsers']=$data[$dv]['newUsers']=$data[$dv]['payUsers']=$data[$dv]['usersIncome']=0; - $data[$dv]['totalPayUsers']=intval($totalPayPlayer); - $data[$dv]['ratentionRate1']='--'; - $data[$dv]['usersPayRate'] = '--'; - $data[$dv]['usersArpu']=0; - $data[$dv]['usersArppu']=0; - $data[$dv]['payGame'] = 0; + } else { + $pro_id1 = get_prmoote_chlid_account($promote_id); + $pro_arr = array_column($pro_id1,'id'); + $pro_arr[] = $promote_id; + $promote_id=implode(',',$pro_arr); + } } + $datelist = get_date_list($start,$end); + $user = D('User'); + $spend = D('Spend'); + /*付费游戏数*/ + $paygame = $spend->pay_game_by_time($start,$end,$game_id,$promote_id,$bangbi); + + $newslist = $user->register_list_by_time($start,$end,$game_id,$promote_id,'time',''); + + /* 活跃玩家 */ + $activelist = $user->login_count_by_time($start,$end,$game_id,$promote_id); + + /* 充值金额 */ + $incomelist = $spend -> money_amount_by_time($start,$end,$game_id,$promote_id,$bangbi); + + /* 付费玩家 */ + $paylist = $spend->pay_count_by_time($start,$end,$game_id,$promote_id,$bangbi); + + /* 新付费玩家 */ + $newspay = $spend->pay_count_by_time_class_game($datelist,$game_id,$promote_id,1,$bangbi); + /*新付费金额*/ + $newspaysum = $spend->pay_sum_by_time_class_game($datelist,$game_id,$promote_id,1,$bangbi); + /* 开始时间前的付费玩家 */ + $totalPayPlayer = $spend->payUsersStatisticsAgo($start,$game_id,$promote_id,$bangbi); + + /* 留存 */ + $ratention1 = $user->ratention_rate($newslist,$game_id,$promote_id); + + /* 数据整理 */ + foreach($datelist as $dv) { + $newPayUsers[$dv]=$activeUsers[$dv]=$newUsers[$dv]=$payUsers[$dv]=$usersIncome[$dv]=$ratentionRate1[$dv]=0; + + $data[$dv]['newPayUsers']=$data[$dv]['activeUsers']=$data[$dv]['newUsers']=$data[$dv]['payUsers']=$data[$dv]['usersIncome']=0; + $data[$dv]['totalPayUsers']=intval($totalPayPlayer); + $data[$dv]['ratentionRate1']='--'; + $data[$dv]['usersPayRate'] = '--'; + $data[$dv]['usersArpu']=0; + $data[$dv]['usersArppu']=0; + $data[$dv]['payGame'] = 0; + } - foreach($datelist as $dv) { - /** - * 付费游戏数 - */ - foreach ($paygame as $pgal) { - if($dv == $pgal['pay_time']) { - $paygame[$dv]=intval($pgal['pay_num']); - $data[$dv]['payGame']=intval($pgal['pay_num']);break; - } - } + foreach($datelist as $dv) { + /** + * 付费游戏数 + */ + foreach ($paygame as $pgal) { + if($dv == $pgal['pay_time']) { + $paygame[$dv]=intval($pgal['pay_num']); + $data[$dv]['payGame']=intval($pgal['pay_num']);break; + } + } - /* 新增玩家 */ - foreach ($newslist as $nlv) { - if ($dv == $nlv['time']) { + /* 新增玩家 */ + foreach ($newslist as $nlv) { + if ($dv == $nlv['time']) { - $data[$dv]['newUsers']=count(explode(',',$nlv['id']));break; - } - } - /* 活跃玩家 */ - foreach ($activelist as $alv) { - if ($dv == $alv['time']) { - $activeUsers[$dv]=intval($alv['login_num']); + $data[$dv]['newUsers']=count(explode(',',$nlv['id']));break; + } + } + /* 活跃玩家 */ + foreach ($activelist as $alv) { + if ($dv == $alv['time']) { + $activeUsers[$dv]=intval($alv['login_num']); - $data[$dv]['activeUsers']=intval($alv['login_num']);break; - } - } + $data[$dv]['activeUsers']=intval($alv['login_num']);break; + } + } - /* 充值金额 */ - foreach ($incomelist as $ilv) { - if($ilv['pay_time']==$dv) { - $usersIncome[$dv] = round($ilv['money_amount'],2); - $data[$dv]['usersIncome'] = round($ilv['money_amount'],2); - break; - } - } - /* 付费玩家 */ - foreach ($paylist as $plv) { - if ($plv['pay_time']==$dv) { - $payUsers[$dv]=intval($plv['pay_num']); + /* 充值金额 */ + foreach ($incomelist as $ilv) { + if($ilv['pay_time']==$dv) { + $usersIncome[$dv] = round($ilv['money_amount'],2); + $data[$dv]['usersIncome'] = round($ilv['money_amount'],2); + break; + } + } + /* 付费玩家 */ + foreach ($paylist as $plv) { + if ($plv['pay_time']==$dv) { + $payUsers[$dv]=intval($plv['pay_num']); - $data[$dv]['payUsers']=intval($plv['pay_num']);break; - } - } - /* 1日留存 */ - foreach ($ratention1 as $r1) { - if ($r1['play_time'] == $dv) { - $rate = str_replace('.00','',$r1['retention_rate1']); - $data[$dv]['ratentionRate1']=$rate.'%';break; - } - } - /* 新付费玩家 */ - foreach ($newspay as $npv) { - if ($npv['pay_time'] == $dv) { - $totalPayPlayer = $totalPayPlayer+intval($npv['pay_num']); + $data[$dv]['payUsers']=intval($plv['pay_num']);break; + } + } + /* 1日留存 */ + foreach ($ratention1 as $r1) { + if ($r1['play_time'] == $dv) { + $rate = str_replace('.00','',$r1['retention_rate1']); + $data[$dv]['ratentionRate1']=$rate.'%';break; + } + } + /* 新付费玩家 */ + foreach ($newspay as $npv) { + if ($npv['pay_time'] == $dv) { + $totalPayPlayer = $totalPayPlayer+intval($npv['pay_num']); - $data[$dv]['newPayUsers']=intval($npv['pay_num']); - $data[$dv]['totalPayUsers']=intval($totalPayPlayer); - break; - } else { + $data[$dv]['newPayUsers']=intval($npv['pay_num']); + $data[$dv]['totalPayUsers']=intval($totalPayPlayer); + break; + } else { - $data[$dv]['totalPayUsers']=intval($totalPayPlayer); - } - } - /*新付费金额*/ - foreach ($newspaysum as $nspv) { - if ($nspv['pay_time'] == $dv) { - $data[$dv]['newPaySum']=round($nspv['pay_sum'],2); - break; - } - } - } - foreach ($activeUsers as $k1=>$ap) { - /* 付费率=付费玩家/活跃玩家 */ - foreach ($payUsers as $k2 => $pp) { - if ($k1 === $k2 && $ap>0 && $pp>0) { - $payrate = sprintf("%.2f",$pp/$ap*100); - $data[$k1]['usersPayRate']=str_replace('.00','',$payrate).'%'; - break; - } elseif ($k1 === $k2) { - } + $data[$dv]['totalPayUsers']=intval($totalPayPlayer); + } + } + /*新付费金额*/ + foreach ($newspaysum as $nspv) { + if ($nspv['pay_time'] == $dv) { + $data[$dv]['newPaySum']=round($nspv['pay_sum'],2); + break; + } + } } - /* ARPU=当日总充值数/活跃玩家数 */ - foreach ($usersIncome as $k2 => $ns) { - if ($k1 === $k2 && $ap>0 && $ns>0) { - $data[$k1]['usersArpu']=$ns/$ap;//str_replace('.00','',$ui); - break; - } elseif ($k1 === $k2) { - } + foreach ($activeUsers as $k1=>$ap) { + /* 付费率=付费玩家/活跃玩家 */ + foreach ($payUsers as $k2 => $pp) { + if ($k1 === $k2 && $ap>0 && $pp>0) { + $payrate = sprintf("%.2f",$pp/$ap*100); + $data[$k1]['usersPayRate']=str_replace('.00','',$payrate).'%'; + break; + } elseif ($k1 === $k2) { + } + } + /* ARPU=当日总充值数/活跃玩家数 */ + foreach ($usersIncome as $k2 => $ns) { + if ($k1 === $k2 && $ap>0 && $ns>0) { + $data[$k1]['usersArpu']=$ns/$ap;//str_replace('.00','',$ui); + break; + } elseif ($k1 === $k2) { + } + } } - } - foreach ($usersIncome as $k1 => $ns) { - /* ARPPU=当日总充值/付费玩家数 */ - foreach ($payUsers as $k2 => $pp) { - if ($k1 === $k2 && $pp>0 && $ns>0) { - $data[$k1]['usersArppu']=$ns/$pp;//sprintf("%d",$ns/$pp); - break; - } elseif ($k1 === $k2) { - } - } - } - - } else { - $this->assign('timeout',1); - } + foreach ($usersIncome as $k1 => $ns) { + /* ARPPU=当日总充值/付费玩家数 */ + foreach ($payUsers as $k2 => $pp) { + if ($k1 === $k2 && $pp>0 && $ns>0) { + $data[$k1]['usersArppu']=$ns/$pp;//sprintf("%d",$ns/$pp); + break; + } elseif ($k1 === $k2) { + } + } + } - //file_put_contents(dirname(__FILE__) . '/../Controller/arpu'.PID.'.txt',json_encode($data)); + } else { + $this->assign('timeout',1); + } - $this->assign('list_data',$data); + //file_put_contents(dirname(__FILE__) . '/../Controller/arpu'.PID.'.txt',json_encode($data)); - $this->display(); + $this->assign('list_data',$data); + $this->display(); } diff --git a/Application/Home/View/default/Query/arpu_analysis.html b/Application/Home/View/default/Query/arpu_analysis.html index ba9b4f95f..da3920b2c 100644 --- a/Application/Home/View/default/Query/arpu_analysis.html +++ b/Application/Home/View/default/Query/arpu_analysis.html @@ -112,15 +112,15 @@
- - - + + +
diff --git a/Application/Home/View/default/Query/userRecharges.html b/Application/Home/View/default/Query/userRecharges.html index c537a8270..2089d42bf 100644 --- a/Application/Home/View/default/Query/userRecharges.html +++ b/Application/Home/View/default/Query/userRecharges.html @@ -28,7 +28,7 @@
@@ -47,22 +47,22 @@ - +
- + + +
- +
- + + +
diff --git a/Application/Home/View/default/Query/userRoles.html b/Application/Home/View/default/Query/userRoles.html index 6305a1965..2761b20a5 100644 --- a/Application/Home/View/default/Query/userRoles.html +++ b/Application/Home/View/default/Query/userRoles.html @@ -28,7 +28,7 @@ @@ -58,7 +58,7 @@ @@ -68,7 +68,7 @@