|
|
<?php
|
|
|
|
|
|
namespace Admin\Controller;
|
|
|
|
|
|
use User\Api\UserApi as UserApi;
|
|
|
use Org\UcenterSDK\Ucservice;
|
|
|
|
|
|
/**
|
|
|
* 后台首页控制器
|
|
|
* @author yyh
|
|
|
*/
|
|
|
class PlatformController extends ThinkController
|
|
|
{
|
|
|
//游戏汇总
|
|
|
public function game_pool(){
|
|
|
if(!array_key_exists("year",$_REQUEST)){
|
|
|
$this->redirect(ACTION_NAME, array('year' => date('Y',time())) );
|
|
|
}
|
|
|
$isExport = false;
|
|
|
if(isset($_REQUEST['export']) && $_REQUEST['export'] == 1){
|
|
|
$isExport = true;
|
|
|
}
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
if (isset($_REQUEST['row'])) {
|
|
|
$row = $_REQUEST['row'];
|
|
|
} else {
|
|
|
$row = 10;
|
|
|
}
|
|
|
$year = isset($_REQUEST['year']) ? $_REQUEST['year'] : date("Y",time());
|
|
|
$yearMap = [strtotime("$year-1-1 00:00:00"),strtotime("$year-12-31 23:59:59")];
|
|
|
|
|
|
$gameMap = "1";
|
|
|
if(isset($_REQUEST['relation_game_id'])){
|
|
|
$gameId = $_REQUEST['relation_game_id'];
|
|
|
$gameMap .= " AND relation_game_id = '{$gameId}' ";
|
|
|
}
|
|
|
|
|
|
$gameDb = M("Game","tab_");
|
|
|
$data = $gameDb
|
|
|
->field("group_concat(id) game_id,relation_game_id,relation_game_name")
|
|
|
->where($gameMap)
|
|
|
->group("relation_game_id");
|
|
|
if($isExport){
|
|
|
$data = $data->select();
|
|
|
//生成头
|
|
|
$fp = $this->setGamePoolTitle($year,"game");
|
|
|
}else{
|
|
|
$data = $data->page($page,$row)->select();
|
|
|
$countTable = $gameDb->where($gameMap)->group("relation_game_id")->select(false);
|
|
|
$count = M()->table("(".$countTable.") s")->count();
|
|
|
}
|
|
|
|
|
|
//获取游戏累计注册
|
|
|
$sendData = [];
|
|
|
foreach($data as $k=>$v){
|
|
|
|
|
|
$list = self::setGameYearList($year);
|
|
|
$this->getGameRegisterCount($list,$v['game_id'],$yearMap);
|
|
|
$this->getGamePayamountCount($list,$v['game_id'],$yearMap);
|
|
|
$v["list"] = $list;
|
|
|
$sendData[] = $v;
|
|
|
if($isExport){
|
|
|
unset($v['game_id'],$v['relation_game_id']);
|
|
|
$fp = $this->setGameCsvData($fp,$v);
|
|
|
}
|
|
|
}
|
|
|
if($isExport){
|
|
|
//刷新输出缓冲到浏览器
|
|
|
fclose($fp);
|
|
|
exit();
|
|
|
}
|
|
|
|
|
|
$th = array_keys(self::setGameYearList($year));
|
|
|
$this->assign('th', $th);
|
|
|
$this->assign('list_data', $sendData);
|
|
|
$this->assign("companyList",D("PromoteCompany")->getList());
|
|
|
$this->getYearList();
|
|
|
|
|
|
$page = set_pagination($count, $row);
|
|
|
if ($page) {
|
|
|
$this->assign('_page', $page);
|
|
|
}
|
|
|
$this->display();
|
|
|
|
|
|
}
|
|
|
|
|
|
//获取游戏注册量
|
|
|
protected function getGameRegisterCount(&$list,$gameids,$yearMap)
|
|
|
{
|
|
|
$map = [
|
|
|
"fgame_id"=>["in",$gameids],
|
|
|
"register_time"=>["between",$yearMap]
|
|
|
];
|
|
|
$Register = M("User","tab_")->field("count(id) count,FROM_UNIXTIME(`register_time`, '%Y-%m') regtime")->where($map)->group("regtime")->select();
|
|
|
if(empty($Register)) return ;
|
|
|
foreach ($Register as $v) {
|
|
|
$list[$v['regtime']]['register'] = $v['count'];
|
|
|
}
|
|
|
}
|
|
|
//获取游戏注册量
|
|
|
protected function getGamePayamountCount(&$list,$gameids,$yearMap)
|
|
|
{
|
|
|
$map = [
|
|
|
"game_id"=>["in",$gameids],
|
|
|
"pay_time"=>["between",$yearMap],
|
|
|
"pay_status"=>1
|
|
|
];
|
|
|
D("Spend")->addSubsiteWhere($map);
|
|
|
$Payamount = M("Spend","tab_")->field("sum(pay_amount) pay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
|
|
|
if(empty($Payamount)) return ;
|
|
|
foreach ($Payamount as $v) {
|
|
|
$list[$v['paytime']]['payamount'] = $v['pay_amount'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//推广员汇总
|
|
|
public function promote_pool()
|
|
|
{
|
|
|
if(!array_key_exists("year",$_REQUEST) || !array_key_exists("company_belong",$_REQUEST)){
|
|
|
$this->redirect(ACTION_NAME, array('year' => date('Y',time()),"company_belong"=>0));
|
|
|
}
|
|
|
$isExport = false;
|
|
|
if(isset($_REQUEST['export']) && $_REQUEST['export'] == 1){
|
|
|
$isExport = true;
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
if (isset($_REQUEST['row'])) {
|
|
|
$row = $_REQUEST['row'];
|
|
|
} else {
|
|
|
$row = 10;
|
|
|
}
|
|
|
$companyBelong = isset($_REQUEST['company_belong']) ? $_REQUEST['company_belong'] : 0;
|
|
|
$year = isset($_REQUEST['year']) ? $_REQUEST['year'] : date("Y",time());
|
|
|
$yearMap = [strtotime("$year-1-1 00:00:00"),strtotime("$year-12-31 23:59:59")];
|
|
|
//获取公司数据 tab_promote_company
|
|
|
$companyMap = "1";
|
|
|
if($companyBelong > -1){
|
|
|
$companyMap .= " AND company_belong = {$companyBelong}";
|
|
|
}
|
|
|
if(isset($_REQUEST['company_id'])){
|
|
|
$companyId = $_REQUEST['company_id'];
|
|
|
$companyMap .= " AND id = '{$companyId}' ";
|
|
|
}
|
|
|
|
|
|
$promoteCompany = M("promote_company","tab_");
|
|
|
$data = $promoteCompany
|
|
|
->field("id,company_name,company_belong")
|
|
|
->where($companyMap);
|
|
|
if($isExport){
|
|
|
$data = $data->select();
|
|
|
//生成头
|
|
|
$fp = $this->setPromotePoolTitle($year);
|
|
|
}else{
|
|
|
$data = $data->page($page,$row)->select();
|
|
|
$count = $promoteCompany->where($companyMap)->count();
|
|
|
}
|
|
|
|
|
|
//获取公司累计注册
|
|
|
$sendData = [];
|
|
|
foreach($data as $k=>$v){
|
|
|
$promote = getPromoteByLevel(0,$v['id']);
|
|
|
if(empty($promote)){
|
|
|
$promoteIds = '';
|
|
|
}else{
|
|
|
$promoteIds = implode(",",array_column($promote,"id"));
|
|
|
}
|
|
|
$list = self::setYearList($year);
|
|
|
$this->getRegisterCount($list,$promoteIds,$yearMap);
|
|
|
$this->getPayamountCount($list,$promoteIds,$yearMap);
|
|
|
// $this->getunPayamountCount($list,$promoteIds,$yearMap);
|
|
|
$v["list"] = $list;
|
|
|
$v["company_belong"] = getCompanyBlongOther($v["company_belong"]);
|
|
|
$sendData[] = $v;
|
|
|
if($isExport) $fp = $this->setCsvData($fp,$v);
|
|
|
}
|
|
|
|
|
|
if($isExport){
|
|
|
//刷新输出缓冲到浏览器
|
|
|
fclose($fp);
|
|
|
exit();
|
|
|
}
|
|
|
|
|
|
// dump($sendData);die();
|
|
|
|
|
|
$th = array_keys(self::setYearList($year));
|
|
|
$this->assign('th', $th);
|
|
|
$this->assign('list_data', $sendData);
|
|
|
$this->assign("companyList",D("PromoteCompany")->getList());
|
|
|
$this->getYearList();
|
|
|
|
|
|
$page = set_pagination($count, $row);
|
|
|
if ($page) {
|
|
|
$this->assign('_page', $page);
|
|
|
}
|
|
|
$this->display();
|
|
|
// var_dump($sendData);
|
|
|
|
|
|
|
|
|
}
|
|
|
//获取游戏公司每个月的注册及充值金额
|
|
|
private static function setGameYearList($year)
|
|
|
{
|
|
|
$range = [];
|
|
|
$i = 1;
|
|
|
do {
|
|
|
if($i < 10){
|
|
|
$month = "0".$i;
|
|
|
}else{
|
|
|
$month = $i;
|
|
|
}
|
|
|
$range[$year."-".$month] = ["register"=>0,"payamount"=>0];
|
|
|
$i++;
|
|
|
} while ($i<13);
|
|
|
return $range;
|
|
|
}
|
|
|
|
|
|
//获取公司每个月的注册及充值金额
|
|
|
private static function setYearList($year)
|
|
|
{
|
|
|
$range = [];
|
|
|
$i = 1;
|
|
|
do {
|
|
|
if($i < 10){
|
|
|
$month = "0".$i;
|
|
|
}else{
|
|
|
$month = $i;
|
|
|
}
|
|
|
$range[$year."-".$month] = ["register"=>0,"payamount"=>0,"unpay_amount"=>0];
|
|
|
$i++;
|
|
|
} while ($i<13);
|
|
|
return $range;
|
|
|
}
|
|
|
//获取注册量
|
|
|
protected function getRegisterCount(&$list,$promoteIds,$yearMap)
|
|
|
{
|
|
|
$map = [
|
|
|
"promote_id"=>["in",$promoteIds],
|
|
|
"register_time"=>["between",$yearMap]
|
|
|
];
|
|
|
$Register = M("User","tab_")->field("count(id) count,FROM_UNIXTIME(`register_time`, '%Y-%m') regtime")->where($map)->group("regtime")->select();
|
|
|
if(empty($Register)) return ;
|
|
|
foreach ($Register as $v) {
|
|
|
$list[$v['regtime']]['register'] = $v['count'];
|
|
|
}
|
|
|
}
|
|
|
//获取支付流水
|
|
|
protected function getPayamountCount(&$list,$promoteIds,$yearMap)
|
|
|
{
|
|
|
$map = [
|
|
|
"promote_id"=>["in",$promoteIds],
|
|
|
"pay_time"=>["between",$yearMap],
|
|
|
"pay_status"=>1
|
|
|
];
|
|
|
D("Spend")->addSubsiteWhere($map);
|
|
|
$Payamount = M("Spend","tab_")->field("sum(IF(is_check=1,pay_amount,0)) pay_amount,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
|
|
|
if(empty($Payamount)) return ;
|
|
|
foreach ($Payamount as $v) {
|
|
|
$list[$v['paytime']]['payamount'] = $v['pay_amount'];
|
|
|
$list[$v['paytime']]['unpay_amount'] = $v['unpay_amount'];
|
|
|
}
|
|
|
}
|
|
|
//获取未结算流水
|
|
|
protected function getunPayamountCount(&$list,$promoteIds,$yearMap)
|
|
|
{
|
|
|
$map = [
|
|
|
"promote_id"=>["in",$promoteIds],
|
|
|
"pay_time"=>["between",$yearMap],
|
|
|
"pay_status"=>1
|
|
|
];
|
|
|
$Payamount = M("Spend","tab_")->field("sum(IF(is_check=2,pay_amount,0)) pay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
|
|
|
if(empty($Payamount)) return ;
|
|
|
foreach ($Payamount as $v) {
|
|
|
$list[$v['paytime']]['unpayamount'] = $v['pay_amount'];
|
|
|
}
|
|
|
}
|
|
|
//获取所有年分
|
|
|
protected function getYearList()
|
|
|
{
|
|
|
$star = 2019;
|
|
|
$end = date("Y",time());
|
|
|
$list = [];
|
|
|
for ($i=$star; $i <= $end; $i++) {
|
|
|
$temp = array(
|
|
|
"value"=>$i,
|
|
|
"name"=>"{$i}年"
|
|
|
);
|
|
|
$list[] = $temp ;
|
|
|
}
|
|
|
$this->assign('YearList', $list);
|
|
|
}
|
|
|
|
|
|
//获取导出头
|
|
|
private static function setGamePoolTitle($year,$type="promote")
|
|
|
{
|
|
|
if($type =="promote"){
|
|
|
$range = ["推广公司","内外团归属"];
|
|
|
$csvFileName = '推广公司汇总.csv';
|
|
|
}else{
|
|
|
$range = ["游戏名称"];
|
|
|
$csvFileName = '游戏汇总.csv';
|
|
|
}
|
|
|
|
|
|
$i = 1;
|
|
|
do {
|
|
|
if($i < 10){
|
|
|
$month = "0".$i;
|
|
|
}else{
|
|
|
$month = $i;
|
|
|
}
|
|
|
$range[] = $year."年".$month."月注册数";
|
|
|
$range[] = $year."年".$month."月充值流水";
|
|
|
$i++;
|
|
|
} while ($i<13);
|
|
|
|
|
|
//设置好告诉浏览器要下载excel文件的headers
|
|
|
header('Content-Description: File Transfer');
|
|
|
header('Content-Type: application/vnd.ms-excel');
|
|
|
header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
|
|
|
header('Expires: 0');
|
|
|
header('Cache-Control: must-revalidate');
|
|
|
header('Pragma: public');
|
|
|
$fp = fopen('php://output', 'a');//打开output流
|
|
|
mb_convert_variables('GBK', 'UTF-8', $range);
|
|
|
fputcsv($fp, $range);//将数据格式化为CSV格式并写入到output流中
|
|
|
|
|
|
return $fp;
|
|
|
}
|
|
|
|
|
|
//获取导出头
|
|
|
private static function setPromotePoolTitle($year,$type="promote")
|
|
|
{
|
|
|
if($type =="promote"){
|
|
|
$range = ["推广公司","内外团归属"];
|
|
|
$csvFileName = '推广公司汇总.csv';
|
|
|
}else{
|
|
|
$range = ["游戏名称"];
|
|
|
$csvFileName = '游戏汇总.csv';
|
|
|
}
|
|
|
|
|
|
$i = 1;
|
|
|
do {
|
|
|
if($i < 10){
|
|
|
$month = "0".$i;
|
|
|
}else{
|
|
|
$month = $i;
|
|
|
}
|
|
|
$range[] = $year."年".$month."月注册数";
|
|
|
$range[] = $year."年".$month."月充值流水";
|
|
|
$range[] = $year."年".$month."月不结算充值流水";
|
|
|
$i++;
|
|
|
} while ($i<13);
|
|
|
|
|
|
//设置好告诉浏览器要下载excel文件的headers
|
|
|
header('Content-Description: File Transfer');
|
|
|
header('Content-Type: application/vnd.ms-excel');
|
|
|
header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
|
|
|
header('Expires: 0');
|
|
|
header('Cache-Control: must-revalidate');
|
|
|
header('Pragma: public');
|
|
|
$fp = fopen('php://output', 'a');//打开output流
|
|
|
mb_convert_variables('GBK', 'UTF-8', $range);
|
|
|
fputcsv($fp, $range);//将数据格式化为CSV格式并写入到output流中
|
|
|
|
|
|
return $fp;
|
|
|
}
|
|
|
|
|
|
//获取导出头
|
|
|
private static function setGameCsvData($fp,$data)
|
|
|
{
|
|
|
unset($data['id']);
|
|
|
$sendData = [];
|
|
|
foreach ($data as $key => $value) {
|
|
|
if($key != "list"){
|
|
|
$sendData[] = $value;
|
|
|
}
|
|
|
}
|
|
|
foreach ($data['list'] as $key => $value) {
|
|
|
$sendData[] = $value['register'];
|
|
|
$sendData[] = $value['payamount'];
|
|
|
}
|
|
|
mb_convert_variables('GBK', 'UTF-8', $sendData);
|
|
|
fputcsv($fp, $sendData);//将数据格式化为CSV格式并写入到output流中
|
|
|
ob_flush();
|
|
|
flush();
|
|
|
return $fp;
|
|
|
}
|
|
|
|
|
|
//获取导出头
|
|
|
private static function setCsvData($fp,$data)
|
|
|
{
|
|
|
unset($data['id']);
|
|
|
$sendData = [];
|
|
|
foreach ($data as $key => $value) {
|
|
|
if($key != "list"){
|
|
|
$sendData[] = $value;
|
|
|
}
|
|
|
}
|
|
|
foreach ($data['list'] as $key => $value) {
|
|
|
$sendData[] = $value['register'];
|
|
|
$sendData[] = $value['payamount'];
|
|
|
$sendData[] = $value['unpay_amount'];
|
|
|
}
|
|
|
mb_convert_variables('GBK', 'UTF-8', $sendData);
|
|
|
fputcsv($fp, $sendData);//将数据格式化为CSV格式并写入到output流中
|
|
|
ob_flush();
|
|
|
flush();
|
|
|
return $fp;
|
|
|
}
|
|
|
|
|
|
|
|
|
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_id']) && $_REQUEST['game_id'] != '') {
|
|
|
$map['tab_game.relation_game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['game_type'])) {
|
|
|
$map['tab_game.sdk_version'] = $_REQUEST['game_type'];
|
|
|
}
|
|
|
|
|
|
$today = total(1);
|
|
|
$week = total(2);
|
|
|
$mounth = total(3);
|
|
|
//为数据权限添加
|
|
|
setPowerPromoteIds($map);
|
|
|
$data = $user
|
|
|
->field('tab_game.relation_game_id,tab_game.relation_game_name,date_format(FROM_UNIXTIME( register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count')
|
|
|
->where($map)
|
|
|
->join('tab_game on tab_game.id = fgame_id', 'left')
|
|
|
->group('tab_game.relation_game_id')
|
|
|
->order('count desc,register_time')
|
|
|
->select();
|
|
|
$map2 = array();
|
|
|
$map2['fgame_id'] = array('egt', 0);
|
|
|
$map2['puid'] = 0;
|
|
|
|
|
|
if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') {
|
|
|
$map2['tab_game.relation_game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['game_type'])) {
|
|
|
$map2['tab_game.sdk_version'] = $_REQUEST['game_type'];
|
|
|
}
|
|
|
setPowerPromoteIds($map2);
|
|
|
|
|
|
$data2 = $user->field('tab_game.relation_game_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)
|
|
|
->join('tab_game on tab_game.id = fgame_id', 'left')
|
|
|
->group('tab_game.relation_game_id')
|
|
|
->select();
|
|
|
$data2 = array_column($data2, null, 'relation_game_id');
|
|
|
$count = count($data);
|
|
|
foreach ($data as $key => $value) {
|
|
|
static $i = 0;
|
|
|
$i++;
|
|
|
$data[$key]['rand'] = $i;
|
|
|
|
|
|
if ($data[$key]['relation_game_id'] == 0) {
|
|
|
$data[$key]['relation_game_name'] = '其他注册';
|
|
|
}
|
|
|
$data[$key]['today'] = $data2[$value['relation_game_id']]['today'];
|
|
|
$data[$key]['week'] = $data2[$value['relation_game_id']]['week'];
|
|
|
$data[$key]['mounth'] = $data2[$value['relation_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->checkListOrCountAuthRestMap($map,[]);
|
|
|
//dd($data);
|
|
|
$this->meta_title = '游戏注册统计列表';
|
|
|
$this->assign('list_data', $data);
|
|
|
$this->assign('games', M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select());
|
|
|
$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_id']) && $_REQUEST['game_id'] != '') {
|
|
|
$map['tab_game.relation_game_id'] = $_REQUEST['game_id'];
|
|
|
//unset($_REQUEST['game_id']);
|
|
|
}
|
|
|
if (!empty($_REQUEST['game_type'])) {
|
|
|
$map['tab_spend.sdk_version'] = $_REQUEST['game_type'];
|
|
|
//unset($_REQUEST['game_type']);
|
|
|
}
|
|
|
$map['tab_spend.pay_status'] = 1;
|
|
|
$today = total(1);
|
|
|
$week = total(2);
|
|
|
$mounth = total(3);
|
|
|
D("Spend")->addSubsiteWhere($map,"tab_spend");
|
|
|
$data = $spend
|
|
|
->field('tab_game.relation_game_name as game_name, tab_game.relation_game_id as game_id,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count')
|
|
|
->where($map)
|
|
|
->join('tab_game on tab_game.id = tab_spend.game_id', 'left')
|
|
|
->group('tab_game.relation_game_id')
|
|
|
->order('count desc,pay_time')
|
|
|
->select();
|
|
|
|
|
|
//今日、本周、本月不随搜索条件而变动
|
|
|
$map2['tab_spend.pay_status'] = 1;
|
|
|
$map2['game_id'] = array('gt', 0);
|
|
|
// var_dump($_REQUEST);exit;
|
|
|
if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') {
|
|
|
$map2['tab_game.relation_game_id'] = $_REQUEST['game_id'];
|
|
|
//unset($_REQUEST['game_id']);
|
|
|
}
|
|
|
if (!empty($_REQUEST['game_type'])) {
|
|
|
$map2['tab_spend.sdk_version'] = $_REQUEST['game_type'];
|
|
|
//unset($_REQUEST['game_type']);
|
|
|
}
|
|
|
setPowerPromoteIds($map2);
|
|
|
D("Spend")->addSubsiteWhere($map2,"tab_spend");
|
|
|
$data2 = $spend
|
|
|
->field('tab_game.relation_game_id as 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')
|
|
|
->join('tab_game on tab_game.id = tab_spend.game_id', 'left')
|
|
|
->where($map2)
|
|
|
->group('tab_game.relation_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);
|
|
|
}
|
|
|
|
|
|
$this->checkListOrCountAuthRestMap($map,[]);
|
|
|
|
|
|
$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->assign('games', M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select());
|
|
|
$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->checkListOrCountAuthRestMap($map,[]);
|
|
|
|
|
|
$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);
|
|
|
D("Spend")->addSubsiteWhere($map);
|
|
|
$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);
|
|
|
D("Spend")->addSubsiteWhere($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);
|
|
|
}
|
|
|
|
|
|
$this->checkListOrCountAuthRestMap($map,[]);
|
|
|
|
|
|
$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'] = ['like', "{$_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 like '{$_REQUEST['game_name']}%'";
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['admin_id'])) {
|
|
|
$map['promote.admin_id'] = $_REQUEST['admin_id'];
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['game_type'])) {
|
|
|
$map['tab_game.sdk_version'] = $_REQUEST['game_type'];
|
|
|
}
|
|
|
|
|
|
$today = total(1);
|
|
|
$week = total(2);
|
|
|
$mounth = total(3);
|
|
|
$isOffice = true;
|
|
|
if (isset($_REQUEST['promote_id']) || isset($_REQUEST['company_id'])) {
|
|
|
$isOffice = false;
|
|
|
$pwhere = "1";
|
|
|
if(isset($_REQUEST['promote_id'])){
|
|
|
$pwhere .= " and (chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']})";
|
|
|
}
|
|
|
if(isset($_REQUEST['company_id'])){
|
|
|
$pwhere .= " and company_id={$_REQUEST['company_id']}";
|
|
|
}
|
|
|
$promoter_ids = D("Promote")->where($pwhere)->field('id')->select();
|
|
|
|
|
|
if ($promoter_ids) {
|
|
|
$map['u.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
|
|
|
}else{
|
|
|
$map['u.promote_id'] = -999;
|
|
|
}
|
|
|
}
|
|
|
$promoteTableMap = 'tab_promote promote ON u.promote_id = promote.id';
|
|
|
if (isset($_REQUEST['company_belong'])){
|
|
|
$isOffice = false;
|
|
|
$promoteTableMap .= " and promote.company_belong = {$_REQUEST['company_belong']}";
|
|
|
}
|
|
|
if($isOffice){
|
|
|
$promoteTableMap = "left join ".$promoteTableMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
// 如果是市场专员那么只能看自己的会长信息
|
|
|
$isMarketAdmin = isMarketAdmin();
|
|
|
if ($isMarketAdmin) {
|
|
|
$map['promote.admin_id'] = is_login();
|
|
|
}
|
|
|
|
|
|
//为数据权限添加
|
|
|
setPowerPromoteIds($map, 'u.promote_id');
|
|
|
|
|
|
$data = M("User u","tab_")
|
|
|
->field("
|
|
|
count(u.id) as count,
|
|
|
IFNULL(tab_game.relation_game_id,0) relation_game_id,
|
|
|
IFNULL(tab_game.relation_game_name,'其他渠道') relation_game_name,
|
|
|
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',
|
|
|
u.promote_id,
|
|
|
substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
|
|
|
->join($promoteTableMap)
|
|
|
->join($play_map ? "left join tab_user_play as up on up.user_id = u.id " . $play_map : false)
|
|
|
->join($play_info_map ? "left join tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
|
|
|
->join('tab_game on u.fgame_id = tab_game.id',"left")
|
|
|
->where($map)
|
|
|
->group('tab_game.relation_game_id, 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("User u","tab_")
|
|
|
->field("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,
|
|
|
IFNULL(tab_game.relation_game_id,0) relation_game_id,
|
|
|
IFNULL(tab_game.relation_game_name,'其他渠道') relation_game_name,
|
|
|
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',u.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
|
|
|
->join($promoteTableMap)
|
|
|
->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)
|
|
|
->join('tab_game on u.fgame_id = tab_game.id')
|
|
|
->where($tmap)
|
|
|
->group('tab_game.relation_game_id, id')
|
|
|
->order('register_time')
|
|
|
->select();
|
|
|
|
|
|
$tmdata = [];
|
|
|
foreach($data as $k=>$v){
|
|
|
$v['today'] = 0;
|
|
|
$v['week'] = 0;
|
|
|
$v['mounth'] = 0;
|
|
|
$tag = "{$v['id']}-{$v['relation_game_id']}";
|
|
|
$tmdata[$tag] = $v;
|
|
|
}
|
|
|
|
|
|
// 填入日/周/月统计
|
|
|
if(!empty($tdata)){
|
|
|
foreach ($tdata as $k => $v) {
|
|
|
$tag = "{$v['id']}-{$v['relation_game_id']}";
|
|
|
$tmdata[$tag]['today'] = $v['today'];
|
|
|
$tmdata[$tag]['week'] = $v['week'];
|
|
|
$tmdata[$tag]['mounth'] = $v['mounth'];
|
|
|
if (empty($tmdata[$tag]['relation_game_name']) && !empty($v['relation_game_name'])) {
|
|
|
$tmdata[$tag]['relation_game_name'] = $v['relation_game_name'];
|
|
|
}
|
|
|
$tmdata[$tag]['id'] = $v['id'];
|
|
|
}
|
|
|
}
|
|
|
$data = array_values($tmdata);
|
|
|
|
|
|
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;
|
|
|
//数据排序
|
|
|
$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);
|
|
|
}
|
|
|
|
|
|
$this->checkListOrCountAuthRestMap($map,[]);
|
|
|
|
|
|
$data = my_sort($data, $data_order_type, (int)$data_order);
|
|
|
if(isset($_REQUEST["export"])){
|
|
|
$size = 999999;
|
|
|
}else{
|
|
|
$size = $row;//每页显示的记录数
|
|
|
}
|
|
|
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
$data = array_slice($data, ($arraypage - 1) * $size, $size);
|
|
|
$companys = !empty($data) ? M('promote', 'tab_')
|
|
|
->field('tab_promote.id, tab_promote.account as promote_account, company_name, sys_member.nickname as admin_username')
|
|
|
->join("tab_promote_company on tab_promote.company_id = tab_promote_company.id", 'left')
|
|
|
->join('sys_member on tab_promote.admin_id = sys_member.uid', 'left')
|
|
|
->where("tab_promote.id in (".implode(',', array_column($data, 'id')).")")->select() : [];
|
|
|
|
|
|
$companys = $companys ? array_column($companys, null, 'id') : [];
|
|
|
foreach ($data as &$item) {
|
|
|
$item['company_name'] = $companys[$item['id']]['company_name'] ?? '无';
|
|
|
$item['admin_username'] = $companys[$item['id']]['admin_username'] ?? '无';
|
|
|
if($item['id'] == 0){
|
|
|
$item['promote_account'] = C('OFFICIEL_CHANNEL');
|
|
|
} else {
|
|
|
$item['promote_account'] = $companys[$item['id']]['promote_account'];
|
|
|
}
|
|
|
}
|
|
|
if(isset($_REQUEST["export"])){
|
|
|
data2csv($data,'推广员注册统计',array(
|
|
|
'company_name' => '公司',
|
|
|
"promote_account"=>"推广员账号",
|
|
|
'admin_username' => '市场专员',
|
|
|
'relation_game_name' => '游戏',
|
|
|
"count"=>"累计注册",
|
|
|
"rand"=>"排行榜",
|
|
|
"today"=>"今日注册",
|
|
|
"week"=>"本周注册",
|
|
|
"mounth"=>"本月注册",
|
|
|
));
|
|
|
}
|
|
|
$this->meta_title = '渠道注册统计列表';
|
|
|
$this->assign("is_admin",is_administrator());
|
|
|
$this->assign('list_data', $data);
|
|
|
$this->assign('admin_users', M('member')->field('uid,nickname')->select());
|
|
|
$this->assign("companyList",D("PromoteCompany")->getList());
|
|
|
$this->assign('total', $total);
|
|
|
$this->display();
|
|
|
}
|
|
|
//TODO:
|
|
|
public function promotepay_statistics($p = 0)
|
|
|
{
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage = $page;
|
|
|
|
|
|
if(!array_key_exists("timestart",$_REQUEST)){
|
|
|
$this->redirect(ACTION_NAME, array('timestart' => date('Y-m-d',strtotime('-7 day')),"timeend"=>date('Y-m-d')));
|
|
|
}
|
|
|
|
|
|
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['s.pay_status'] = $map['s.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];
|
|
|
}
|
|
|
$isOffice = true;
|
|
|
if (isset($_REQUEST['promote_id']) || isset($_REQUEST['company_id']) ) {
|
|
|
$isOffice = false;
|
|
|
$pwhere = "1";
|
|
|
if(isset($_REQUEST['promote_id'])){
|
|
|
$pwhere .= " and (chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']})";
|
|
|
$map['tp1.id'] = $_REQUEST['promote_id'];
|
|
|
}
|
|
|
if(isset($_REQUEST['company_id'])){
|
|
|
$map['tp1.company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
|
$pwhere .= " and company_id={$_REQUEST['company_id']}";
|
|
|
}
|
|
|
$promoter_ids = D("Promote")->where($pwhere)->field('id')->select();
|
|
|
if ($promoter_ids) {
|
|
|
$map['tp2.id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
|
|
|
}
|
|
|
} else {
|
|
|
$map['tp1.chain'] = '/';
|
|
|
}
|
|
|
$map['tp1.level'] = '1';
|
|
|
|
|
|
if (isset($_REQUEST['company_belong'])){
|
|
|
$isOffice = false;
|
|
|
$map['tp1.company_belong'] = $_REQUEST['company_belong'];
|
|
|
}
|
|
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
$map['s.game_name'] = ['like', "{$_REQUEST['game_name']}%"];
|
|
|
if (isset($_REQUEST['server_id'])) {
|
|
|
$map['s.server_id'] = $_REQUEST['server_id'];
|
|
|
unset($_REQUEST['server_id']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['game_type'])) {
|
|
|
$map['s.sdk_version'] = $_REQUEST['game_type'];
|
|
|
}
|
|
|
|
|
|
if (isMarketAdmin()) {
|
|
|
$map['s.market_admin_id'] = is_login();
|
|
|
} else if (!empty($_REQUEST['admin_id'])) {
|
|
|
$map['s.market_admin_id'] = $_REQUEST['admin_id'];
|
|
|
} else {
|
|
|
//为数据权限添加
|
|
|
setPowerPromoteIds($map, 'tp1.id');
|
|
|
}
|
|
|
D("Spend")->addSubsiteWhere($map,"s");
|
|
|
|
|
|
$data = M('promote', 'tab_')->alias('tp1')
|
|
|
->field('tp1.account as promote_account,tp1.id,g.relation_game_id,g.relation_game_name,
|
|
|
floor(sum(IF(is_check=1,pay_amount,0))*100) as count,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_count')
|
|
|
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
|
|
|
->join("tab_spend as s use INDEX(search) on tp2.id = s.promote_id", 'left')
|
|
|
->join("tab_game as g on g.id = s.game_id", 'left')
|
|
|
->where($map)
|
|
|
->group('tp1.id, g.relation_game_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,g.relation_game_id,g.relation_game_name,
|
|
|
floor(sum(IF(s.pay_time ' . $today . ' and is_check=1,pay_amount,0))*100) as today,
|
|
|
floor(sum(IF(s.pay_time ' . $week . ' and is_check=1,pay_amount,0))*100) as week,
|
|
|
floor(sum(IF(s.pay_time ' . $mounth . ' and is_check=1,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')
|
|
|
->join("tab_game as g on g.id = s.game_id", 'left')
|
|
|
->where($tmap)
|
|
|
->group('tp1.id, g.relation_game_id')
|
|
|
->select();
|
|
|
|
|
|
$tmdata = [];
|
|
|
foreach($data as $k=>$v){
|
|
|
$v['today'] = 0;
|
|
|
$v['week'] = 0;
|
|
|
$v['mounth'] = 0;
|
|
|
$tag = "{$v['id']}-{$v['relation_game_id']}";
|
|
|
$tmdata[$tag] = $v;
|
|
|
}
|
|
|
//dd($data);
|
|
|
foreach ($tdata as $k => $v) {
|
|
|
|
|
|
$tag = "{$v['id']}-{$v['relation_game_id']}";
|
|
|
|
|
|
$tmdata[$tag]['today'] = $v['today'];
|
|
|
$tmdata[$tag]['week'] = $v['week'];
|
|
|
$tmdata[$tag]['mounth'] = $v['mounth'];
|
|
|
if (!$tmdata[$tag]['promote_account']) {
|
|
|
$tmdata[$tag]['promote_account'] = $v['promote_account'];
|
|
|
$tmdata[$tag]['count'] = 0;
|
|
|
}
|
|
|
|
|
|
if (empty( $tmdata[$tag]['relation_game_name']) && !empty($v['relation_game_name'])) {
|
|
|
$tmdata[$tag]['relation_game_name'] = $v['relation_game_name'];
|
|
|
}
|
|
|
|
|
|
$tmdata[$tag]['id'] = $v['id'];
|
|
|
}
|
|
|
|
|
|
$data = [];
|
|
|
foreach($tmdata as $k => $v){
|
|
|
$data[] = $v;
|
|
|
}
|
|
|
if ($isOffice) {
|
|
|
//dd($data);
|
|
|
unset($map['tp1.id'], $map['tp2.id'], $map['tp2.admin_id'],$map['tp1.company_id'],$map['tp1.company_belong'],$map['tp1.level']);
|
|
|
unset($map['tp1.chain']);
|
|
|
unset($tmap['tp1.id']);
|
|
|
unset($tmap['tp1.chain'], $tmap['tp2.id'],$tmap['tp1.company_id'],$tmap['tp1.company_belong'],$tmap['tp1.level']);
|
|
|
$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(IF(is_check=1,pay_amount,0))*100) as count,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_count')
|
|
|
->where($map)
|
|
|
->find();
|
|
|
$tauthorityData = M('spend', 'tab_')->alias('s')
|
|
|
->field('
|
|
|
floor(sum(IF(s.pay_time ' . $today . ' and is_check=1,pay_amount,0))*100) as today,
|
|
|
floor(sum(IF(s.pay_time ' . $week . ' and is_check=1,pay_amount,0))*100) as week,
|
|
|
floor(sum(IF(s.pay_time ' . $mounth . ' and is_check=1,pay_amount,0))*100) as mounth')
|
|
|
->where($tmap)
|
|
|
->find();
|
|
|
$authorityData['today'] = $tauthorityData['today'];
|
|
|
$authorityData['week'] = $tauthorityData['week'];
|
|
|
$authorityData['mounth'] = $tauthorityData['mounth'];
|
|
|
}
|
|
|
$authorityData['promote_account'] = C('OFFICIEL_CHANNEL');
|
|
|
$authorityData['id'] = "0";
|
|
|
if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) {
|
|
|
$authorityData = [];
|
|
|
} else {
|
|
|
array_push($data, $authorityData);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// dump($data);die();
|
|
|
|
|
|
//数据排序
|
|
|
$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]['unpay_count'] = $value['unpay_count'] ? $value['unpay_count'] : 0;
|
|
|
$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;//每页显示的记录数
|
|
|
$companys = !empty($data) ? M('promote', 'tab_')
|
|
|
->field('tab_promote.id, company_name, sys_member.nickname as admin_username')
|
|
|
->join("tab_promote_company on tab_promote.company_id = tab_promote_company.id", 'left')
|
|
|
->join('sys_member on tab_promote.admin_id = sys_member.uid', 'left')
|
|
|
->where("tab_promote.id in (".implode(',', array_column($data, 'id')).")")->select() : [];
|
|
|
$companys = $companys ? array_column($companys, null, 'id') : [];
|
|
|
foreach ($data as &$item) {
|
|
|
$item['company_name'] = $companys[$item['id']]['company_name'] ?? '无';
|
|
|
$item['admin_username'] = $companys[$item['id']]['admin_username'] ?? '无';
|
|
|
}
|
|
|
|
|
|
if(isset($_REQUEST['export'])){
|
|
|
|
|
|
$GetData = $_GET;
|
|
|
unset($GetData['export']);
|
|
|
|
|
|
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出推广员充值统计','url'=>U('Platform/promotepay_statistics',$GetData),'menu'=>'统计-统计-推广员统计-推广员充值统计']);
|
|
|
|
|
|
data2csv($data,'推广员充值统计',array(
|
|
|
'company_name' => '公司',
|
|
|
"promote_account"=>"会长账号",
|
|
|
'admin_username' => '当前市场专员',
|
|
|
'relation_game_name' => '游戏',
|
|
|
"count"=>"累计充值",
|
|
|
"unpay_count"=>"累计不结算充值",
|
|
|
"rand"=>"排行榜",
|
|
|
"today"=>"今日充值",
|
|
|
"week"=>"本周充值",
|
|
|
"mounth"=>"本月充值",
|
|
|
));
|
|
|
}
|
|
|
|
|
|
$this->checkListOrCountAuthRestMap($map,[]);
|
|
|
|
|
|
$data = array_slice($data, ($arraypage - 1) * $size, $size);
|
|
|
$this->meta_title = '渠道充值统计列表';
|
|
|
$this->assign('list_data', $data);
|
|
|
$this->assign('admin_users', M('member')->field('uid,nickname')->select());
|
|
|
$this->assign("companyList",D("PromoteCompany")->getList());
|
|
|
$this->assign("is_admin",is_administrator());
|
|
|
$this->display();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public function data_total($data)
|
|
|
{
|
|
|
$total['sum_count'] = array_sum(array_column($data, 'count'));
|
|
|
$total['unpay_count'] = array_sum(array_column($data, 'unpay_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 = SM($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();
|
|
|
}
|
|
|
}
|