master
ELF 4 years ago
parent 0aa3c514d7
commit 4f3c21263d

@ -85,7 +85,15 @@ class SpendRepository
$conditions['pay_status'] = 1;
$conditions['promote_id'] = ['in', $ids];
$conditions['pay_time'] = ['between', [$beginTime, $endTime]];
$conditions['game_id'] = $gameId > 0 ? $gameId : ['gt', 0];
if (is_array($gameId)) {
if (count($gameId)) {
$conditions['game_id'] = ['in', $gameId];
}
} else {
if ($gameId > 0) {
$conditions['game_id'] = $gameId;
}
}
if (isset($params['server_id'])) {
$conditions['server_id'] = $serverId;
}

@ -44,8 +44,14 @@ class UserRepository
$conditions = [];
$conditions['promote_id'] = ['in', $ids];
$conditions[$params['time_column']] = ['between', [$beginTime, $endTime]];
if ($gameId > 0) {
$conditions['game_id'] = $gameId;
if (is_array($gameId)) {
if (count($gameId)) {
$conditions['game_id'] = ['in', $gameId];
}
} else {
if ($gameId > 0) {
$conditions['game_id'] = $gameId;
}
}
$conditions['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
@ -180,6 +186,11 @@ class UserRepository
$params['time_column'] = 'register_time';
$conditions = $this->getDayGroupConditions($params);
/* if (isset($conditions['game_id'])) {
$conditions['fgame_id'] = $conditions['game_id'];
unset($conditions['game_id']);
} */
$items = M('user', 'tab_')->field('count(*) count, FROM_UNIXTIME(register_time, "%Y-%m-%d") as day')
->where($conditions)
->group('day')

@ -749,13 +749,12 @@ class QueryController extends BaseController
public function arpu()
{
$this->meta_title = 'ARPU统计';
$defaultTime = date('Y-m-d', time() - 6 * 24 * 3600) . ' 至 ' . date('Y-m-d');
$time = I('time', '');
$time = $time == '' ? $defaultTime : $time;
$sdkVersion = I('sdk_version', 0);
$gameId = I('game_id', 0);
// $gameId = I('game_id', 0);
$relationGameId = I('relation_game_id', 0);
$serverId = I('server_id', 0);
$levelPromote = $this->getLevelPromote();
$searchPromote = $this->getQueryPromote($levelPromote);
@ -772,9 +771,14 @@ class QueryController extends BaseController
$params = [];
$searchGameName = '';
$searchServerName = '';
if ($gameId > 0) {
$params['game_id'] = $gameId;
$searchGameName = M('game', 'tab_')->where(['id' => $gameId])->getField('game_name');
if ($relationGameId > 0) {
$subMap = ['relation_game_id' => $relationGameId];
if ($sdkVersion > 0 && in_array($sdkVersion, [1, 2])) {
$subMap['sdk_version'] = $sdkVersion;
}
$searchGames = M('game', 'tab_')->field(['id', 'game_name'])->where($subMap)->select();
$params['game_id'] = array_column($searchGames, 'id');
$searchGameName = str_replace('(苹果版)', '', str_replace('(安卓版)', '', $searchGames[0]['game_name']));
}
if ($serverId > 0) {
$params['server_id'] = $serverId;

@ -124,13 +124,29 @@
<div class="trunk-content article">
<div class="trunk-search clearfix">
<form action="{:U('Query/arpu',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<div class="form-group normal_space">
<!-- <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="game-select" name="relation_game_id" class="reselect select_gallery">
<option value="0">请选择游戏</option>
<volist name=":get_promote_serach_game()" id="vo">
<option value="{$vo.relation_game_id}" <?php if($vo['relation_game_id']==I('relation_game_id')):?>selected<?php endif;?> title="{$vo.relation_game_name}">{$vo.relation_game_name}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<select id="sdk_version" name="sdk_version" class="reselect select_gallery" style="width:215px;">
<option value="0">请选择设备类型</option>
<volist name=":getSDKType()" id="vo" key="k">
<option value="{$k}" <?php if($k==I('sdk_version')):?>selected<?php endif;?>>{$vo}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" data-server="{:I('server_id', 0)}">
@ -156,7 +172,7 @@
<table class="table normal_table" id="datatable" style="<notempty name='list_data'>display:none;</notempty>"><thead>
<tr class="odd">
<th>日期</th>
<if condition="I('game_id', 0) gt 0">
<if condition="I('relation_game_id', 0) gt 0">
<th>游戏名称</th>
<else/>
<th title="当日有产生付费的游戏(区分 Android与ios)">付费游戏数</th>
@ -171,11 +187,11 @@
<th title="当日充值总额">付费总额</th>
<th title="单日在线玩家充值率">付费率</th>
<th title="新增注册用户充值总额">新增付费额</th>
<th title="历史累计付费注册用户(去重)">累计付费用户</th>
<!-- <th title="历史累计付费注册用户(去重)">累计付费用户</th> -->
<!-- <th>1日留存</th> -->
<th title="即每个用户平均收入">ARPU</th>
<th title="每付费用户平均收益">ARPPU</th>
<if condition="I('game_id', 0) eq 0">
<if condition="I('relation_game_id', 0) eq 0">
<th>详情</th>
</if>
</tr></thead><tbody>
@ -191,7 +207,7 @@
<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'>
<if condition='empty(I("relation_game_id")) != true'>
<th>{$searchGameName}</th>
<else/>
<td>{$vo.payGameCount}</th>
@ -206,11 +222,11 @@
<td>{$vo.payAmount}</td>
<td>{$vo.payRate}</td>
<td>{$vo.newPayAmount}</td>
<td>{$vo.historyPayCount}</td>
<!-- <td>{$vo.historyPayCount}</td> -->
<!-- <td>{$vo.ratentionOneDay}</td> -->
<td>{$vo.arpu}</td>
<td>{$vo.arppu}</td>
<if condition='empty(I("game_id")) == true'>
<if condition='empty(I("relation_game_id")) == true'>
<td>
<a onclick="chakan('{$vo.day}')" style="cursor: pointer" class="chakan">查看</a>
</td>
@ -255,20 +271,29 @@ $('.range-date').flatpickr({
dateFormat: "Y-m-d",
defaultDate: defaultDate,
})
var gameId = $('#game-select').val();
var gameId = $('#game-select').val()
var sdkVersion = $('#sdk_version').val()
var defaultServerId = $('#server-select').attr('data-server');
getGameServers(gameId, defaultServerId)
$('#game-select').on({
change: function name() {
sdkVersion = $('#sdk_version').val()
gameId = $('#game-select').val()
getGameServers(gameId, 0)
getGameServers(gameId, 0, sdkVersion)
}
})
function getGameServers(gameId, defaultServerId) {
$('#sdk_version').change(function () {
sdkVersion = $('#sdk_version').val()
gameId = $('#game-select').val();
if (gameId > 0) {
getGameServers(gameId, defaultServerId, sdkVersion);
}
});
function getGameServers(gameId, defaultServerId, sdkVersion) {
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
data: {game_id: gameId, sdk_version: sdkVersion},
success: function(response) {
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
@ -281,6 +306,7 @@ var gameId = $('#game-select').val();
}
$('#server-select').html(options)
$("#server-select").val(defaultServerId).trigger("change")
$('.select_gallery').select2()
}
})
}

Loading…
Cancel
Save