master
elf@home 5 years ago
parent d3412cc3ce
commit cda67249ac

@ -8,6 +8,21 @@ class SpendRepository {
}
private function assembleDayRecords($items, $dayList, $valueColumn, $dayColumn = 'day')
{
$records = [];
foreach ($dayList as $day) {
$dayValue = 0;
foreach ($items as $item) {
if ($item[$dayColumn] == $day) {
$dayValue = $item[$valueColumn];
}
}
$records[$day] = $dayValue;
}
return $records;
}
/**
* 付费游戏数
*/
@ -18,6 +33,7 @@ class SpendRepository {
$serverId = $params['server_id'] ?? 0;
$ids = $params['promote_id'] ?? [];
$isBan = $params['is_ban'] ?? false;
$dayList = $params['dayList'] ?? [];
$map = [];
$map['pay_status'] = 1;
@ -26,12 +42,14 @@ class SpendRepository {
$map['game_id'] = $gameId > 0 ? $gameId : ['gt', 0];
$map['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time, game_id';
$subTable = M('spend', 'tab_')->field($field)->where($map)->group('pay_time')->select(false);
$data = M()->field('a.pay_time, count(DISTINCT a.game_id) as pay_num')->table('(' . $subTable . ') as a')->group('a.pay_time')->select();
return $data;
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as day, count(DISTINCT game_id) count';
$items = M('spend', 'tab_')->field($field)->where($map)->group('day')->select();
return $this->assembleDayRecords($items, $dayList, 'count');
}
/**
* 按天统计付款总额
*/
public function getPayAmountByDay($params) {
$beginTime = $params['begin_time'] ?? 0;
$endTime = $params['end_time'] ?? 0;
@ -39,6 +57,7 @@ class SpendRepository {
$serverId = $params['server_id'] ?? 0;
$ids = $params['promote_id'] ?? [];
$isBan = $params['is_ban'] ?? false;
$dayList = $params['dayList'] ?? [];
$map['pay_status'] = 1;
$map['pay_time'] = ['between', [$beginTime, $endTime]];
@ -46,12 +65,14 @@ class SpendRepository {
$map['promote_id'] = ['in', $ids];
$map['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time,sum(pay_amount) as money_amount';
$data = M('spend', 'tab_')->field($field)->where($map)->group('FROM_UNIXTIME(pay_time,"%Y-%m-%d")')->select();
return $data;
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as day,sum(pay_amount) as amount';
$items = M('spend', 'tab_')->field($field)->where($map)->group('FROM_UNIXTIME(day, "%Y-%m-%d")')->select();
return $this->assembleDayRecords($items, $dayList, 'amount');
}
/**
* 按天统计付款用户数
*/
public function getPayUserCountByDay($params) {
$beginTime = $params['begin_time'] ?? 0;
$endTime = $params['end_time'] ?? 0;
@ -59,6 +80,7 @@ class SpendRepository {
$serverId = $params['server_id'] ?? 0;
$ids = $params['promote_id'] ?? [];
$isBan = $params['is_ban'] ?? false;
$dayList = $params['dayList'] ?? [];
$map['pay_status'] = 1;
$map['pay_time'] = ['between', [$beginTime, $endTime]];
@ -66,12 +88,10 @@ class SpendRepository {
$map['promote_id'] = ['in', $ids];
$map['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time,user_id as pay_num';
$subTable = M('spend', 'tab_')->field($field)->where($map)->group('pay_time')->buildSql();
return M('spend', 'tab_')->field('a.pay_time,count(distinct a.pay_num) as pay_num')->table('(' . $subTable . ') as a')->group('a.pay_time')->select();
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as day, count(distinct user_id) count';
$items = M('spend', 'tab_')->field($field)->where($map)->group('day')->select();
return $this->assembleDayRecords($items, $dayList, 'count');
}
/**
@ -100,7 +120,7 @@ class SpendRepository {
foreach ($dayList as $day) {
$time = strtotime($day);
$oldMap['pay_time'] = ['lt', $time];
$map['pay_time'] = ['between', $time, ($time + 24 * 3600 -1)];
$map['pay_time'] = ['between', [$time, ($time + 24 * 3600 -1)]];
$oldQuery = M('spend', 'tab_')->field('user_id')->where($oldMap)->group('user_id')->buildSql();
$map['user_id'] = ['exp', ' not in (' . $oldQuery . ')'];
$result = M('spend', 'tab_')->field('count(distinct user_id) count')->where($map)->find();
@ -110,7 +130,7 @@ class SpendRepository {
}
/**
* 按照时间分组统计新增付费用户
* 按照时间分组统计新增付费用户付费金额
*/
public function getNewPayAmountByDay($params) {
$dayList = $params['dayList'] ?? [];
@ -135,74 +155,44 @@ class SpendRepository {
foreach ($dayList as $day) {
$time = strtotime($day);
$oldMap['pay_time'] = ['lt', $time];
$map['pay_time'] = ['between', $time, ($time + 24 * 3600 -1)];
$map['pay_time'] = ['between', [$time, ($time + 24 * 3600 -1)]];
$oldQuery = M('spend', 'tab_')->field('user_id')->where($oldMap)->group('user_id')->buildSql();
$map['user_id'] = ['exp', ' not in (' . $oldQuery . ')'];
$result = M('spend', 'tab_')->field('sum(pay_amount) amount')->where($map)->find();
$records[$day] = $result['amount'];
$records[$day] = floatval($result['amount']);
}
return $records;
}
/**
* 按照时间分组统计付费玩家付费数(新付费用户指用户第一次付费)
* @param array $daylist 时间序列
* @param integer $game_id 游戏编号
* @param integer/string $promote_id 渠道编号或渠道编号列表字符串(字符串逗号分隔)
* @param integer $flag 类别1新玩家2老玩家
* @return array 详细数据
* @author 鹿文学
*/
public function pay_sum_by_time_class_game($daylist,$game_id=0,$promote_id=0,$flag=1,$bangbi=true) {
$map['pay_status']=1;
$oldmap['game_id'] = $map['game_id'] = $game_id>0?$game_id:array('gt',0);
$map['promote_id'] = is_numeric($promote_id)?$promote_id:array('in',$promote_id);
$map['pay_way'] = $bangbi ? array('neq','-10') : array('neq',-1);
if ($flag == 1) {$str='user_id not in ';$map['_string']='(small_id=0 or small_id=user_id)';} else {$str = 'user_id in';}
foreach ($daylist as $value) {
$time = strtotime($value);
$oldmap['pay_time'] = array('lt',$time);
$old_sdk_id=$this->field('user_id')
->where($oldmap)->group('user_id')
->buildSql();
$map['pay_time'] = array(array('egt',$time),array('elt',strtotime("+1 day",$time)-1));
$map['_string'] = $map['_string']?($map['_string'].' and '.$str.$old_sdk_id):($str.$old_sdk_id);
$sql=$this
->field('user_id,pay_amount,FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time')
->where($map)
->buildSql();
$d = $this->query('select sum(a.pay_amount) as pay_sum, a.pay_time as pay_time from '.$sql.' as a group by pay_time');
if ($d)
$data[]=$d[0];
}
return $data;
}
/**
* 统计给定时间前的付费玩家总数
* @param integer $start 开始时间(时间戳)
* @param integer $game_id 游戏编号
* @param integer/string $promote_id 渠道编号或渠道编号列表字符串(字符串逗号分隔)
* @return integer 结果
* @author 鹿文学
*/
public function payUsersStatisticsAgo($start,$game_id,$promote_id,$bangbi=true) {
public function getHistoryPayCountByDay($params) {
$dayList = $params['dayList'] ?? [];
$gameId = $params['game_id'] ?? 0;
$serverId = $params['server_id'] ?? 0;
$ids = $params['promote_id'] ?? [];
$isBan = $params['is_ban'] ?? false;
$map = [];
$map['pay_status']=1;
if ($gameId > 0) {
$map['game_id'] = $gameId;
}
if ($serverId > 0) {
$map['server_id'] = $serverId;
}
$map['promote_id'] = ['in', $ids];
$map['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
$map['pay_time'] = array('lt',$start);
$map['game_id'] = $game_id>0?$game_id:array('gt',0);
$map['promote_id'] = is_numeric($promote_id)?$promote_id:array('in',$promote_id);
$map['pay_way'] = $bangbi ? array('neq','-10') : array('neq',-1);
$data = $this->field('count(DISTINCT user_id) as user_id')->where($map)->select();
return $data[0]['user_id']?$data[0]['user_id']:0;
$records = [];
foreach ($dayList as $day) {
$time = strtotime($day);
$map['pay_time'] = ['elt', $time];
$result = M('spend', 'tab_')->field('count(DISTINCT user_id) as count')->where($map)->find();
$records[$day] = $result['count'];
}
return $records;
}
}

@ -8,6 +8,21 @@ class UserRepository {
}
private function assembleDayRecords($items, $dayList, $valueColumn, $dayColumn = 'day')
{
$records = [];
foreach ($dayList as $day) {
$dayValue = 0;
foreach ($items as $item) {
if ($item[$dayColumn] == $day) {
$dayValue = $item[$valueColumn];
}
}
$records[$day] = $dayValue;
}
return $records;
}
/**
* 按照时间分组统计登录总数
*/
@ -17,6 +32,7 @@ class UserRepository {
$gameId = $params['game_id'] ?? 0;
$serverId = $params['server_id'] ?? 0;
$ids = $params['promote_id'] ?? [];
$dayList = $params['dayList'] ?? [];
$map = [];
$map['login_time'] = ['between', [$beginTime, $endTime]];
@ -29,20 +45,24 @@ class UserRepository {
}
$map['promote_id'] = ['in', $ids];
$records = M('user_login_record', 'tab_')->field('FROM_UNIXTIME(login_time, "%Y-%m-%d") as time, count(DISTINCT user_id) as count')
$items = M('user_login_record', 'tab_')->field('FROM_UNIXTIME(login_time, "%Y-%m-%d") as day, count(DISTINCT user_id) as count')
->where($map)
->group('time')
->group('day')
->select();
return $records;
return $this->assembleDayRecords($items, $dayList, 'count');
}
/**
* 按照时间分组统计注册总数
*/
public function getRegisterCountByDay($params) {
$beginTime = $params['begin_time'] ?? 0;
$endTime = $params['end_time'] ?? 0;
$gameId = $params['game_id'] ?? 0;
$serverId = $params['server_id'] ?? 0;
$ids = $params['promote_id'] ?? [];
$dayList = $params['dayList'] ?? [];
$dateform = '%Y-%m-%d';
@ -56,13 +76,11 @@ class UserRepository {
$map['promote_id'] = ['in', $ids];
$map['puid'] = 0;
$records = M('user', 'tab_')->field('group_concat(id) as id,FROM_UNIXTIME(register_time,"'.$dateform.'") as time')
$items = M('user', 'tab_')->field('count(*) count, FROM_UNIXTIME(register_time,"'.$dateform.'") as day')
->where($map)
->group('time')
->group('day')
->select();
return $records;
return $this->assembleDayRecords($items, $dayList, 'count');
}
/**

@ -629,10 +629,26 @@ class QueryController extends BaseController
}
}
private function getDayList($beginTime, $endTime)
{
$dayList = [];
do {
$dayList[] = date('Y-m-d', $beginTime);
$beginTime += 24*60*60;
} while($beginTime < $endTime);
return $dayList;
}
public function arpu_analysis()
public function arpu()
{
$this->meta_title = "ARPU统计";
$this->meta_title = 'ARPU统计';
$defaultTime = date('Y-m-d', time() - 7*24*3600) . ' 至 ' . date('Y-m-d');
$time = I('time', $defaultTime);
$sdkVersion = I('sdk_version', 0);
$gameId = I('game_id', 0);
$serverId = I('server_id', 0);
$promote = $this->getLoginPromote();
$map = [
@ -643,11 +659,6 @@ class QueryController extends BaseController
];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$time = I('time', date('Y-m-d'));
$sdkVersion = I('sdk_version', 0);
$gameId = I('game_id', 0);
$serverId = I('server_id', 0);
$params = [];
if ($gameId > 0) {
$params['game_id'] = $gameId;
@ -663,12 +674,45 @@ class QueryController extends BaseController
$params['begin_time'] = $beginTime;
$params['end_time'] = $endTime;
$dayList = $this->getDayList($beginTime, $endTime);
$params['dayList'] = $dayList;
$userRepository = new UserRepository();
$spendRepository = new SpendRepository();
$payGameCountList = $spendRepository->getPayGameCountByDay($params);
$payUserCountList = $spendRepository->getPayUserCountByDay($params);
$newPayUserCountList = $spendRepository->getNewPayUserCountByDay($params);
$payAmountList = $spendRepository->getPayAmountByDay($params);
$newPayAmountList = $spendRepository->getNewPayAmountByDay($params);
$historyPayCountList = $spendRepository->getHistoryPayCountByDay($params);
$loginCountList = $userRepository->getLoginCountByDay($params);
var_dump($loginCountList);
$registerCountList = $userRepository->getRegisterCountByDay($params);
$records = [];
foreach ($dayList as $day) {
$records[] = [
'day' => $day,
'payGameCount' => $payGameCountList[$day],
'payUserCount' => $payUserCountList[$day],
'newPayUserCount' => $newPayUserCountList[$day],
'payAmount' => number_format($payAmountList[$day], 2),
'newPayAmount' => number_format($newPayAmountList[$day], 2),
'historyPayCount' => $historyPayCountList[$day],
'loginCount' => $loginCountList[$day],
'registerCount' => $registerCountList[$day],
'payRate' => $loginCountList[$day] == 0 ? '--' : round($payUserCountList[$day]/$loginCountList[$day]*100, 2) . '%',
'ratentionOneDay' => '--',
'arpu' => $loginCountList[$day] == 0 ? '0.00' : number_format(round($payAmount[$day]/$loginCountList[$day], 2), 2),
'arppu' => $payUserCount[$day] == 0 ? '0.00' : number_format(round($payAmount[$day]/$payUserCount[$day], 2), 2),
];
}
$this->assign('records', $records);
$this->display();
}
public function arpu_analysis()
{
$this->meta_title = "ARPU统计";
A('User', 'Event')->arpu_analysis();
}
@ -738,7 +782,7 @@ class QueryController extends BaseController
}
$spend2 = D('Spend');
$data = M('Apply', 'tab_')->field('game_id, game_name')->order('game_id desc')->select();
$data = M('Apply', 'tab_')->field('game_id, game_name')->where(['promote_id' => $promote_id])->order('game_id desc')->select();
foreach ($data as $key => $value) {
$game_id = $value['game_id'];
$map_list['game_id'] = $game_id;

@ -33,11 +33,8 @@
</select>
</div>
<div class="form-group normal_space">
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" >
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" data-server="{:I('server_id', 0)}" >
<option value="0">请选择区服</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
@ -155,25 +152,35 @@ $(function() {
locale: 'zh',
})
$('.select_gallery').select2()
var gameId = $('#game-select').val();
var defaultServerId = $('#server-select').attr('data-server');
getGameServers(gameId, defaultServerId)
$('#game-select').on({
change: function name() {
var gameId = $('#game-select').val()
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
success: function(response) {
$("#server-select").val(0).trigger("change")
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
options += '<option value="' + server.id + '">' + server.server_name + '</option>'
}
$('#server-select').html(options)
}
})
gameId = $('#game-select').val()
getGameServers(gameId, 0)
}
})
function getGameServers(gameId, defaultServerId) {
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
success: function(response) {
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
var selected = ''
if (defaultServerId > 0 && server.id==defaultServerId) {
selected = 'selected'
}
options += '<option value="' + server.id + '"' + selected + '>' + server.server_name + '</option>'
}
$('#server-select').html(options)
$("#server-select").val(defaultServerId).trigger("change")
}
})
}
})
</script>
</block>

@ -0,0 +1,447 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<style type="text/css">
.keywords_information {margin-left:15px;cursor:pointer;}
.keywords_information .keywords_mark {height:35px;line-height:35px;color:#4A90F0;}
.keywords_information .keywords_mark span{border-bottom:1px solid transparent;}
.keywords_information .keywords_mark:hover span {border-bottom-color:#4A90F0;}
.keywords_information .keywords_content {transition:opacity 1.2s,visibility 1.5s;}
.keywords_information .keywords_content:before {margin-left:41px;}
.keywords_information .keywords_content .keywords_close {position:absolute;right:0;top:0;width:25px;height:40px;line-height:35px;color:#515974;}
.keywords_information .keywords_list span:first-child {width:160px;}
.keywords_information .keywords_list span:last-child {width:228px;}
.keywords_information {position:relative;display:inline-block;}
.keywords_information .keywords_mark {display:block;font-size:12px;font-style:normal;font-weight:normal; }
.keywords_information .keywords_content.active {visibility:visible;opacity:1;transition:visibility 1.5s,opacity 1s;}
.keywords_information .keywords_content {visibility:hidden;opacity:0;
position:absolute;width:435px;z-index:10;background:#fff;border-radius:5px;
border: 1px solid #E7ECEF;
box-shadow: 1px 1px 15px rgba(0,0,0,.1);
top:10px;left:72px;
}
.keywords_information .keywords_title {
height:40px;line-height:40px;background-color:#FAFAFA;
border-top-left-radius:5px;border-top-right-radius:5px;color:#515974;
padding-left:10px;font-size:12px;
}
.keywords_information .keywords_list {overflow:hidden;clear:both;padding:5px;margin:0 8px;font-size:10px;border-bottom:1px solid #EBEEF5;}
.keywords_information .keywords_list:last-child {border-bottom:none;}
.keywords_information .keywords_list span {display:inline-block;display: block;font-weight: normal;color: #515974;
float: left;
line-height: 30px;
width: 420px;}
.keywords_information .keywords_list span:last-child{color: #a5a6bb;}
.keywords_information .keywords_list span:first-child {width:160px;margin-right:20px;}
.chakan{
font-size: 14px;
font-weight: normal;
color: #26C7DB;
cursor: pointer;
display: inline-block;
text-align: center;
}
.chakan:hover{color: #2bd8ed;}
.trunk-list{position: relative;min-height: 66vh;}
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 180px;
height: 34px;
}
</style>
</block>
<block name="body">
<div class="page-search normal_list query-recharge-search">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>数据管理></span><span>ARPU统计</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_ARPU.png">
<span class="title_main">ARPU统计</span>
<span class="details">根据日期游戏推广员分析ARPU等相关数据信息排除绑币</span>
<div class="keywords_information" style="clear: both;">
<i class="keywords_mark"><span>关键词说明</span></i>
<ul class="keywords_content">
<li class="keywords_title">关键词说明<a href="javascript:;" class="keywords_close"><img src="__IMG__/20180207/btn_normal_close.png"/></a></li>
<li class="keywords_list">
<span class="">活跃用户</span>
<span class="">当天登录的用户总数</span>
</li>
<li class="keywords_list">
<span class="">付费用户</span>
<span class="">当天付费的用户数量</span>
</li>
<li class="keywords_list">
<span class="">新增付费用户</span>
<span class="">当天付费用户中第一次付费的用户数</span>
</li>
<li class="keywords_list">
<span class="">新增付费额</span>
<span class="">第一次付费的玩家当天充值总额</span>
</li>
<li class="keywords_list">
<span class="">付费率</span>
<span class="">付费用户/活跃用户</span>
</li>
<li class="keywords_list">
<span class="">ARPU(每用户平均付费)</span>
<span class="">当日总充值/活跃用户数</span>
</li>
<li class="keywords_list">
<span class="">ARPPU(付费用户的平均付费)</span>
<span class="">当日总充值/付费用户数</span>
</li>
</ul>
</div>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<form action="{:U('Query/arpu_analysis',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<div class="form-group normal_space">
<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') eq $game['game_id']">selected</if>>{$game.game_name}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择区服</option>
</select>
</div>
<div class="form-group normal_space">
<select name="sdk_version" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择设备类型</option>
<option value="1" <if condition="I('sdk_version') === '1'">selected</if>>Andriod</option>
<option value="2" <if condition="I('sdk_version') === '2'">selected</if>>IOS</option>
</select>
</div>
<div class="form-group normal_space">
<select name="status" class="reselect select_gallery" style="width: 220px;" >
<option value="0">帐号状态</option>
<option value="1" <if condition="I('status') === '1'">selected</if>>正常</option>
<option value="2" <if condition="I('status') === '2'">selected</if>>冻结</option>
</select>
</div>
<if condition="$parent_id eq 0">
<div class="form-group normal_space">
<select name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option>
<volist name="subPromotes" 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>
</if>
<if condition="$parent_id gt 0 and $grand_id eq 0">
<div class="form-group normal_space">
<select name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广员</option>
<volist name="subPromotes" 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>
</if>
<div class="form-group normal_space">
<label>起止时间:</label>
<input type="text" class="txt range-date" name="time" placeholder="起止时间" value="{:I('time')}" >
</div>
<div class="form-group">
<input type="submit" class="submit normal_space" value="查询">
</div>
</form>
</div>
</div>
<div class="page-list query-recharge-list">
<div class="trunk-content article">
<div class="trunk-list">
<table class="table normal_table" id="datacontent">
<table class="table normal_table" id="datatable" style="<notempty name='list_data'>display:none;</notempty>"><thead>
<tr class="odd">
<th>日期</th>
<if condition='empty(I("game_id")) != true'>
<th>游戏名称</th>
<else/>
<th>付费游戏数</th>
</if>
<if condition='empty(I("promote_id")) != true'>
<th>所属渠道</th>
</if>
<th>活跃用户</th>
<th>新增用户</th>
<th>付费用户</th>
<th>新增付费用户</th>
<th>付费总额</th>
<th>付费率</th>
<th>新增付费额</th>
<th>累计付费用户</th>
<th>1日留存</th>
<th>ARPU</th>
<th>ARPPU</th>
<if condition='empty(I("game_id")) == true'>
<th>详情</th>
</if>
</tr></thead><tbody>
<empty name="records">
<tr><td colspan="12" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
<else />
<volist name="records" id="vo" mod="2">
<tr name="rows" class="<eq name='mod' value='1'>odd</eq>">
<td>{$vo.day}</td>
<if condition='empty(I("game_id")) != true'>
<th>{:I("game_name")}</th>
<else/>
<td>{$vo.payGameCount}</th>
</if>
<if condition='empty(I("promote_id")) != true'>
<th>{:I("promote_account")}</th>
</if>
<td>{$vo.loginCount}</td>
<td>{$vo.registerCount}</td>
<td>{$vo.payUserCount}</td>
<td>{$vo.newPayUserCount}</td>
<td>{$vo.payAmount}</td>
<td>{$vo.payRate}</td>
<td>{$vo.newPayAmount}</td>
<td>{$vo.historyPayCount}</td>
<td>{$vo.ratentionOneDay}</td>
<td>{$vo.arpu}</td>
<td>{$vo.arppu}</td>
<if condition='empty(I("game_id")) == true'>
<td>
<a onclick="chakan('{$key}')" style="cursor: pointer" class="chakan">查看</a>
</td>
</if>
</tr>
</volist>
</empty></tbody>
</table>
</table>
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript" src="__JS__/20170831/pagination.js"></script>
<script type="text/javascript" src="__JS__/20170831/string.js"></script>
<script type="text/javascript" src="__JS__/20170831/tabpage.js"></script>
<eq name='timeout' value='1'>
<script>
layer.msg('时间间隔不能超过90天');
</script>
</eq>
<script>
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
})
var gameId = $('#game-select').val();
var defaultServerId = $('#server-select').attr('data-server');
getGameServers(gameId, defaultServerId)
$('#game-select').on({
change: function name() {
gameId = $('#game-select').val()
getGameServers(gameId, 0)
}
})
function getGameServers(gameId, defaultServerId) {
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
success: function(response) {
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
var selected = ''
if (defaultServerId > 0 && server.id==defaultServerId) {
selected = 'selected'
}
options += '<option value="' + server.id + '"' + selected + '>' + server.server_name + '</option>'
}
$('#server-select').html(options)
$("#server-select").val(defaultServerId).trigger("change")
}
})
}
var parentId = $('#group-select').val();
var defaultPromoteId = $('#promote-select').attr('data-promote');
getSubPromotes(parentId, defaultPromoteId)
$('#group-select').on({
change: function name() {
parentId = $('#group-select').val()
getSubPromotes(parentId, 0)
}
})
function getSubPromotes(parentId, defaultPromoteId) {
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: parentId},
success: function(response) {
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
var selected = ''
if (defaultPromoteId > 0 && promote.id==defaultPromoteId) {
selected = 'selected'
}
options += '<option value="' + promote.id + '"' + selected + '>' + promote.account + '</option>'
}
$('#promote-select').html(options)
$("#promote-select").val(defaultPromoteId).trigger("change")
}
})
}
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
})
layer.config({
extend: 'skin/myskin/style.css', //同样需要加载新皮肤
});
function chakan(key) {
var bangbi = $('#bangbi').val();
var promote_id = $('#promote_arpu').val();
url = "/index.php?s=/Home/Query/cha_userarpu/time/"+key+"/bangbi/"+bangbi+"/promote_id/"+promote_id;
timetitle = key;
console.log(url);
layer.open({
type: 2,
title: false,
closeBtn: 0, //不显示关闭按钮
shade: [0],
area: ['1px', '1px'],
offset: 'rb', //右下角弹出
time: 1, // 秒后自动关闭 这里设置成1ms 不显示过度页面
anim: 2,
content: ['', 'no'], //iframe的urlno代表不显示滚动条
end: function () { //
layer.open({
type: 2,
title: timetitle + '游戏数据',
skin: 'myskin', //只对该层采用myskin皮肤
shadeClose: true,
shade: [0.3,'#273142'],
scrollbar :false,
maxmin: true, //开启最大化最小化按钮
area: ['70%', '50%'],
content: url//iframe的url
});
}
});
}
</script>
<script type="text/javascript">
setValue('promote_id',{$Think.request.promote_id|default=0});
setValue('game_id','{$Think.request.game_id|default=0}');
function pagechange(that){
tablePage('datatable', 'datacontent', 'pagenation', [1, 2, 4, 5, 6, 10], false,that.value);
var export_data = $('#export_data');
var url = export_data.attr('href');
url = url.replace('.html','').replace(/(&|\/)row(=|\/)\d*/gi,'').replace(/\/p\/\d*/gi,'');
export_data.attr('href',url+'/row/'+that.value);
}
function pagenation_click() {
$('#pagenation a').click(function() {
var that = $(this),p = that.text();console.log(p);
var export_data = $('#export_data');
var url = export_data.attr('href');
url = url.replace('.html','').replace(/(&|\/)row(=|\/)\d*/gi,'').replace(/\/p\/\d*/gi,'');
export_data.attr('href',url+'/p/'+p+'/row/'+that.value);
return false;
});
}
$().ready(function(){
$("#pagehtml a").on("click",function(event){
event.preventDefault();//使a自带的方法失效即无法调整到href中的URL(http://www.baidu.com)
var geturl = $(this).attr('href');
$('#data_form').attr('action',geturl);
$('#data_form').submit();
});
pagenation_click();
$(".submit").click(function(){
var sdate =$('#sdate').val();
var edate =$('#edate').val();
if(Date.parse(sdate) > Date.parse(edate)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
})
$(".select_gallery").select2();
tablePage('datatable', 'datacontent', 'pagenation', [1, 2, 4, 5, 6, 10], false);
$('.keywords_information .keywords_mark').click(function() {
var that = $(this).siblings().addClass('active');
console.log(that);
$(document).click(function(event) {
var e = event || window.event;
var target= $(e.target);
if (!target.hasClass('keywords_information') && target.closest('.keywords_information').length<1) {
that.removeClass('active');
}
});
that.find('.keywords_close').click(function() {
that.removeClass('active');
return false;
});
return false;
});
$("#game_id").change(function(){
var game_name = $('#game_id option:selected').text();
$("#game_name").val(game_name);
});
$("#promote_id").change(function(){
var account = $('#promote_id option:selected').text();
$("#promote_account").val(account);
})
});
</script>
</block>

@ -119,9 +119,6 @@
<div class="form-group normal_space">
<select id="server-select" name="server_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>
</volist>
</select>
</div>
<div class="form-group normal_space">

@ -33,11 +33,8 @@
</select>
</div>
<div class="form-group normal_space">
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" >
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" data-server="{:I('server_id', 0)}">
<option value="0">请选择区服</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
@ -59,7 +56,7 @@
</if>
<if condition="$grand_id eq 0">
<div class="form-group normal_space">
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" data-promote="{:I('promote_id', 0)}">
<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>
@ -86,7 +83,7 @@
<input type="submit" class="submit" value="查询">
</div>
<div class="form-group normal_space">
<label><input name="is_self" value="1" type="checkbox"> 本账号推广</label>
<label><input name="is_self" value="1" <if condition="I('is_self') == 1">checked</if> type="checkbox"> 本账号推广</label>
</div>
</form>
</div>
@ -130,11 +127,7 @@
</div>
<div class="pagenation clearfix">
<a class="sch-btn" href="{:U('Export/child',array(
'p'=>I('p'),
'account'=>I('account'),'xlsname'=>'管理中心_'.get_pro_grade_name(PRO_GRADE,1),'row'=>I('request.row')
))}" >导出</a>
{$_page}
{$pagination}
</div>
</div>
<div class="page-explain promote-mychlid-explain">
@ -151,44 +144,66 @@
<script type="text/javascript">
$(function(){
$(".select_gallery").select2();
var gameId = $('#game-select').val();
var defaultServerId = $('#server-select').attr('data-server');
getGameServers(gameId, defaultServerId)
$('#game-select').on({
change: function name() {
var gameId = $('#game-select').val()
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
success: function(response) {
$("#server-select").val(0).trigger("change")
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
options += '<option value="' + server.id + '">' + server.server_name + '</option>'
}
$('#server-select').html(options)
}
})
gameId = $('#game-select').val()
getGameServers(gameId, 0)
}
})
$('#group-select').on({
change: function name() {
var groupId = $('#group-select').val()
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: groupId},
success: function(response) {
$("#promote-select").val(0).trigger("change")
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
options += '<option value="' + promote.id + '">' + promote.account + '</option>'
function getGameServers(gameId, defaultServerId) {
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
success: function(response) {
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
var selected = ''
if (defaultServerId > 0 && server.id==defaultServerId) {
selected = 'selected'
}
$('#promote-select').html(options)
options += '<option value="' + server.id + '"' + selected + '>' + server.server_name + '</option>'
}
})
$('#server-select').html(options)
$("#server-select").val(defaultServerId).trigger("change")
}
})
}
var parentId = $('#group-select').val();
var defaultPromoteId = $('#promote-select').attr('data-promote');
getSubPromotes(parentId, defaultPromoteId)
$('#group-select').on({
change: function name() {
parentId = $('#group-select').val()
getSubPromotes(parentId, 0)
}
})
function getSubPromotes(parentId, defaultPromoteId) {
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: parentId},
success: function(response) {
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
var selected = ''
if (defaultPromoteId > 0 && promote.id==defaultPromoteId) {
selected = 'selected'
}
options += '<option value="' + promote.id + '"' + selected + '>' + promote.account + '</option>'
}
$('#promote-select').html(options)
$("#promote-select").val(defaultPromoteId).trigger("change")
}
})
}
})
</script>
</block>

