diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 2e6b1472d..bc21c9332 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -6451,6 +6451,145 @@ if ($key == 'model'){ $this->exportExcel($xlsName, $xlsCell, $xlsData); } + + /** + *充值-》财务管理-》游戏统计-》导出 + */ + public function exportGameStatistics() { + $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}"; + } + + $xlsData = D("spend")->gameStatistics($map); + foreach ($xlsData as $key => $value) { + $xlsData[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; + } + + $totalData = D("spend")->totalGameStatistics($map); + + $sumCash = $totalData['cash_count']; + $sumBalance = $totalData['balance_coin_count']; + $sumInside = $totalData['inside_cash_count']; + $sumAll = $sumCash + $sumBalance + $sumInside; + + $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); + } + + public function gameStatisticsDetail() { + $game_name = I("game_name"); + $xlsName = $game_name . '游戏订单查看'; + + $xlsCell = array( + array('pay_order_number','支付订单号'), + array('extend','游戏订单号'), + array('pay_time','充值时间'), + array('user_account','玩家账号'), + array('game_name','游戏名称'), + array('promote_account','所属推广员'), + array('spend_ip','充值ip'), + array('server_name','游戏区服'), + array('game_player_name','角色名称'), + array('cost','订单金额'), + array('pay_amount','实付金额'), + array('pay_way','充值方式'), + ); + + if (isset($_REQUEST['pay_way'])) { + $map['pay_way'] = $_REQUEST['pay_way']; + } + + if (!empty($_REQUEST['pay_order_number'])) { + $map['pay_order_number'] = $_REQUEST['pay_order_number']; + } + + if (!empty(I('partner_id'))&&empty(I("game_id"))) { + $wherePartner = I('partner_id'); + $gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select(); + $gameId = implode(',',array_column($gameId,'id')); + $map['game_id'] = ['in',$gameId]; + } + + if (!empty(I('timestart'))) { + $timestart = strtotime(I('timestart')); + $map['_string'] = "pay_time > {$timestart}"; + } + + if (!empty(I('timeend'))) { + $timeend = strtotime(I('timeend')); + $map['_string'] .= " and pay_time < {$timeend}"; + } + + $map['pay_status'] = 1; + if (!empty(I("game_id"))) { + $map['game_id'] = I("game_id"); + } + if (!empty(I('user_account'))) { + $map['user_account'] = array('like','%'.I("user_account").'%'); + } + if (!empty(I('user_nickname'))) { + $map['game_player_name'] = array('like',I("user_nickname").'%'); + } + + $field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,extend"; + $group = ""; + $order = "pay_time DESC"; + + $xlsData = D('spend')->getSpendData($map,$field,$group,$order); + foreach($xlsData as $key => $value) { + $xlsData[$key]['pay_way'] = getPayType($value['pay_way']); + } + + $totalData = D("spend")->totalGameStatistics($map, false); + + $sumCash = $totalData['cash_count'] ?? 0; + $sumBalance = $totalData['balance_coin_count'] ?? 0; + $sumInside = $totalData['inside_cash_count'] ?? 0; + $sumAll = $sumCash + $sumBalance + $sumInside; + + $sumData = [['pay_order_number'=>'总计:' . $sumAll, + 'extend'=>'现金金额:' . $sumCash, + 'pay_time'=>'平台币:' . $sumBalance, + 'user_account'=>'绑币:' . $sumInside]]; + $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..509dbbc49 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -129,7 +129,11 @@ class FinanceController extends ThinkController $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 $row=10; - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + if(isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + }else{ + $row = 10; + } $map = []; if(!empty(I('count_date'))){ @@ -519,6 +523,7 @@ class FinanceController extends ThinkController $this->display(); } + public function getPromoteUser($p = 1) { $page = intval($p); @@ -688,4 +693,163 @@ 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, $row, $p); + foreach ($data as $key => $value) { + $data[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; + } + + $allData = D("spend")->gameStatistics($map);//列表总数 + $count = count($allData); + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page);//分页 + } + + //统计合计 + $totalData = D("spend")->totalGameStatistics($map); + + $sumCash = $totalData['cash_count']; + $sumBalance = $totalData['balance_coin_count']; + $sumInside = $totalData['inside_cash_count']; + $sumAll = $sumCash + $sumBalance + $sumInside; + + $this->assign('sumCash', $sumCash); + $this->assign('sumBalance', $sumBalance); + $this->assign('sumInside', $sumInside); + $this->assign('sumAll', $sumAll); + $this->assign('data',$data); + + $this->display(); + } + + public function gameStatisticsDetail($p = 1) { + set_time_limit(0); + + if (isset($_REQUEST['pay_way'])) { + $map['pay_way'] = $_REQUEST['pay_way']; + } + + if (!empty($_REQUEST['pay_order_number'])) { + $map['pay_order_number'] = $_REQUEST['pay_order_number']; + } + + if (!empty(I('partner_id'))&&empty(I("game_id"))) { + $wherePartner = I('partner_id'); + $gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select(); + $gameId = implode(',',array_column($gameId,'id')); + $map['game_id'] = ['in',$gameId]; + } + + if (!empty(I('timestart'))) { + $timestart = strtotime(I('timestart')); + $map['_string'] = "pay_time > {$timestart}"; + } + + if (!empty(I('timeend'))) { + $timeend = strtotime(I('timeend')); + $map['_string'] .= " and pay_time < {$timeend}"; + } +// var_dump($map);die(); + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + $map['pay_status'] = 1; + if (!empty(I("game_id"))) { + $map['game_id'] = I("game_id"); + } + if (!empty(I('user_account'))) { + $map['user_account'] = array('like','%'.I("user_account").'%'); + } + if (!empty(I('user_nickname'))) { + $map['game_player_name'] = array('like',I("user_nickname").'%'); + } +// var_dump($map);die(); + $field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way"; + $group = ""; + $order = "pay_time DESC"; + $data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row); + foreach($data as $key => $value) { + $data[$key]['pay_way'] = getPayType($value['pay_way']); + } + + $totalData = D('spend')->totalGameStatistics($map, false); + $sumCash = $totalData['cash_count'] ?? 0; + $sumBalance = $totalData['balance_coin_count'] ?? 0; + $sumInside = $totalData['inside_cash_count'] ?? 0; + $sumAll = $sumCash + $sumBalance + $sumInside; + + $this->assign('sumCash', $sumCash); + $this->assign('sumBalance', $sumBalance); + $this->assign('sumInside', $sumInside); + $this->assign('sumAll', null_to_0($sumAll)); + + $count = D("spend")->getSpendData($map,$field,$group,$order); + + $count = count($count); + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + $this->meta_title = '游戏订单查看'; + + $this->assign('data',$data); + + $this->display(); + } + + + /** + *获取合作公司 + */ + public function getPartnetList() + { + $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id'); + if ($game_ids) { + $map['g.id'] = ['in', $game_ids]; + } + if (I('sdk_type')) { + $map['sdk_version'] = I('sdk_type'); + } + $data = M('partner','tab_')->alias('p') + ->join('left join tab_game as g on g.partner_id = p.id') + ->field("partner, p.id") + ->where($map) + ->group('p.id') + ->select(); + $this->ajaxReturn($data,'json'); + } + } \ No newline at end of file diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 887b37be4..8c5eb69ba 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -335,7 +335,8 @@ class PromoteController extends ThinkController $this->m_title = '推广员列表'; $this->assign('commonset', M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find()); - + $companys = M('promote_company','tab_')->select(); + $this->assign('companys', $companys); $this->display(); } } diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index 6f5e3ab07..c761281c6 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -829,4 +829,49 @@ class SpendModel extends Model } + /** + *获取游戏统计列表数据 + * @param $map array 查询条件 + * @param $row int 每页条数 + * @param $page int 第几页 + */ + public function gameStatistics($map, $row = 0, $page = 1) + { + $query = $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'); + if ($row) { + $query = $query->page($page,$row); + } + $data = $query->select(); + return $data; + } + + /** + *获取游戏统计列表数据 + */ + public function totalGameStatistics($map, $join = true) + { + $query = $this->alias("s") + ->field("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"); + if ($join) { + $query = $query->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'); + } + $data = $query->where(['s.pay_status' => 1]) + ->where($map) + ->find(); + return $data; + } + + } diff --git a/Application/Admin/View/Finance/gameStatistics.html b/Application/Admin/View/Finance/gameStatistics.html new file mode 100644 index 000000000..0aa6f32f5 --- /dev/null +++ b/Application/Admin/View/Finance/gameStatistics.html @@ -0,0 +1,382 @@ + + + + + + + + + + + +
+ + +
+ +
+ +
+
+ +
+
+ +
+ +
+ + - +
+ + +
+
+ + +
+ 搜索 + + 导出 +
+ + + +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
合作公司游戏
游戏现金金额第三方支付(微信,支付宝,快捷)。
平台币直充支出平台币购买游戏道具所产生的金额
内充支出玩家用绑币购买游戏道具所产生的金额
游戏内充值合计游戏现金金额+平台币直充支出+平台币内充支出
操作
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/Application/Admin/View/Finance/gameStatisticsDetail.html b/Application/Admin/View/Finance/gameStatisticsDetail.html new file mode 100644 index 000000000..d345138f5 --- /dev/null +++ b/Application/Admin/View/Finance/gameStatisticsDetail.html @@ -0,0 +1,327 @@ + + + + + + + + + + + +
+ + +
+ + +
+ 返回 +
+ + + + +
+   +
+
+ +   +
+ + + + +
+ + - +
+ + +
+
+ +
+ +
+ +
+ + 搜索 + + 导出 + +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
支付订单号充值时间玩家账号游戏名称所属推广员充值ip游戏区服角色名称订单金额实付金额充值方式
aOh! 暂时还没有内容!
{$data.pay_order_number}{$data.pay_time}{$data.user_account}{$data.game_name}{$data.promote_account}{$data.spend_ip}{$data.server_name}{$data.game_player_name}{$data.cost}{$data.pay_amount}{$data.pay_way}
总计累计充值:{$sumAll}0 + (现金金额:{$sumCash} 平台币:{$sumBalance} 绑币:{$sumInside}) +
+
+
+
+ + {$_page|default=''} +
+
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Application/Admin/View/Promote/edit.html b/Application/Admin/View/Promote/edit.html index 3c39f46fc..d6f997125 100644 --- a/Application/Admin/View/Promote/edit.html +++ b/Application/Admin/View/Promote/edit.html @@ -168,6 +168,22 @@ + + + + 推广公司: + + + 设置该推广员所属的推广公司 + + + + 注册时间: 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';