|
|
|
|
<?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('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']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
//为数据权限添加
|
|
|
|
|
setPowerPromoteIds($map);
|
|
|
|
|
$data = $user
|
|
|
|
|
->field('fgame_name,fgame_id,date_format(FROM_UNIXTIME( register_time),"%Y-%m-%d") AS time, count(id) as count')
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('fgame_id')
|
|
|
|
|
->order('count desc,register_time')
|
|
|
|
|
->select();
|
|
|
|
|
$map2 = array();
|
|
|
|
|
$map2['fgame_id'] = array('egt', 0);
|
|
|
|
|
$map2['puid'] = 0;
|
|
|
|
|
setPowerPromoteIds($map2);
|
|
|
|
|
|
|
|
|
|
$data2 = $user->field('fgame_id,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($map2)
|
|
|
|
|
->group('fgame_id')
|
|
|
|
|
->select();
|
|
|
|
|
$data2 = array_column($data2, null, 'fgame_id');
|
|
|
|
|
$count = count($data);
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
static $i = 0;
|
|
|
|
|
$i++;
|
|
|
|
|
$data[$key]['rand'] = $i;
|
|
|
|
|
|
|
|
|
|
if ($data[$key]['fgame_id'] == 0) {
|
|
|
|
|
$data[$key]['fgame_name'] = '其他注册';
|
|
|
|
|
}
|
|
|
|
|
$data[$key]['today'] = $data2[$value['fgame_id']]['today'];
|
|
|
|
|
$data[$key]['week'] = $data2[$value['fgame_id']]['week'];
|
|
|
|
|
$data[$key]['mounth'] = $data2[$value['fgame_id']]['mounth'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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->assign("is_admin",is_administrator());
|
|
|
|
|
$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_");
|
|
|
|
|
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']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//为数据权限添加
|
|
|
|
|
setPowerPromoteIds($map);
|
|
|
|
|
|
|
|
|
|
$map['game_id'] = array('gt', 0);
|
|
|
|
|
// 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') ->where($map)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('game_id')
|
|
|
|
|
->order('count desc,pay_time')
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
//今日、本周、本月不随搜索条件而变动
|
|
|
|
|
$map2['pay_status'] = 1;
|
|
|
|
|
$map2['game_id'] = array('gt', 0);
|
|
|
|
|
setPowerPromoteIds($map2);
|
|
|
|
|
$data2 = $spend
|
|
|
|
|
->field('game_id,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($map2)
|
|
|
|
|
->group('game_id')
|
|
|
|
|
->select();
|
|
|
|
|
$data2 = array_column($data2, null, 'game_id');
|
|
|
|
|
$count = count($data);
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
static $i = 0;
|
|
|
|
|
$i++;
|
|
|
|
|
$data[$key]['rand'] = $i;
|
|
|
|
|
//加入今日、本周、本月数据
|
|
|
|
|
$data[$key]['today'] = $data2[$value['game_id']]['today'];
|
|
|
|
|
$data[$key]['week'] = $data2[$value['game_id']]['week'];
|
|
|
|
|
$data[$key]['mounth'] = $data2[$value['game_id']]['mounth'];
|
|
|
|
|
}
|
|
|
|
|
$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->assign("is_admin",is_administrator());
|
|
|
|
|
$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']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setPowerPromoteIds($map);
|
|
|
|
|
|
|
|
|
|
$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')
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('register_way')
|
|
|
|
|
->order('count desc,register_time')
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
$map2 = array();
|
|
|
|
|
$map2['puid'] = 0;
|
|
|
|
|
setPowerPromoteIds($map2);
|
|
|
|
|
$data2 = $user
|
|
|
|
|
->field('register_way,
|
|
|
|
|
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($map2)
|
|
|
|
|
->group('register_way')
|
|
|
|
|
->select();
|
|
|
|
|
$data2 = array_column($data2, null, 'register_way');
|
|
|
|
|
$count = count($data);
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
static $i = 0;
|
|
|
|
|
$i++;
|
|
|
|
|
$data[$key]['rand'] = $i;
|
|
|
|
|
$data[$key]['today'] = $data2[$value['register_way']]['today'];
|
|
|
|
|
$data[$key]['week'] = $data2[$value['register_way']]['week'];
|
|
|
|
|
$data[$key]['mounth'] = $data2[$value['register_way']]['mounth'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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->assign("is_admin",is_administrator());
|
|
|
|
|
$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']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setPowerPromoteIds($map);
|
|
|
|
|
|
|
|
|
|
$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')
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('pay_way')
|
|
|
|
|
->order('count desc,pay_time')
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
$map2 = array();
|
|
|
|
|
$map2['pay_status'] = 1;
|
|
|
|
|
setPowerPromoteIds($map2);
|
|
|
|
|
$data2 = $spend
|
|
|
|
|
->field('pay_way,
|
|
|
|
|
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($map2)
|
|
|
|
|
->group('pay_way')
|
|
|
|
|
->select();
|
|
|
|
|
$data2 = array_column($data2, null, 'pay_way');
|
|
|
|
|
|
|
|
|
|
$count = count($data);
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
static $i = 0;
|
|
|
|
|
$i++;
|
|
|
|
|
$data[$key]['rand'] = $i;
|
|
|
|
|
$data[$key]['today'] = $data2[$value['pay_way']]['today'];
|
|
|
|
|
$data[$key]['week'] = $data2[$value['pay_way']]['week'];
|
|
|
|
|
$data[$key]['mounth'] = $data2[$value['pay_way']]['mounth'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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->assign("is_admin",is_administrator());
|
|
|
|
|
$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']);
|
|
|
|
|
}
|
|
|
|
|
//TODO:应需求,取消玩家表,只要user表的fgame有就算注册无需在play表存在
|
|
|
|
|
$play_map = false;
|
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
|
|
$map['fgame_name'] = $_REQUEST['game_name'];
|
|
|
|
|
// $play_map = " and up.game_name = '{$_REQUEST['game_name']}' ";
|
|
|
|
|
}
|
|
|
|
|
$play_info_map = false;
|
|
|
|
|
if (isset($_REQUEST['server_id'])) {
|
|
|
|
|
$play_map = false; //有区服就不检索玩家表,有区服一定已经选择游戏了
|
|
|
|
|
$play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name = '{$_REQUEST['game_name']}'";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$today = total(1);
|
|
|
|
|
$week = total(2);
|
|
|
|
|
$mounth = total(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
$map['tp1.id'] = $_REQUEST['promote_id'];
|
|
|
|
|
} else {
|
|
|
|
|
$map['tp1.chain'] = '/';
|
|
|
|
|
}
|
|
|
|
|
//为数据权限添加
|
|
|
|
|
setPowerPromoteIds($map, 'u.promote_id');
|
|
|
|
|
|
|
|
|
|
$data = M('promote', 'tab_')->alias('tp1')
|
|
|
|
|
->field('tp1.account as promote_account,tp1.id,
|
|
|
|
|
date_format(FROM_UNIXTIME(register_time),"% ") AS time,
|
|
|
|
|
count(u.id) as count')
|
|
|
|
|
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
|
|
|
|
|
->join("tab_user as u on tp2.id = u.promote_id", 'left')
|
|
|
|
|
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
|
|
|
|
|
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tp1.id')
|
|
|
|
|
->order('count desc, register_time')
|
|
|
|
|
->select();
|
|
|
|
|
//今日/本周/本月不变
|
|
|
|
|
$tmap = $map;
|
|
|
|
|
if(isset($tmap['register_time'])){
|
|
|
|
|
//获取最大最小
|
|
|
|
|
$tweek = total(2,false);
|
|
|
|
|
$tmonth = total(3,false);
|
|
|
|
|
//获取最小
|
|
|
|
|
$tmin = 0;
|
|
|
|
|
if($tweek[1][0] < $tmonth[1][0]){
|
|
|
|
|
$tmin = $tweek[1][0];
|
|
|
|
|
}else{
|
|
|
|
|
$tmin = $tmonth[1][0];
|
|
|
|
|
}
|
|
|
|
|
$tmap['register_time'] = ['between', array($tmin,$tmonth[1][1])];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tdata = M('promote', 'tab_')->alias('tp1')
|
|
|
|
|
->field('tp1.account as promote_account,tp1.id,
|
|
|
|
|
date_format(FROM_UNIXTIME(register_time),"% ") AS time,
|
|
|
|
|
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 AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
|
|
|
|
|
->join("tab_user as u on tp2.id = u.promote_id", 'left')
|
|
|
|
|
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
|
|
|
|
|
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
|
|
|
|
|
->where($tmap)
|
|
|
|
|
->group('tp1.id')
|
|
|
|
|
->order('register_time')
|
|
|
|
|
->select();
|
|
|
|
|
$tmdata = [];
|
|
|
|
|
foreach($data as $k=>$v){
|
|
|
|
|
$v['today'] = 0;
|
|
|
|
|
$v['week'] = 0;
|
|
|
|
|
$v['mounth'] = 0;
|
|
|
|
|
$tmdata[$v['id']] = $v;
|
|
|
|
|
}
|
|
|
|
|
if(!empty($tdata)){
|
|
|
|
|
foreach ($tdata as $k => $v) {
|
|
|
|
|
$tmdata[$v['id']]['today'] = $v['today'];
|
|
|
|
|
$tmdata[$v['id']]['week'] = $v['week'];
|
|
|
|
|
$tmdata[$v['id']]['mounth'] = $v['mounth'];
|
|
|
|
|
if (!$tmdata[$v['id']]['promote_account']) {
|
|
|
|
|
$tmdata[$v['id']]['promote_account'] = $v['promote_account'];
|
|
|
|
|
$tmdata[$v['id']]['count'] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
|
foreach($tmdata as $k => $v){
|
|
|
|
|
$data[] = $v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unset($map['tp1.id']);
|
|
|
|
|
unset($map['tp1.chain']);
|
|
|
|
|
unset($tmap['tp1.id']);
|
|
|
|
|
unset($tmap['tp1.chain']);
|
|
|
|
|
$map['u.promote_id'] = 0;
|
|
|
|
|
$tmap['u.promote_id'] = 0;
|
|
|
|
|
$authorityData['count'] = 0;
|
|
|
|
|
|
|
|
|
|
//如果有官方渠道权限
|
|
|
|
|
$user_auth_promote_ids = session('user_auth_promote_ids');
|
|
|
|
|
if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) {
|
|
|
|
|
//官方渠道数据添加
|
|
|
|
|
$authorityData = M('user', 'tab_')->alias('u')
|
|
|
|
|
->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,count(u.id) as count')
|
|
|
|
|
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
|
|
|
|
|
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
|
|
|
|
|
->where($map)
|
|
|
|
|
->find();
|
|
|
|
|
$tauthorityData = M('user', 'tab_')->alias('u')
|
|
|
|
|
->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,
|
|
|
|
|
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($tmap)
|
|
|
|
|
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
|
|
|
|
|
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
|
|
|
|
|
->find();
|
|
|
|
|
$authorityData['today'] = $tauthorityData['today'];
|
|
|
|
|
$authorityData['week'] = $tauthorityData['week'];
|
|
|
|
|
$authorityData['mounth'] = $tauthorityData['mounth'];
|
|
|
|
|
}
|
|
|
|
|
$authorityData['promote_account'] = "官方渠道";
|
|
|
|
|
$authorityData['id'] = "1";
|
|
|
|
|
if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) {
|
|
|
|
|
$authorityData = [];
|
|
|
|
|
} else {
|
|
|
|
|
array_push($data, $authorityData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//数据排序
|
|
|
|
|
$last_names = array_column($data,'count');
|
|
|
|
|
array_multisort($last_names,SORT_DESC,$data);
|
|
|
|
|
|
|
|
|
|
$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("is_admin",is_administrator());
|
|
|
|
|
$this->assign('list_data', $data);
|
|
|
|
|
$this->assign('total', $total);
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
//TODO:
|
|
|
|
|
public 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('egt', 0);
|
|
|
|
|
$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']);
|
|
|
|
|
} else {
|
|
|
|
|
$map['pay_time'] = ['between', array(0, time())];
|
|
|
|
|
// $pay_time = " between 0 and " . time();
|
|
|
|
|
}
|
|
|
|
|
$map1['pay_status'] = $map['pay_status'] = 1;
|
|
|
|
|
$today = total(1);
|
|
|
|
|
$week = total(2);
|
|
|
|
|
$mounth = total(3);
|
|
|
|
|
unset( $map['create_time']);
|
|
|
|
|
// var_dump( $promote);
|
|
|
|
|
$tweek = total(2,false);
|
|
|
|
|
$tmonth = total(3,false);
|
|
|
|
|
//获取最小
|
|
|
|
|
$tmin = 0;
|
|
|
|
|
if($tweek[1][0] < $tmonth[1][0]){
|
|
|
|
|
$tmin = $tweek[1][0];
|
|
|
|
|
}else{
|
|
|
|
|
$tmin = $tmonth[1][0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//为数据权限添加
|
|
|
|
|
setPowerPromoteIds($map, 'tp1.id');
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
$map['tp1.id'] = $_REQUEST['promote_id'];
|
|
|
|
|
} else {
|
|
|
|
|
$map['tp1.chain'] = '/';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
|
|
$map['s.game_name'] = $_REQUEST['game_name'];
|
|
|
|
|
if (isset($_REQUEST['server_id'])) {
|
|
|
|
|
$map['s.server_id'] = $_REQUEST['server_id'];
|
|
|
|
|
unset($_REQUEST['server_id']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data = M('promote', 'tab_')->alias('tp1')
|
|
|
|
|
->field('tp1.account as promote_account,tp1.id,
|
|
|
|
|
floor(sum(pay_amount)*100) as count')
|
|
|
|
|
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
|
|
|
|
|
->join("tab_spend as s on tp2.id = s.promote_id", 'left')
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tp1.id')
|
|
|
|
|
->order('count desc')
|
|
|
|
|
->select();
|
|
|
|
|
//今日/本周/本月不变
|
|
|
|
|
$tmap = $map;
|
|
|
|
|
if(isset($map['pay_time'])){
|
|
|
|
|
$tmap['pay_time'] = ['between', array($tmin,$tmonth[1][1])];
|
|
|
|
|
}
|
|
|
|
|
$tdata = M('promote', 'tab_')->alias('tp1')
|
|
|
|
|
->field('tp1.account as promote_account,tp1.id,
|
|
|
|
|
floor(sum(IF(s.pay_time ' . $today . ',pay_amount,0))*100) as today,
|
|
|
|
|
floor(sum(IF(s.pay_time ' . $week . ',pay_amount,0))*100) as week,
|
|
|
|
|
floor(sum(IF(s.pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
|
|
|
|
|
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
|
|
|
|
|
->join("tab_spend as s on tp2.id = s.promote_id", 'left')
|
|
|
|
|
->where($tmap)
|
|
|
|
|
->group('tp1.id')
|
|
|
|
|
->select();
|
|
|
|
|
$tmdata = [];
|
|
|
|
|
foreach($data as $k=>$v){
|
|
|
|
|
$v['today'] = 0;
|
|
|
|
|
$v['week'] = 0;
|
|
|
|
|
$v['mounth'] = 0;
|
|
|
|
|
$tmdata[$v['id']] = $v;
|
|
|
|
|
}
|
|
|
|
|
foreach ($tdata as $k => $v) {
|
|
|
|
|
|
|
|
|
|
$tmdata[$v['id']]['today'] = $v['today'];
|
|
|
|
|
$tmdata[$v['id']]['week'] = $v['week'];
|
|
|
|
|
$tmdata[$v['id']]['mounth'] = $v['mounth'];
|
|
|
|
|
if (!$tmdata[$v['id']]['promote_account']) {
|
|
|
|
|
$tmdata[$v['id']]['promote_account'] = $v['promote_account'];
|
|
|
|
|
$tmdata[$v['id']]['count'] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data = [];
|
|
|
|
|
foreach($tmdata as $k => $v){
|
|
|
|
|
$data[] = $v;
|
|
|
|
|
}
|
|
|
|
|
// dd($data);
|
|
|
|
|
unset($map['tp1.id']);
|
|
|
|
|
unset($map['tp1.chain']);
|
|
|
|
|
unset($tmap['tp1.chain']);
|
|
|
|
|
unset($tmap['tp1.chain']);
|
|
|
|
|
$map['s.promote_id'] = 0;
|
|
|
|
|
$tmap['s.promote_id'] = 0;
|
|
|
|
|
$authorityData['count'] = 0;
|
|
|
|
|
|
|
|
|
|
//如果有官方渠道权限
|
|
|
|
|
$user_auth_promote_ids = session('user_auth_promote_ids');
|
|
|
|
|
if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) {
|
|
|
|
|
//官方渠道数据添加
|
|
|
|
|
$authorityData = M('spend', 'tab_')->alias('s')
|
|
|
|
|
->field('floor(sum(pay_amount)*100) as count')
|
|
|
|
|
->where($map)
|
|
|
|
|
->find();
|
|
|
|
|
$tauthorityData = M('spend', 'tab_')->alias('s')
|
|
|
|
|
->field('
|
|
|
|
|
floor(sum(IF(s.pay_time ' . $today . ',pay_amount,0))*100) as today,
|
|
|
|
|
floor(sum(IF(s.pay_time ' . $week . ',pay_amount,0))*100) as week,
|
|
|
|
|
floor(sum(IF(s.pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
|
|
|
|
|
->where($tmap)
|
|
|
|
|
->find();
|
|
|
|
|
$authorityData['today'] = $tauthorityData['today'];
|
|
|
|
|
$authorityData['week'] = $tauthorityData['week'];
|
|
|
|
|
$authorityData['mounth'] = $tauthorityData['mounth'];
|
|
|
|
|
}
|
|
|
|
|
$authorityData['promote_account'] = "官方渠道";
|
|
|
|
|
$authorityData['id'] = "1";
|
|
|
|
|
if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) {
|
|
|
|
|
$authorityData = [];
|
|
|
|
|
} else {
|
|
|
|
|
array_push($data, $authorityData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//数据排序
|
|
|
|
|
$last_names = array_column($data,'count');
|
|
|
|
|
array_multisort($last_names,SORT_DESC,$data);
|
|
|
|
|
|
|
|
|
|
$count = count($data);
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
$value['count'] ?: 0;
|
|
|
|
|
$value['today'] ?: 0;
|
|
|
|
|
$value['week'] ?: 0;
|
|
|
|
|
$value['mounth'] ?: 0;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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()函数用于求大于数字的最小整数
|
|
|
|
|
if(isset($_REQUEST['export'])){
|
|
|
|
|
data2csv($data,'推广员充值统计',array(
|
|
|
|
|
"promote_account"=>"推广员账号",
|
|
|
|
|
"count"=>"累计充值",
|
|
|
|
|
"rand"=>"排行榜",
|
|
|
|
|
"today"=>"今日充值",
|
|
|
|
|
"week"=>"本周充值",
|
|
|
|
|
"mounth"=>"本月充值",
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
$data = array_slice($data, ($arraypage - 1) * $size, $size);
|
|
|
|
|
$this->meta_title = '渠道充值统计列表';
|
|
|
|
|
$this->assign('list_data', $data);
|
|
|
|
|
$this->assign("is_admin",is_administrator());
|
|
|
|
|
$this->display();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public function promotepay_statistics1($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('egt', 0);
|
|
|
|
|
$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']);
|
|
|
|
|
} else {
|
|
|
|
|
$map['pay_time'] = ['between', array(0, time())];
|
|
|
|
|
// $pay_time = " between 0 and " . time();
|
|
|
|
|
}
|
|
|
|
|
$map1['pay_status'] = $map['pay_status'] = 1;
|
|
|
|
|
$today = total(1);
|
|
|
|
|
$week = total(2);
|
|
|
|
|
$mounth = total(3);
|
|
|
|
|
unset( $map['create_time']);
|
|
|
|
|
|
|
|
|
|
//获取所有会长
|
|
|
|
|
$promote_map = "`chain` = '/'";
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
$promote_map = "`chain` = '%/{$_REQUEST['promote_id']}/%' OR id = {$_REQUEST['promote_id']}";
|
|
|
|
|
}
|
|
|
|
|
//为数据权限添加
|
|
|
|
|
setPowerPromoteIds($map);
|
|
|
|
|
$promote_map2 = array();
|
|
|
|
|
setPowerPromoteIds($promote_map2, 'id');
|
|
|
|
|
$promote = M("promote","tab_")->field("id,account")->page($page,$row)->where($promote_map)->where($promote_map2)->select();
|
|
|
|
|
$pcount = M("promote","tab_")->field("count(*) acount")->where($promote_map)->where($promote_map2)->find()['acount'];
|
|
|
|
|
|
|
|
|
|
// var_dump( $promote);
|
|
|
|
|
$tweek = total(2,false);
|
|
|
|
|
$tmonth = total(3,false);
|
|
|
|
|
//获取最小
|
|
|
|
|
$tmin = 0;
|
|
|
|
|
if($tweek[1][0] < $tmonth[1][0]){
|
|
|
|
|
$tmin = $tweek[1][0];
|
|
|
|
|
}else{
|
|
|
|
|
$tmin = $tmonth[1][0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data =array();
|
|
|
|
|
for ($i=0; $i < count($promote); $i++) {
|
|
|
|
|
# code...
|
|
|
|
|
$proid = M("promote","tab_")->field("id")->where("`chain` like '%/{$promote[$i]['id']}/%'")->select();
|
|
|
|
|
$str = '';
|
|
|
|
|
for($k=0; $k<count($proid); $k++){
|
|
|
|
|
# code...
|
|
|
|
|
$str .= ($proid[$k]['id'].",");
|
|
|
|
|
}
|
|
|
|
|
$str .= "{$promote[$i]['id']}";
|
|
|
|
|
$map['promote_id'] = array("in",$str);
|
|
|
|
|
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']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$dbdata = $spend
|
|
|
|
|
->field('floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count')
|
|
|
|
|
->where($map)
|
|
|
|
|
->find();
|
|
|
|
|
$tmap = $map;
|
|
|
|
|
if(isset($map['pay_time'])){
|
|
|
|
|
$tmap['pay_time'] = ['between', array($tmin,$tmonth[1][1])];
|
|
|
|
|
}
|
|
|
|
|
$tdbdata = $spend
|
|
|
|
|
->field('
|
|
|
|
|
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($tmap)
|
|
|
|
|
->find();
|
|
|
|
|
$dbdata['today']= $tdbdata['today'];
|
|
|
|
|
$dbdata['week']= $tdbdata['week'];
|
|
|
|
|
$dbdata['mounth']= $tdbdata['mounth'];
|
|
|
|
|
|
|
|
|
|
$dbdata['promote_account'] = $promote[$i]['account'];
|
|
|
|
|
$dbdata['promote_id'] = $promote[$i]['id'];
|
|
|
|
|
|
|
|
|
|
$data[] = $dbdata;
|
|
|
|
|
}
|
|
|
|
|
$count = count($data);
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
$value['count'] ?: 0;
|
|
|
|
|
$value['today'] ?: 0;
|
|
|
|
|
$value['week'] ?: 0;
|
|
|
|
|
$value['mounth'] ?: 0;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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($pcount, $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()函数用于求大于数字的最小整数
|
|
|
|
|
$this->meta_title = '渠道充值统计列表';
|
|
|
|
|
$this->assign('list_data', $data);
|
|
|
|
|
$this->assign("is_admin",is_administrator());
|
|
|
|
|
$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 getSpendServer(){
|
|
|
|
|
if(isset($_REQUEST['game_name'])){
|
|
|
|
|
$game = M('Game','tab_')->field('id')->where(['game_name'=>$_REQUEST['game_name']])->find();
|
|
|
|
|
$game_id = $game['id'];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(isset($_REQUEST['game_id'])){
|
|
|
|
|
$game_id = $_REQUEST['game_id'];
|
|
|
|
|
}
|
|
|
|
|
$map['game_id'] = $game_id;
|
|
|
|
|
$map['server_name'] = array('neq','');
|
|
|
|
|
$data = M('server','tab_')->field('server_name,server_id')->where($map)->group('server_name')->select();
|
|
|
|
|
$this->AjaxReturn($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|