From 5f673b346d22ef213eb5b4a0ada8bf6fb6d38144 Mon Sep 17 00:00:00 2001 From: zyx Date: Wed, 6 Nov 2019 14:31:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=88=E7=BB=93=E7=BB=9F=E8=AE=A1=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=83=A8=E9=95=BF=E6=B8=A0=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 114 ++++++- .../Controller/FinanceController.class.php | 113 ++++++- .../Admin/View/Finance/getMiniterUser.html | 286 ++++++++++++++++++ .../Admin/View/Finance/getParentUser.html | 7 +- .../Admin/View/Finance/getPromoteUser.html | 2 +- .../Admin/View/Finance/getRootUser.html | 2 +- 6 files changed, 490 insertions(+), 34 deletions(-) create mode 100644 Application/Admin/View/Finance/getMiniterUser.html diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index a40c1dcd9..b4f362db4 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -5392,10 +5392,14 @@ if ($key == 'model'){ if ($root_id == '0') { $map['_string'] = "promote_id = {$root_id}"; } else if($root_id){ - $map['_string'] = "promote_id = {$root_id} or parent_id = {$root_id} or root_id = {$root_id}"; + $map['_string'] = "promote_id = {$root_id} or chain like '%/{$root_id}/%'"; } } + if (!empty(I('root_name'))) { + $map['promote_account'] = array('like','%'.I("root_name").'%'); + } + if (!empty(I("game_id"))) { $map['game_id'] = I("game_id"); } @@ -5416,7 +5420,7 @@ if ($key == 'model'){ if(!empty(I('parent_id'))) { $parent_id = I('parent_id'); - $map['_string'] = "promote_id = {$parent_id} or parent_id = {$parent_id}"; + $map['_string'] = "promote_id = {$parent_id} or chain like '%/{$parent_id}/%'"; } if (!empty(I('promote_id'))) { @@ -5677,8 +5681,8 @@ if ($key == 'model'){ $map['promote_account']=['like','%'.I("root_name").'%']; } - $map['parent_id'] = 0; - $map['root_id'] = 0; +// $map['chain'] = "/"; + $map['level'] = ['elt',1]; $xlsData = M('spend_user_count','tab_') ->field('promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') ->where($map) @@ -5704,22 +5708,100 @@ if ($key == 'model'){ } - function exportGetParentUser() { + public function exportMiniterUser() { - //获取所有数据 if (!empty(I("count_date")) ) { $month = I("count_date"); $map['count_date'] =$month; + } $parentData = []; if (!empty(I("root_id"))) { $root_id = I("root_id"); + $parentData = $this->getParentSpendData($root_id,$month,2); + $map['chain'] =['like','%'.$root_id.'%']; + $map['level'] = 2; + } else if(!empty(I("sign"))){ + $map['parent_id'] = ['neq',0]; + $map['root_id'] = ['eq',0]; + + } else { + if (I("root_id") == 0) { + $root_id = I("root_id"); + $map['promote_id'] = $root_id; + } + } + + if (!empty(I("root_name"))) { + $rootname = I("root_name"); + $map['promote_account'] =['like','%'.$rootname.'%']; + } + + $xlsName = '组长月结统计'; + + $xlsCell = array( + array('promote_account','会长渠道'), + array('cash_count','游戏现金流水'), + array('balance_coin_count','平台币支出'), + array('inside_cash_count','公会内充发放'), + array('bind_coin_count','公会内充支出'), + array('all_count','总流水'), + ); + + + $xlsData = M('spend_user_count','tab_') + ->field('promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') + ->where($map) + ->group('promote_id') + ->select(); + if (empty(I("root_name"))) { + $xlsData = array_merge($parentData,$xlsData); + } + + $sumData = M('spend_user_count','tab_') + ->field('promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') + ->where($map) + ->find(); + if (empty(I("root_name"))) { + $sumData['cash_count'] = number_format($sumData['cash_count'] + $parentData[0]['cash_count'], 2, '.', ''); + $sumData['balance_coin_count'] = number_format($sumData['balance_coin_count'] + $parentData[0]['balance_coin_count'], 2, '.', ''); + $sumData['inside_cash_count'] = number_format($sumData['inside_cash_count'] + $parentData[0]['inside_cash_count'], 2, '.', ''); + $sumData['all_count'] = number_format($sumData['all_count'] + $parentData[0]['all_count'], 2, '.', ''); + $sumData['bind_coin_count'] = number_format($sumData['bind_coin_count'] + $parentData[0]['bind_coin_count'], 2, '.', ''); + } - $parentData = $this->getParentSpendData($root_id,$month); - $map['parent_id'] =$root_id; + $sumData = [['promote_account'=>'总计', + 'cash_count'=>$sumData['cash_count'], + 'balance_coin_count'=>$sumData['balance_coin_count'], + 'inside_cash_count'=>$sumData['inside_cash_count'], + 'bind_coin_count'=>$sumData['bind_coin_count'], + 'all_count'=>$sumData['all_count'], + ]]; + $xlsData = array_merge($xlsData,$sumData); + + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } + + function exportGetParentUser() { + + //获取所有数据 + if (!empty(I("count_date")) ) { + $month = I("count_date"); + $map['count_date'] =$month; + } + + $parentData = []; + + if (!empty(I("parent_id"))) { + $root_id = I("parent_id"); + + $parentData = $this->getParentSpendData($root_id,$month,3); + + $map['chain'] =['like','%'.$root_id.'%']; + $map['level'] = 3; } else if(!empty(I("sign"))){ $map['parent_id'] = ['neq',0]; @@ -5796,9 +5878,10 @@ if ($key == 'model'){ $parentData = []; if (!empty(I("parent_id"))) { $parent_id = I("parent_id"); - $parentData = $this->getParentSpendData($parent_id,$month); + $parentData = $this->getParentSpendData($parent_id,$month,4); - $map['parent_id'] =$parent_id; + $map['chain'] =['like','%'.$parent_id.'%']; + $map['level'] = 4; } if (!empty(I('sign'))) { @@ -5853,7 +5936,7 @@ if ($key == 'model'){ } - function getParentSpendData($root_id,$date) { + function getParentSpendData($root_id,$date,$level=2) { $data = []; if (!$root_id) { @@ -5870,13 +5953,16 @@ if ($key == 'model'){ $data = M('spend_user_count','tab_') ->field('promote_id,promote_account, sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,sum(inside_cash_count) as inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') ->where($map)->select(); - - $map1['parent_id'] = $data[0]['promote_id']; +// dump($data); + $map1['chain'] = ['like','%/'.$data[0]['promote_id'].'/%']; $map1['count_date'] = $date; + $map1['level'] = $level; $sunData = M('spend_user_count','tab_') ->field('promote_id,promote_account, sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,sum(inside_cash_count) as inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') ->where($map1)->find(); - +// echo M('spend_user_count','tab_')->_sql(); +// dump($sunData); +//die(); $data[0]['cash_count'] = number_format($data[0]['cash_count']-$sunData['cash_count'],2,'.',''); $data[0]['balance_coin_count'] = number_format($data[0]['balance_coin_count']-$sunData['balance_coin_count'],2,'.',''); $data[0]['inside_cash_count'] = number_format($data[0]['inside_cash_count']-$sunData['inside_cash_count'],2,'.',''); diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 82e92ea12..2706d8429 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -149,7 +149,8 @@ class FinanceController extends ThinkController if ($root_id == '0') { $map['_string'] = "promote_id = {$root_id}"; } else if($root_id){ - $map['_string'] = "promote_id = {$root_id} or parent_id = {$root_id} or root_id = {$root_id}"; + $map['_string'] = "promote_id = {$root_id} or chain like '%/{$root_id}/%'"; +// $map['_string'] = "promote_id = {$root_id} or parent_id = {$root_id} or root_id = {$root_id}"; } } @@ -171,7 +172,7 @@ class FinanceController extends ThinkController if(!empty(I('parent_id'))) { $parent_id = I('parent_id'); - $map['_string'] = "promote_id = {$parent_id} or parent_id = {$parent_id}"; + $map['_string'] = "promote_id = {$parent_id} or chain like '%/{$parent_id}/%'"; } if (!empty(I('promote_id'))) { @@ -333,8 +334,8 @@ class FinanceController extends ThinkController $map['promote_account']=['like','%'.I("root_name").'%']; } - $map['parent_id'] = 0; - $map['root_id'] = 0; +// $map['chain'] = "/"; + $map['level'] = ['elt',1]; $subQueryAll = M('spend_user_count','tab_') ->field('promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') ->where($map) @@ -362,9 +363,8 @@ class FinanceController extends ThinkController $this->assign('data',$subQueryAll); $this->display(); } - public function getParentUser($p = 1) - { + public function getMiniterUser($p = 1) { $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 $row=10; @@ -381,10 +381,10 @@ class FinanceController extends ThinkController if (!empty(I("root_id"))) { $root_id = I("root_id"); if ($page == 1) { - $parentData = $this->getParentSpendData($root_id,$month); + $parentData = $this->getParentSpendData($root_id,$month,2); } - $map['parent_id'] =$root_id; - + $map['chain'] =['like','%'.$root_id.'%']; + $map['level'] = 2; } else if(!empty(I("sign"))){ $map['parent_id'] = ['neq',0]; $map['root_id'] = ['eq',0]; @@ -402,6 +402,85 @@ class FinanceController extends ThinkController } + $subQueryAll = M('spend_user_count','tab_') + ->field('promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') + ->where($map) + ->group('promote_id') + ->page($page,$row) + ->select(); + if (empty(I("root_name"))) { + $subQueryAll = array_merge($parentData,$subQueryAll); + } + + $sumData = M('spend_user_count','tab_') + ->field('promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') + ->where($map) + ->find(); + if (empty(I("root_name"))) { + $sumData['cash_count'] = number_format($sumData['cash_count'] + $parentData[0]['cash_count'], 2, '.', ''); + $sumData['balance_coin_count'] = number_format($sumData['balance_coin_count'] + $parentData[0]['balance_coin_count'], 2, '.', ''); + $sumData['inside_cash_count'] = number_format($sumData['inside_cash_count'] + $parentData[0]['inside_cash_count'], 2, '.', ''); + $sumData['all_count'] = number_format($sumData['all_count'] + $parentData[0]['all_count'], 2, '.', ''); + $sumData['bind_coin_count'] = number_format($sumData['bind_coin_count'] + $parentData[0]['bind_coin_count'], 2, '.', ''); + } + + $count = M('spend_user_count','tab_') + ->field('promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count, sum(all_count) as all_count') + ->where($map) + ->group('promote_id') + ->select(); + + $count = count($count); + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + $this->meta_title = '组长流水'; + + $this->assign('sumData',$sumData); + $this->assign('data',$subQueryAll); + $this->display(); + } + + public function getParentUser($p = 1) + { + + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $row=10; + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + + if (!empty(I("count_date")) ) { + $month = I("count_date"); + $map['count_date'] =$month; + + } + + $parentData = []; + + if (!empty(I("parent_id"))) { + $root_id = I("parent_id"); + if ($page == 1) { + $parentData = $this->getParentSpendData($root_id,$month,3); + } + $map['chain'] =['like','%'.$root_id.'%']; + $map['level'] = 3; + + } else if(!empty(I("sign"))){ + $map['parent_id'] = ['neq',0]; + $map['root_id'] = ['eq',0]; + + } else { + if (I("parent_id") == 0) { + $root_id = I("parent_id"); + $map['promote_id'] = $root_id; + } + } + + if (!empty(I("root_name"))) { + $rootname = I("root_name"); + $map['promote_account'] =['like','%'.$rootname.'%']; + } + + $subQueryAll = M('spend_user_count','tab_') ->field('promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') ->where($map) @@ -457,10 +536,11 @@ class FinanceController extends ThinkController $parent_id = I("parent_id"); if ($page == 1) { - $parentData = $this->getParentSpendData($parent_id,$month); + $parentData = $this->getParentSpendData($parent_id,$month,4); } - $map['parent_id'] =$parent_id; + $map['chain'] =['like','%'.$parent_id.'%']; + $map['level'] = 4; } if (!empty(I('sign'))) { @@ -539,7 +619,7 @@ class FinanceController extends ThinkController $this->ajaxReturn($data,'json'); } - function getParentSpendData($root_id,$date) { + function getParentSpendData($root_id,$date,$level=2) { $data = []; if (!$root_id) { @@ -556,13 +636,16 @@ class FinanceController extends ThinkController $data = M('spend_user_count','tab_') ->field('promote_id,promote_account, sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,sum(inside_cash_count) as inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') ->where($map)->select(); - - $map1['parent_id'] = $data[0]['promote_id']; +// dump($data); + $map1['chain'] = ['like','%/'.$data[0]['promote_id'].'/%']; $map1['count_date'] = $date; + $map1['level'] = $level; $sunData = M('spend_user_count','tab_') ->field('promote_id,promote_account, sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,sum(inside_cash_count) as inside_cash_count, sum(all_count) as all_count, sum(bind_coin_count) as bind_coin_count') ->where($map1)->find(); - +// echo M('spend_user_count','tab_')->_sql(); +// dump($sunData); +//die(); $data[0]['cash_count'] = number_format($data[0]['cash_count']-$sunData['cash_count'],2,'.',''); $data[0]['balance_coin_count'] = number_format($data[0]['balance_coin_count']-$sunData['balance_coin_count'],2,'.',''); $data[0]['inside_cash_count'] = number_format($data[0]['inside_cash_count']-$sunData['inside_cash_count'],2,'.',''); diff --git a/Application/Admin/View/Finance/getMiniterUser.html b/Application/Admin/View/Finance/getMiniterUser.html new file mode 100644 index 000000000..c97fbc25f --- /dev/null +++ b/Application/Admin/View/Finance/getMiniterUser.html @@ -0,0 +1,286 @@ + + + + + + + + + + + +
+ + +
+ + +
+ 返回 + 导出 +
+ + +
+ +   +
+
+ + 搜索 +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
部长渠道
游戏现金流水第三方支付(微信,支付宝,快捷)。
平台币支出平台币所支付的流水
公会内充发放平台直接下放给公会的平台币
公会内充支出绑币消耗流水
总流水游戏现金流水+平台币支出+公会内充支出=总流水
操作
aOh! 暂时还没有内容!
{$data.promote_account}{$data.cash_count}{$data.balance_coin_count}{$data.inside_cash_count}{$data.bind_coin_count}{$data.all_count} + 游戏查看 + 组长渠道 + + ------- +
总计{$sumData.cash_count}{$sumData.balance_coin_count}{$sumData.inside_cash_count}{$sumData.bind_coin_count}{$sumData.all_count} + 游戏查看 + +
+
+
+
+ + {$_page|default=''} +
+
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Application/Admin/View/Finance/getParentUser.html b/Application/Admin/View/Finance/getParentUser.html index ca0c96f48..353fdff0d 100644 --- a/Application/Admin/View/Finance/getParentUser.html +++ b/Application/Admin/View/Finance/getParentUser.html @@ -71,7 +71,7 @@ @@ -84,9 +84,10 @@
返回 导出 + array('count_date'=>$_GET['count_date'],'root_name'=>$_GET['root_name'],'root_id'=>$_GET['root_id'],'parent_id'=>$_GET['parent_id'],'',false))}" style="width: 100px;border: #3C95C8 solid 1px;">导出
+
@@ -145,7 +146,7 @@ {$data.inside_cash_count} {$data.bind_coin_count} {$data.all_count} - + 游戏查看 推广员渠道 diff --git a/Application/Admin/View/Finance/getPromoteUser.html b/Application/Admin/View/Finance/getPromoteUser.html index 385bc2a95..9a7c69669 100644 --- a/Application/Admin/View/Finance/getPromoteUser.html +++ b/Application/Admin/View/Finance/getPromoteUser.html @@ -70,7 +70,7 @@ diff --git a/Application/Admin/View/Finance/getRootUser.html b/Application/Admin/View/Finance/getRootUser.html index 76862520f..263ffa9c7 100644 --- a/Application/Admin/View/Finance/getRootUser.html +++ b/Application/Admin/View/Finance/getRootUser.html @@ -147,7 +147,7 @@ {$data.bind_coin_count} {$data.all_count} 游戏查看 - 组长渠道 + 部长渠道 总计