@ -33,11 +33,8 @@
</select>
</div>
<div class="form-group normal_space">
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" >
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" data-server="{:I('server_id', 0)}">
<option value="0">请选择区服</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
@ -65,7 +62,7 @@
</if>
<if condition="$grand_id eq 0">
<div class="form-group normal_space">
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" data-promote="{:I('promote_id', 0)}">
<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>
@ -87,7 +84,7 @@
<input type="submit" class="submit normal_space" value="查询">
</div>
<div class="form-group normal_space">
<label><input name="is_self" value="1" type="checkbox"> 本账号推广</label>
<label><input name="is_self" value="1" type="checkbox" <if condition="I('is_self') == 1">checked</if>> 本账号推广</label>
</div>
</form>
</div>
@ -123,11 +120,7 @@
</div>
<div class="pagenation clearfix">
<a class="sch-btn" href="{:U('Export/child',array(
'p'=>I('p'),
'account'=>I('account'),'xlsname'=>'管理中心_'.get_pro_grade_name(PRO_GRADE,1),'row'=>I('request.row')
))}" >导出</a>
{$_page}
{$pagination}
</div>
</div>
<div class="page-explain promote-mychlid-explain">
@ -151,44 +144,66 @@ $(function() {
locale: 'zh',
})
$('.select_gallery').select2()
var gameId = $('#game-select').val();
var defaultServerId = $('#server-select').attr('data-server');
getGameServers(gameId, defaultServerId)
$('#game-select').on({
change: function name() {
var gameId = $('#game-select').val()
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
success: function(response) {
$("#server-select").val(0).trigger("change")
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
options += '<option value="' + server.id + '">' + server.server_name + '</option>'
}
$('#server-select').html(options)
}
})
gameId = $('#game-select').val()
getGameServers(gameId, 0)
}
})
$('#group-select').on({
change: function name() {
var groupId = $('#group-select').val()
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: groupId},
success: function(response) {
$("#promote-select").val(0).trigger("change")
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
options += '<option value="' + promote.id + '">' + promote.account + '</option>'
function getGameServers(gameId, defaultServerId) {
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
success: function(response) {
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
var selected = ''
if (defaultServerId > 0 && server.id==defaultServerId) {
selected = 'selected'
}
$('#promote-select').html(options)
options += '<option value="' + server.id + '"' + selected + '>' + server.server_name + '</option>'
}
})
$('#server-select').html(options)
$("#server-select").val(defaultServerId).trigger("change")
}
})
}
var parentId = $('#group-select').val();
var defaultPromoteId = $('#promote-select').attr('data-promote');
getSubPromotes(parentId, defaultPromoteId)
$('#group-select').on({
change: function name() {
parentId = $('#group-select').val()
getSubPromotes(parentId, 0)
}
})
function getSubPromotes(parentId, defaultPromoteId) {
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: parentId},
success: function(response) {
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
var selected = ''
if (defaultPromoteId > 0 && promote.id==defaultPromoteId) {
selected = 'selected'
}
options += '<option value="' + promote.id + '"' + selected + '>' + promote.account + '</option>'
}
$('#promote-select').html(options)
$("#promote-select").val(defaultPromoteId).trigger("change")
}
})
}
})
</script>
</block>
Loading…
Cancel
Save