Merge pull request '优化' (#125) from feature/add_promote_level_id into release

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/125
master
廖金灵 4 years ago
commit dcbc152712

@ -85,7 +85,15 @@ class SpendRepository
$conditions['pay_status'] = 1; $conditions['pay_status'] = 1;
$conditions['promote_id'] = ['in', $ids]; $conditions['promote_id'] = ['in', $ids];
$conditions['pay_time'] = ['between', [$beginTime, $endTime]]; $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'])) { if (isset($params['server_id'])) {
$conditions['server_id'] = $serverId; $conditions['server_id'] = $serverId;
} }

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

@ -749,13 +749,12 @@ class QueryController extends BaseController
public function arpu() public function arpu()
{ {
$this->meta_title = 'ARPU统计'; $this->meta_title = 'ARPU统计';
$defaultTime = date('Y-m-d', time() - 6 * 24 * 3600) . ' 至 ' . date('Y-m-d'); $defaultTime = date('Y-m-d', time() - 6 * 24 * 3600) . ' 至 ' . date('Y-m-d');
$time = I('time', ''); $time = I('time', '');
$time = $time == '' ? $defaultTime : $time; $time = $time == '' ? $defaultTime : $time;
$sdkVersion = I('sdk_version', 0); $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); $serverId = I('server_id', 0);
$levelPromote = $this->getLevelPromote(); $levelPromote = $this->getLevelPromote();
$searchPromote = $this->getQueryPromote($levelPromote); $searchPromote = $this->getQueryPromote($levelPromote);
@ -772,9 +771,14 @@ class QueryController extends BaseController
$params = []; $params = [];
$searchGameName = ''; $searchGameName = '';
$searchServerName = ''; $searchServerName = '';
if ($gameId > 0) { if ($relationGameId > 0) {
$params['game_id'] = $gameId; $subMap = ['relation_game_id' => $relationGameId];
$searchGameName = M('game', 'tab_')->where(['id' => $gameId])->getField('game_name'); 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) { if ($serverId > 0) {
$params['server_id'] = $serverId; $params['server_id'] = $serverId;

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

Loading…
Cancel
Save