You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

703 lines
30 KiB
PHTML

5 years ago
<?php
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
use Org\UcenterSDK\Ucservice;
/**
* 后台首页控制器
* @author yyh
*/
class PlatformController extends ThinkController {
function game_statistics($p=0){
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage=$page;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$user=M('User','tab_');
$map['fgame_id']=array('gt',0);$map['puid'] = 0;
if(!empty($_REQUEST['timestart'])&& !empty($_REQUEST['timeend'])) {
$map['register_time'] = ['between',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399)];
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
} elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['register_time'] = ['between',array(strtotime($_REQUEST['timestart']),time())];
unset($_REQUEST['timestart']);
} elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['register_time'] = ['elt',strtotime($_REQUEST['timeend'])+86399];
unset($_REQUEST['timeend']);
}
// var_dump($_REQUEST);exit;
if(isset($_REQUEST['game_name'])&&$_REQUEST['game_name']!=''){
$map['fgame_name'] =$_REQUEST['game_name'];
unset($_REQUEST['fgame_name']);
}
$today=total(1);
$week=total(2);
$mounth=total(3);
$data=$user
->field('fgame_name,fgame_id,date_format(FROM_UNIXTIME( register_time),"%Y-%m-%d") AS time, count(id) as count,
count(IF(register_time '.$today.',1,null)) as today,
count(IF(register_time '.$week.',1,null)) as week,
count(IF(register_time '.$mounth.',1,null)) as mounth')
->where($map)
->group('fgame_id')
->order('count desc,register_time')
->select();
$count=count($data);
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
}
$total=$this->data_total($data);
$this->assign('total',$total);
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
$this->assign('userarpu_order',$data_order);
$this->assign('userarpu_order_type',$data_order_type);
}
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
$this->meta_title = '游戏注册统计列表';
$this->assign('list_data',$data);
$this->display();
}
function gamepay_statistics($p=0){
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage=$page;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$spend=M('Spend','tab_');
$deposit = M('Deposit',"tab_");
$map['game_id']=array('gt',0);
if(!empty($_REQUEST['timestart'])&& !empty($_REQUEST['timeend'])) {
$map['pay_time'] = ['between',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399)];
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
} elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['pay_time'] = ['between',array(strtotime($_REQUEST['timestart']),time())];
unset($_REQUEST['timestart']);
} elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['pay_time'] = ['elt',strtotime($_REQUEST['timeend'])+86399];
unset($_REQUEST['timeend']);
}
// var_dump($_REQUEST);exit;
if(isset($_REQUEST['game_name'])&&$_REQUEST['game_name']!=''){
$map['game_id'] = $_REQUEST['game_name'];
unset($_REQUEST['game_name']);
}
$map['pay_status']=1;
$today=total(1);
$week=total(2);
$mounth=total(3);
$data=$spend
->field('game_name,game_id,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count,
sum(IF(pay_time '.$today.',pay_amount,0)) as today,
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
->where($map)
->group('game_id')
->order('count desc,pay_time')
->select();
$count=count($data);
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
}
$total=$this->data_total($data);
$this->assign('total',$total);
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
$this->assign('userarpu_order',$data_order);
$this->assign('userarpu_order_type',$data_order_type);
}
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
$this->meta_title = '游戏充值统计列表';
$this->assign('list_data',$data);
$this->display();
}
function resway_statistics($p=0){
// var_dump(total(2));exit;
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage=$page;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$user=M('User','tab_');$map['puid'] = 0;
if(!empty($_REQUEST['timestart'])&& !empty($_REQUEST['timeend'])) {
$map['register_time'] = ['between',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399)];
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
} elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['register_time'] = ['between',array(strtotime($_REQUEST['timestart']),time())];
unset($_REQUEST['timestart']);
} elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['register_time'] = ['elt',strtotime($_REQUEST['timeend'])+86399];
unset($_REQUEST['timeend']);
}
// var_dump($_REQUEST);exit;
if(isset($_REQUEST['register_way'])&&$_REQUEST['register_way']!=''){
$map['register_way'] =$_REQUEST['register_way'];
unset($_REQUEST['register_way']);
}
$today=total(1);
$week=total(2);
$mounth=total(3);
$data=$user
->field('register_way,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(id) as count,
count(IF(register_time '.$today.',1,null)) as today,
count(IF(register_time '.$week.',1,null)) as week,
count(IF(register_time '.$mounth.',1,null)) as mounth')
->where($map)
->group('register_way')
->order('count desc,register_time')
->select();
$count=count($data);
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
}
$total=$this->data_total($data);
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
$this->assign('userarpu_order',$data_order);
$this->assign('userarpu_order_type',$data_order_type);
}
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
$this->meta_title = '注册方式统计列表';
$this->assign('list_data',$data);
$this->assign('total',$total);
$this->display();
}
function payway_statistics($p=0){
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage=$page;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$deposit = M('Deposit',"tab_");
$user=M('User','tab_');
$spend=M('Spend','tab_');
if(!empty($_REQUEST['timestart'])&& !empty($_REQUEST['timeend'])) {
$map['pay_time'] = ['between',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399)];
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
} elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['pay_time'] = ['between',array(strtotime($_REQUEST['timestart']),time())];
unset($_REQUEST['timestart']);
} elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['pay_time'] = ['elt',strtotime($_REQUEST['timeend'])+86399];
unset($_REQUEST['timeend']);
}
// var_dump($_REQUEST);exit;
if(isset($_REQUEST['pay_way'])&&$_REQUEST['pay_way']!=''){
$map['pay_way'] = array('in',$_REQUEST['pay_way']) ;
unset($_REQUEST['pay_way']);
}
$map['pay_status']=1;
$today=total(1);
$week=total(2);
$mounth=total(3);
$data=$spend
->field('pay_way,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count,
sum(IF(pay_time '.$today.',pay_amount,0)) as today,
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
->where($map)
->group('pay_way')
->order('count desc,pay_time')
->select();
$count=count($data);
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
}
$total=$this->data_total($data);
$this->assign('total',$total);
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
$this->assign('userarpu_order',$data_order);
$this->assign('userarpu_order_type',$data_order_type);
}
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
$this->meta_title = '充值方式统计列表';
$this->assign('list_data',$data);
$this->display();
}
function promote_statistics($p=0){
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage=$page;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$user=M('User','tab_');
$map['promote_id']=array('egt',0);$map['puid']=0;
if(!empty($_REQUEST['timestart'])&& !empty($_REQUEST['timeend'])) {
$map['register_time'] = ['between',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399)];
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
} elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['register_time'] = ['between',array(strtotime($_REQUEST['timestart']),time())];
unset($_REQUEST['timestart']);
} elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['register_time'] = ['elt',strtotime($_REQUEST['timeend'])+86399];
unset($_REQUEST['timeend']);
}
if(isset($_REQUEST['game_name'])){
$map['fgame_name'] = $_REQUEST['game_name'];
unset($_REQUEST['game_name']);
}
$today=total(1);
$week=total(2);
$mounth=total(3);
if(isset($_REQUEST['server_id'])){
$map['server_name'] = $_REQUEST['server_id'];
$map['game_name'] = $map['fgame_name'];
$map['u.promote_id'] = $map['promote_id'];
unset($map['promote_id']);
unset($map['fgame_name']);
unset($_REQUEST['server_id']);
if(isset($_REQUEST['promote_id'])){
$map['_string'] = "u.promote_id = {$_REQUEST['promote_id']} or tab_promote.parent_id = {$_REQUEST['promote_id']} or tab_promote.grand_id = {$_REQUEST['promote_id']} ";
unset($_REQUEST['promote_id']);
}
$data = M('user_play_info','tab_')->alias('u')
->field('u.promote_account,u.promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.user_id) as count,
IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,u.promote_id)) as promote_id1 ,
count(IF(register_time '.$today.',1,null)) as today,
count(IF(register_time '.$week.',1,null)) as week,
count(IF(register_time '.$mounth.',1,null)) as mounth')
->join('tab_user on tab_user.id = u.user_id')
->join('tab_promote on u.promote_id = tab_promote.id','left')
->where($map)
->group('promote_id1')
->having('u.promote_id != 0')
->order('count desc,register_time')
->select();
}else{
if(isset($_REQUEST['promote_id'])){
$map['_string'] = "promote_id = {$_REQUEST['promote_id']} or tab_promote.parent_id = {$_REQUEST['promote_id']} or tab_promote.grand_id = {$_REQUEST['promote_id']} ";
unset($_REQUEST['promote_id']);
}
$data=$user
->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count,
IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 ,
count(IF(register_time '.$today.',1,null)) as today,
count(IF(register_time '.$week.',1,null)) as week,
count(IF(register_time '.$mounth.',1,null)) as mounth')
->join('tab_promote on promote_id = tab_promote.id','left')
->where($map)
->group('promote_id1')
->having('promote_id != 0')
->order('count desc,register_time')
->select();
}
$count=count($data);
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
}
$total=$this->data_total($data);
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
$this->assign('userarpu_order',$data_order);
$this->assign('userarpu_order_type',$data_order_type);
}
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
$this->meta_title = '渠道注册统计列表';
$this->assign('list_data',$data);
$this->assign('total',$total);
$this->display();
}
function promotepay_statistics($p=0){
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage=$page;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$map1['promote_id'] = $map['promote_id']=array('gt',0);
$spend=M('Spend','tab_');
if(!empty($_REQUEST['timestart'])&& !empty($_REQUEST['timeend'])) {
$map['create_time'] = ['between',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399)];
$pay_time= " between ".strtotime($_REQUEST['timestart'])." and ".(strtotime($_REQUEST['timeend'])+86399)." ";
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
} elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['create_time'] = ['between',array(strtotime($_REQUEST['timestart']),time())];
$pay_time= " between ".strtotime($_REQUEST['timestart'])." and ".time()." ";
unset($_REQUEST['timestart']);
} elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['create_time'] = ['elt',strtotime($_REQUEST['timeend'])+86399];
$pay_time= " between 0 and ".(strtotime($_REQUEST['timeend'])+86399)." ";
unset($_REQUEST['timeend']);
}else{
$pay_time = " between 0 and ".time();
}
$map1['pay_status'] = $map['pay_status']=1;
$today=total(1);
$week=total(2);
$mounth=total(3);
$map1['pay_way'] = $map['pay_way'] = array('gt',0);
/* $data=$spend
->field('promote_account,promote_id,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count,
sum(IF(pay_time '.$today.',pay_amount,0)) as today,
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
->where($map)
->group('promote_id')
->order('count desc,pay_time')
->select(); */
$bindrecharge_data = M('bind_recharge','tab_')
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
floor(sum(IF(create_time '.$pay_time.',real_amount,0))*100) as scount,
floor(sum(IF(create_time '.$today.',real_amount,0))*100) as today,
floor(sum(IF(create_time '.$week.',real_amount,0))*100) as week,
floor(sum(IF(create_time '.$mounth.',real_amount,0))*100) as mounth')
->where($map1)
->group('promote_id')
->select(false);
$deposit_data = M('deposit','tab_')
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
floor(sum(IF(create_time '.$pay_time.',pay_amount,0))*100) as scount,
floor(sum(IF(create_time '.$today.',pay_amount,0))*100) as today,
floor(sum(IF(create_time '.$week.',pay_amount,0))*100) as week,
floor(sum(IF(create_time '.$mounth.',pay_amount,0))*100) as mounth')
->where($map1)
->group('promote_id')
->select(false);
if(isset($_REQUEST['game_name'])){
$map['game_name'] = $_REQUEST['game_name'];
if(isset($_REQUEST['server_id'])){
$map['server_name'] = $_REQUEST['server_id'];
unset($_REQUEST['server_id']);
}
$data=$spend
->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time,
floor(sum(IF(pay_time '.$pay_time.',pay_amount,0))*100) as scount,
floor(sum(IF(pay_time '.$today.',pay_amount,0))*100) as today,
floor(sum(IF(pay_time '.$week.',pay_amount,0))*100) as week,
floor(sum(IF(pay_time '.$mounth.',pay_amount,0))*100) as mounth')
->where($map)
->group('promote_id')
->select(false);
}else{
$data=$spend
->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time,
floor(sum(IF(pay_time '.$pay_time.',pay_amount,0))*100) as scount,
floor(sum(IF(pay_time '.$today.',pay_amount,0))*100) as today,
floor(sum(IF(pay_time '.$week.',pay_amount,0))*100) as week,
floor(sum(IF(pay_time '.$mounth.',pay_amount,0))*100) as mounth')
->where($map)
->union(' ('.$bindrecharge_data.') ')
->union(' ('.$deposit_data.') ')
->group('promote_id')
->select(false);
}
if(isset($_REQUEST['promote_id'])){
$condition['_string'] = "promote_id = {$_REQUEST['promote_id']} or tab_promote.parent_id = {$_REQUEST['promote_id']} or tab_promote.grand_id = {$_REQUEST['promote_id']} ";
unset($_REQUEST['promote_id']);
}
$data = $spend->field('a.promote_account,a.promote_id,a.time,sum(a.scount) as count,sum(a.today) as today,sum(a.week) as week,sum(a.mounth) as mounth,IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1')
->join('tab_promote on promote_id = tab_promote.id','left')
->where($condition)
->table('('.$data.') as a')->group('promote_id1')->order('count desc,a.ordertime')->select();
$count=count($data);
// dump($condition);die;
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
$data[$key]['count']=$value['count']/100;
$data[$key]['today']=$value['today']/100;
$data[$key]['week']=$value['week']/100;
$data[$key]['mounth']=$value['mounth']/100;
/* $adata=$this->day_data('Spend',array('promote_id'=>$value['promote_id']));
$data[$key]['today']=$adata['today']==''?0:$adata['today'];
$data[$key]['week']=$adata['week']==''?0:$adata['week'];
$data[$key]['mounth']=$adata['mounth']==''?0:$adata['mounth']; */
if($data[$key]['promote_id']=='0'){
unset($data[$key]);
}
}
$total=$this->data_total($data);
$this->assign('total',$total);
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
$this->assign('userarpu_order',$data_order);
$this->assign('userarpu_order_type',$data_order_type);
}
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
$this->meta_title = '渠道充值统计列表';
$this->assign('list_data',$data);
$this->display();
}
public function data_total($data){
$total['sum_count']=array_sum(array_column($data,'count'));
$total['sum_today']=array_sum(array_column($data,'today'));
$total['sum_week']=array_sum(array_column($data,'week'));
$total['sum_mounth']=array_sum(array_column($data,'mounth'));
return $total;
}
function day_data($model='User',$column1=array(),$column2='count'){
//今日本周本月不跟随选择的实现变动 只以当前日期为基准
$table=M($model,'tab_');
$today=total(1);
$week=total(2);
$mounth=total(3);
if($model=='User'){
$data['today']=$table->field('count(id) as count')->where($column1)->where('register_time'.$today)->select();
$data['week']=$table->field('count(id) as count')->where($column1)->where('register_time'.$week)->select();
$data['mounth']=$table->field('count(id) as count')->where($column1)->where('register_time'.$mounth)->select();
}elseif($model=='Spend'){
$data['today']=$table->field('sum(pay_amount) as count')->where($column1)->where('pay_time'.$today)->where(array('pay_status'=>1))->select();
$data['week']=$table->field('sum(pay_amount) as count')->where($column1)->where('pay_time'.$week)->where(array('pay_status'=>1))->select();
$data['mounth']=$table->field('sum(pay_amount) as count')->where($column1)->where('pay_time'.$mounth)->where(array('pay_status'=>1))->select();
}
foreach ($data as $key => $value) {
$v=reset($value);
$data[$key]=$v['count'];
}
return $data;
}
//渠道下注册详细信息
public function zhuce_detail($promote_id,$game_name='',$server_name=''){
$map['promote_id'] = $promote_id;
if(!empty($game_name)){
$map['fgame_name'] = $game_name;
}
if(empty($server_name)){
$data = M('user','tab_')->field('count(id) as count,fgame_name as game_name')->where($map)->order('fgame_id')->group('game_name')->select();
}else{
$map['server_name'] = $server_name;
$map['game_name'] = $map['fgame_name'];
unset($map['fgame_name']);
$data = M('user_play_info','tab_')->field('count(user_id) as count,game_name')->where($map)->order('game_id')->group('game_name')->select();
}
$this->assign('list_data',$data);
$this->display();
}
//渠道下充值详细信息
public function chongzhi_detail($promote_id,$game_name='',$server_name=''){
$map['promote_id'] = $promote_id;
$map['pay_status']=1;
$map['pay_way'] =array('GT',0);
if($game_name){
$map['game_name'] = $game_name;
}
if($server_name){
$map['server_name'] = $server_name;
}
$data = M('spend','tab_')->field('sum(pay_amount) as total_amount,game_name')->where($map)->order('game_id')->group('game_name')->select();
$this->assign('list_data',$data);
$this->display();
}
public function uc_statistics($p=1){
if(isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])){
$map.='pay_time between '.strtotime($_REQUEST['timestart']).' and '.(strtotime($_REQUEST['timeend'])+24*60*60-1).' and ';
}
if(isset($_REQUEST['game_name'])){
$map.='game_name like '.'"'.'%'.$_REQUEST['game_name'].'%'.'" and ';
$map1.='game_name like '.'"'.'%'.$_REQUEST['game_name'].'%'.'" and ';
$map2.='game_name like '.'"'.'%'.$_REQUEST['game_name'].'%'.'" and ';
unset($_REQUEST['game_name']);
}
$map.=" version=1 and ";
$map.="platform!=1";
$uc=new Ucservice();
$page=$p;
$data=$uc->uc_recharge_select($page,10,$map);
$map1.='pay_time'.total(1).' and ';
$map1.=" version=1 and ";
$map1.="platform!=1";
$map2.='pay_time'.total(5).' and ';
$map2.=" version=1 and ";
$map2.="platform!=1";
//今天
$ttotal=$uc->uc_recharge_select($page,10,$map1)['total']?$uc->uc_recharge_select($page,10,$map1)['total']:0;
//昨天
$ytotal=$uc->uc_recharge_select($page,10,$map2)['total']?$uc->uc_recharge_select($page,10,$map2)['total']:0;
//总共
$total=$data['total']?$data['total']:0;
//该叶
$pagetotal=$data['totalpage'][0]['totalpage']?$data['totalpage'][0]['totalpage']:0;
$this->meta_title = 'Uc充值列表';
$this->assign('ttotal',$ttotal);
$this->assign('ytotal',$ytotal);
$this->assign('pagetotal',$pagetotal);
$this->assign('total',$total);
$count=$data['count'];
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
unset($data['count']);
unset($data['total']);
unset($data['totalpage']);
$this->assign('data',$data);
$this->display();
}
public function uc_deposit($p=1){
if(isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])){
$map.='create_time between '.strtotime($_REQUEST['timestart']).' and '.(strtotime($_REQUEST['timeend'])+24*60*60-1).' and ';
}
$map.=" version=1 and ";
$map.="platform!=1";
$uc=new Ucservice();
$page=$p;
$data=$uc->uc_deposit_select($page,10,$map);
$map1.='create_time'.total(1).' and ';
$map1.=" version=1 and ";
$map1.="platform!=1";
$map2.='create_time'.total(5).' and ';
$map2.=" version=1 and ";
$map2.="platform!=1";
//今天
$ttotal=$uc->uc_deposit_select($page,10,$map1)['total']?$uc->uc_deposit_select($page,10,$map1)['total']:0;
//昨天
$ytotal=$uc->uc_deposit_select($page,10,$map2)['total']?$uc->uc_deposit_select($page,10,$map2)['total']:0;
//总共
$total=$data['total']?$data['total']:0;
//该叶
$pagetotal=$data['totalpage'][0]['totalpage']?$data['totalpage'][0]['totalpage']:0;
$this->meta_title = 'Uc平台币充值列表';
$this->assign('ttotal',$ttotal);
$this->assign('ytotal',$ytotal);
$this->assign('pagetotal',$pagetotal);
$this->assign('total',$total);
$count=$data['count'];
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
unset($data['count']);
unset($data['total']);
unset($data['totalpage']);
$this->assign('data',$data);
$this->display();
}
}