修改arpu

master
ELF 5 years ago
parent 88a7df1119
commit 0dc0063092

@ -3,8 +3,6 @@ namespace Base\Repository;
class PromoteRepository {
private $model;
public function __construct()
{

@ -0,0 +1,32 @@
<?php
namespace Base\Repository;
class SpendRepository {
public function __construct()
{
}
public function getPayGameByDay($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'] ?? [];
$isBan = $params['is_ban'] ?? false;
$map = [];
$map['pay_status']=1;
$map['pay_time'] = ['between', [$beginTime, $endTime]];
$map['game_id'] = $gameId > 0 ? $gameId : ['gt', 0];
$map['promote_id'] = ['in', [1,2]];
$map['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1'];
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time,game_id as pay_num';
$subTable = M('spend', 'tab_')->field($field)->where($map)->group('pay_time')->select(false);
$data = M('spend', 'tab_')->field('a.pay_time,count(DISTINCT a.pay_num) as pay_num')->table('(' . $subTable . ') as a')->group('a.pay_time')->select();
var_dump(M()->getLastSql());die();
return $data;
}
}

@ -5,7 +5,7 @@ namespace Home\Controller;
use OT\DataDictionary;
use User\Api\PromoteApi;
use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository;
/**
* 前台首页控制器
* 主要获取首页聚合数据
@ -631,6 +631,29 @@ class QueryController extends BaseController
public function arpu_analysis()
{
$this->meta_title = "ARPU统计";
$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;
}
if ($serverId > 0) {
$params['server_id'] = $serverId;
}
if ($sdkVersion > 0) {
$params['sdk_version'] = $sdkVersion;
}
list($beginTime, $endTime) = $this->getBetweenTime($time);
$params['begin_time'] = $beginTime;
$params['end_time'] = $endTime;
$spendRepository = new SpendRepository();
$spendRepository->getPayGameByDay($params);
A('User', 'Event')->arpu_analysis();
}

@ -112,9 +112,9 @@ class SpendModel extends Model{
$field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time,user_id as pay_num';
$sql = $this->field($field)->where($map)->group('pay_time')->select(false);
$subTable = $this->field($field)->where($map)->group('pay_time')->buildSql();
return $this->field('a.pay_time,count(distinct a.pay_num) as pay_num')->table('('.$sql.') as a')->group('a.pay_time')->select();
return $this->field('a.pay_time,count(distinct a.pay_num) as pay_num')->table('(' . $subTable . ') as a')->group('a.pay_time')->select();
}

@ -46,6 +46,18 @@
.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>
@ -95,43 +107,63 @@
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<form action="{:U('Query/arpu_analysis')}" method="post" enctype="multipart/form-data">
<div class="form-group normal_space fr">
<input type="submit" class="submit" value="查询">
<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 fr">
<label class="form-title select-title">选择时间:</label>
<div class="select-time">
<input type="text" id="sdate" class="txt" autocomplete="off" name="time_start" placeholder="开始时间" value="{$Think.request.time_start}" >
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" id="edate" class="txt" autocomplete="off" name="time_end" placeholder="结束时间" value="{$Think.request.time_end}">
</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>
<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 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>
<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>
<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>
<select id="game_id" name="game_id" class="reselect select_gallery" style="width: 200px;">
<option game-id="0" value="0">请选择游戏</option>
<volist name=":get_game_list()" id="vo">
<option game-id="{$vo.id}" value="{$vo.id}">{$vo.game_name}</option>
</volist>
</select>
<input type="hidden" id="game_name" name="game_name" value='{:I("game_name")}'>
<input type="hidden" id="promote_arpu" name="promote_arpu" value='{$promote_arpu}'>
</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>
@ -204,13 +236,6 @@
</table>
<notempty name="list_data">
<div class="pagenation clearfix">
<a class="sch-btn" id="export_data" href="{:U('Export/arpu_analysis',array(
'game_id'=>I('game_id'),
'promote_id'=>I('promote_id'),
'time_start'=>I('time_start'),
'time_end'=>I('time_end'),'game_name'=>I('post.game_name'),'promote_account'=>I('post.promote_account'),
'xlsname'=>'数据管理_ARPU统计'
))}" >导出</a>
<div>
<select id="pagechange" name="row" onchange="pagechange(this)">
<option value="10">每页10条</option><option value="25">每页25条</option><option value="50">每页50条</option><option value="100">每页100条</option></select>
@ -226,9 +251,9 @@
</div>
</block>
<block name="script">
<link rel="stylesheet" type="text/css" href="__CSS__/p_jquery.datetimepicker.css">
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/jquery.datetimepicker.js"></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>
@ -239,6 +264,10 @@
</script>
</eq>
<script>
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
})
layer.config({
extend: 'skin/myskin/style.css', //同样需要加载新皮肤
});
@ -324,28 +353,9 @@ $().ready(function(){
return false;
}
})
$('#sdate').datetimepicker({
lang:'ch',
format:'Y-m-d',
formatDate:'Y-m-d',
scrollMonth:false,
scrollTime:false,
scrollInput:false,
timepicker:false
});
$(".select_gallery").select2();
$('#edate').datetimepicker({
lang:'ch',
format:'Y-m-d',
formatDate:'Y-m-d',
scrollMonth:false,
scrollTime:false,
scrollInput:false,
timepicker:false
});
tablePage('datatable', 'datacontent', 'pagenation', [1, 2, 4, 5, 6, 10], false);

Loading…
Cancel
Save