diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 2f9d589e1..ac5fcfb6e 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -3153,7 +3153,7 @@ class ExportController extends Controller private function game_statistics_export($p = 1){ $xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:"游戏注册统计"; $xlsCell = array( - array('fgame_name', "游戏名称"), + array('relation_game_name', "游戏名称"), array('count', "累计注册"), array('rand', "排行榜"), array('today', "今日注册"), @@ -3181,9 +3181,9 @@ class ExportController extends Controller $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); unset($_REQUEST['start']);unset($_REQUEST['end']); } - if(isset($_REQUEST['game_name'])&&$_REQUEST['game_name']!=''){ - $map['fgame_name'] =$_REQUEST['game_name']; - unset($_REQUEST['fgame_name']); + if(isset($_REQUEST['game_id'])&&$_REQUEST['game_id']!=''){ + $map['tab_game.relation_game_id'] =$_REQUEST['game_id']; + unset($_REQUEST['game_id']); } $today = total(1); $week = total(2); @@ -3191,9 +3191,10 @@ class ExportController extends Controller //为数据权限添加 setPowerPromoteIds($map); $data = $user - ->field('fgame_name,fgame_id,date_format(FROM_UNIXTIME( register_time),"%Y-%m-%d") AS time, count(id) as count') + ->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') + ->join('tab_game on tab_game.id = fgame_id', 'left') ->where($map) - ->group('fgame_id') + ->group('tab_game.relation_game_id') ->order('count desc,register_time') ->select(); // dd($data); @@ -3205,8 +3206,9 @@ class ExportController extends Controller $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') + ->join('tab_game on tab_game.id = fgame_id', 'left') ->where($map2) - ->group('fgame_id') + ->group('tab_game.relation_game_id') ->select(); $data2 = array_column($data2, null, 'fgame_id'); // dd($data2); @@ -3216,8 +3218,8 @@ class ExportController extends Controller $i++; $data[$key]['rand'] = $i; - if ($data[$key]['fgame_id'] == 0) { - $data[$key]['fgame_name'] = '其他注册'; + if ($data[$key]['relation_game_id'] == 0) { + $data[$key]['relation_game_name'] = '其他注册'; } $data[$key]['today'] = $data2[$value['fgame_id']]['today']; $data[$key]['week'] = $data2[$value['fgame_id']]['week']; @@ -3237,7 +3239,7 @@ class ExportController extends Controller // $data = array_slice($data, ($arraypage-1)*$size, $size); $length = count($data); $data[$length] = array( - 'fgame_name'=>'汇总', + 'relation_game_name'=>'汇总', 'count'=>$total['sum_count'], 'rand'=>'---', 'today'=>$total['sum_today'], @@ -3249,7 +3251,6 @@ class ExportController extends Controller unset($GetData['xlsname']); addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出游戏注册统计','url'=>U('Platform/game_statistics',$GetData),'menu'=>'统计-统计-平台统计-游戏注册统计']); - $xlsData = $data; $this->exportExcel($xlsName, $xlsCell, $xlsData); } @@ -3283,28 +3284,30 @@ class ExportController extends Controller $map['game_id'] =$_REQUEST['game_name']; unset($_REQUEST['game_name']); } - $map['pay_status'] = 1; + $map['tab_spend.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) + ->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') ->where($map) - ->group('game_id') + ->group('tab_game.relation_game_id') ->order('count desc,pay_time') ->select(); //今日、本周、本月不随搜索条件而变动 - $map2['pay_status'] = 1; + $map2['tab_spend.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, + ->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('game_id') + ->group('tab_game.relation_game_id') ->select(); $data2 = array_column($data2, null, 'game_id'); $count = count($data); diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index 1236ffafd..9b2b6d1f1 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -40,9 +40,9 @@ class PlatformController extends ThinkController } // var_dump($_REQUEST);exit; - if (isset($_REQUEST['game_name']) && $_REQUEST['game_name'] != '') { - $map['fgame_name'] = $_REQUEST['game_name']; - unset($_REQUEST['fgame_name']); + if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { + $map['tab_game.relation_game_id'] = $_REQUEST['game_id']; + unset($_REQUEST['game_id']); } $today = total(1); @@ -51,9 +51,10 @@ class PlatformController extends ThinkController //为数据权限添加 setPowerPromoteIds($map); $data = $user - ->field('fgame_name,fgame_id,date_format(FROM_UNIXTIME( register_time),"%Y-%m-%d") AS time, count(id) as count') + ->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) - ->group('fgame_id') + ->join('tab_game on tab_game.id = fgame_id', 'left') + ->group('tab_game.relation_game_id') ->order('count desc,register_time') ->select(); $map2 = array(); @@ -61,25 +62,26 @@ class PlatformController extends ThinkController $map2['puid'] = 0; setPowerPromoteIds($map2); - $data2 = $user->field('fgame_id,count(IF(register_time ' . $today . ',1,null)) as today, + $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) - ->group('fgame_id') + ->join('tab_game on tab_game.id = fgame_id', 'left') + ->group('tab_game.relation_game_id') ->select(); - $data2 = array_column($data2, null, 'fgame_id'); + $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]['fgame_id'] == 0) { - $data[$key]['fgame_name'] = '其他注册'; + if ($data[$key]['relation_game_id'] == 0) { + $data[$key]['relation_game_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']; + $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); @@ -103,9 +105,10 @@ class PlatformController extends ThinkController $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(); } @@ -142,32 +145,34 @@ class PlatformController extends ThinkController $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']); + if (isset($_REQUEST['game_id']) && $_REQUEST['game_id'] != '') { + $map['tab_game.relation_game_id'] = $_REQUEST['game_id']; + unset($_REQUEST['game_id']); } - $map['pay_status'] = 1; + $map['tab_spend.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) + ->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) ->where($map) - ->group('game_id') + ->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['pay_status'] = 1; + $map2['tab_spend.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, + ->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') + 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('game_id') + ->group('tab_game.relation_game_id') ->select(); $data2 = array_column($data2, null, 'game_id'); $count = count($data); @@ -205,6 +210,7 @@ class PlatformController extends ThinkController $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(); } diff --git a/Application/Admin/View/Platform/game_statistics.html b/Application/Admin/View/Platform/game_statistics.html index c9c4ed67d..759059d82 100644 --- a/Application/Admin/View/Platform/game_statistics.html +++ b/Application/Admin/View/Platform/game_statistics.html @@ -58,10 +58,10 @@