From 5d6716b239f4de16149bbeec463eb06a5792dfd7 Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Mon, 16 Dec 2019 20:55:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 60 +++ .../Controller/FinanceController.class.php | 44 +++ Application/Admin/Model/SpendModel.class.php | 19 + .../Admin/View/Finance/gameStatistics.html | 345 ++++++++++++++++++ Data/update.sql | 8 - 5 files changed, 468 insertions(+), 8 deletions(-) create mode 100644 Application/Admin/View/Finance/gameStatistics.html diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 2e6b1472d..5dbe2d6e6 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -6451,6 +6451,66 @@ if ($key == 'model'){ $this->exportExcel($xlsName, $xlsCell, $xlsData); } + + /** + *充值-》财务管理-》游戏统计-》导出 + */ + public function exportGameStatistics() { + dd($_REQUEST); + + $month = I("count_date"); + $xlsName = $month . '游戏统计导出'; + + $xlsCell = array( + array('game_name','游戏'), + array('partner_name','合作公司'), + array('cash_count','游戏现金金额'), + array('balance_coin_count','平台币直充支出'), + array('inside_cash_count','内充支出'), + array('all_cash_count','游戏内充值合计'), + ); + + $map = []; + + $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id'); + if ($game_ids) { + $map['s.game_id'] = ['in', $game_ids]; + } + + if (!empty(I('partner_id'))) { + $map['g.partner_id'] = I('partner_id'); + } + + if (!empty(I('timestart'))) { + $timestart = strtotime(I('timestart')); + $map['_string'] = "s.pay_time > {$timestart}"; + } + + if (!empty(I('timeend'))) { + $timeend = strtotime(I('timeend')); + $map['_string'] .= " and s.pay_time < {$timeend}"; + } + + $data = D("spend")->gameStatistics($map); + foreach ($data as $key => $value) { + $data[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; + } + + $sumCash = D("spend_count")->sumSpendCountField($map,"cash_count"); + $sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count"); + $sumInside = number_format(array_sum($insideDataSum),2,'.',''); + $sumAll = D("spend_count")->sumSpendCountField($map,"cash_count+balance_coin_count") + array_sum($insideDataSum); + + $sumData = [['game_name'=>'总计', + 'cash_count'=>$sumCash, + 'balance_coin_count'=>$sumBalance, + 'inside_cash_count'=>$sumInside, + 'all_cash_count'=>$sumAll]]; + $xlsData = array_merge($xlsData,$sumData); + + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } + function gameFinanceDetail() { // set_time_limit(0); diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 90d95c622..a4cf1141b 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -519,6 +519,7 @@ class FinanceController extends ThinkController $this->display(); } + public function getPromoteUser($p = 1) { $page = intval($p); @@ -688,4 +689,47 @@ class FinanceController extends ThinkController } + + /** + *游戏统计 + */ + public function gameStatistics($p = 1) { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $row = $_REQUEST['row'] ?? 10; + + $map = []; + + $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id'); + if ($game_ids) { + $map['s.game_id'] = ['in', $game_ids]; + } + + if (!empty(I('partner_id'))) { + $map['g.partner_id'] = I('partner_id'); + } + + if (!empty(I('timestart'))) { + $timestart = strtotime(I('timestart')); + $map['_string'] = "s.pay_time > {$timestart}"; + } + + if (!empty(I('timeend'))) { + $timeend = strtotime(I('timeend')); + $map['_string'] .= " and s.pay_time < {$timeend}"; + } + + + $data = D("spend")->gameStatistics($map); + foreach ($data as $key => $value) { + $data[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; + } + + + $this->assign('data',$data); + + $this->display(); + + } + } \ No newline at end of file diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index 6f5e3ab07..5c64df6bd 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -829,4 +829,23 @@ class SpendModel extends Model } + /** + *获取游戏统计列表数据 + */ + public function gameStatistics($map) + { + $data = $this->alias("s") + ->field("s.game_id,s.game_name,p.partner as partner_name,SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count, +SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, +SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count") + ->join('LEFT JOIN tab_game as g ON s.game_id=g.id') + ->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id') + ->where(['s.pay_status' => 1]) + ->where($map) + ->group('s.game_id') + ->select(); + return $data; + } + + } diff --git a/Application/Admin/View/Finance/gameStatistics.html b/Application/Admin/View/Finance/gameStatistics.html new file mode 100644 index 000000000..d8ce722db --- /dev/null +++ b/Application/Admin/View/Finance/gameStatistics.html @@ -0,0 +1,345 @@ + + + + + + + + + + + +
+ + +
+ +
+ +
+
+ +
+
+ +
+ +
+ + - +
+ + +
+
+ + + + + + + +
+ 搜索 + + 导出 +
+ + + +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
合作公司游戏
游戏现金金额第三方支付(微信,支付宝,快捷)。
平台币直充支出平台币购买游戏道具所产生的金额
内充支出玩家用绑币购买游戏道具所产生的金额
游戏内充值合计游戏现金金额+平台币直充支出+平台币内充支出
操作
aOh! 暂时还没有内容!
{$data.partner_name}{$data.game_name}{$data.cash_count}0{$data.balance_coin_count}0{$data.inside_cash_count}0{$data.all_cash_count}0 + 查看 +
总计{$sumCash}0{$sumBalance}0{$sumInside}0{$sumAll}0 + 查看 +
+
+
+
+ + {$_page|default=''} +
+
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Data/update.sql b/Data/update.sql index c8c553d34..9a4de10f8 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -730,14 +730,6 @@ ADD COLUMN `flooring_page_video_cover` int(11) NOT NULL DEFAULT 0 COMMENT '落 INSERT INTO `sys_menu`(`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) VALUES ('推广公司录入', 185, 56, 'PromoteCompany/lists', 0, '该功能用于录入工会所属的推广公司名称', '推广员管理', 0, 1); -INSERT INTO `sys_menu`(`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) -VALUES ('新增', 567, 0, 'PromoteCompany/add', 0, '', '推广员管理', 0, 1); - -INSERT INTO `sys_menu`(`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) -VALUES ('编辑', 567, 0, 'PromoteCompany/edit', 0, '', '推广员管理', 0, 1); - -INSERT INTO `sys_menu`(`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) -VALUES ('删除', 567, 0, 'PromoteCompany/del', 0, '', '推广员管理', 0, 1); -- 推广员表加入推广公司字段 liuweiwen 20191216 ALTER TABLE tab_promote ADD `company_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广公司ID';