修改内容

master
elf@home 5 years ago
parent 0fbfd868bc
commit 2bc1f3c567

@ -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 . '%'];

@ -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();
}

@ -112,15 +112,15 @@
</div>
<div class="form-group normal_space fr">
<label class="form-title select-title">推广员账号:</label>
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:170px;">
<option game-id="0" value="0">推广员账号</option>
<option game-id="{:session('promote_auth.pid')}" value="{:session('promote_auth.pid')}">自己</option>
<volist name=":get_promote_chlid_account(PID)" id="vo">
<option game-id="{$vo.id}" value="{$vo.id}">{$vo.account}</option>
</volist>
</select>
<input type="hidden" id="promote_account" name="promote_account" value='{:I("promote_account")}'>
<label class="form-title select-title">推广员账号:</label>
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:170px;">
<option game-id="0" value="0">推广员账号</option>
<option game-id="{:session('promote_auth.pid')}" value="{:session('promote_auth.pid')}">自己</option>
<volist name=":get_promote_chlid_account(PID)" id="vo">
<option game-id="{$vo.id}" value="{$vo.id}">{$vo.account}</option>
</volist>
</select>
<input type="hidden" id="promote_account" name="promote_account" value='{:I("promote_account")}'>
</div>
<div class="form-group normal_space fr">
<label class="form-title select-title">游戏名称:</label>

@ -28,7 +28,7 @@
<select id="game-select" name="game_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option>
<volist name="games" id="game">
<option value="{$game.game_id}" <if condition="I('game_id') === $game['id']">selected</if>>{$game.game_name}</option>
<option value="{$game.game_id}" <if condition="I('game_id') === $game['game_id']">selected</if>>{$game.game_name}</option>
</volist>
</select>
</div>
@ -47,22 +47,22 @@
<option value="2" <if condition="I('sdk_version') === '2'">selected</if>>IOS</option>
</select>
</div>
<if condition="$grand_id eq 0">
<if condition="$parent_id eq 0">
<div class="form-group normal_space">
<select id="group-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广员</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
<select id="group-select" name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('headman_promote_id') == $promote['id']">selected</if>>{$promote.account}</option>
</volist>
</select>
</div>
</if>
<if condition="$parent_id eq 0">
<if condition="$grand_id eq 0">
<div class="form-group normal_space">
<select id="promote-select" name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广员</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}</option>
</volist>
</select>
</div>

@ -28,7 +28,7 @@
<select id="game-select" name="game_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option>
<volist name="games" id="game">
<option value="{$game.game_id}" <if condition="I('game_id') === $game['id']">selected</if>>{$game.game_name}</option>
<option value="{$game.game_id}" <if condition="I('game_id') eq $game['game_id']">selected</if>>{$game.game_name}</option>
</volist>
</select>
</div>
@ -58,7 +58,7 @@
<select id="group-select" name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') === $promote['id']">selected</if>>{$promote.account}</option>
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('headman_promote_id') == $promote['id']">selected</if>>{$promote.account}</option>
</volist>
</select>
</div>
@ -68,7 +68,7 @@
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广员</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') === $promote['id']">selected</if>>{$promote.account}</option>
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}</option>
</volist>
</select>
</div>

Loading…
Cancel
Save