From b3fcf58932db64e31213b61443125446f6ec6443 Mon Sep 17 00:00:00 2001
From: liuweiwen <“529520975@qq.com>
Date: Mon, 16 Dec 2019 17:27:58 +0800
Subject: [PATCH 1/7] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E7=BC=96?=
=?UTF-8?q?=E8=BE=91=E6=8E=A8=E5=B9=BF=E5=85=AC=E5=8F=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/Controller/PromoteController.class.php | 3 ++-
Application/Admin/View/Promote/edit.html | 16 ++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
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/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 @@
+
+
+
+ 推广公司: |
+
+
+ 设置该推广员所属的推广公司
+ |
+
+
+
注册时间: |
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 2/7] =?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 @@
+
+
+
+
+
+
+
+
+
+
+
+ {$_REQUEST['count_date']}游戏统计
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 合作公司 |
+
+ 游戏 |
+
+ 游戏现金金额第三方支付(微信,支付宝,快捷)。 |
+
+ 平台币直充支出平台币购买游戏道具所产生的金额 |
+
+ 内充支出玩家用绑币购买游戏道具所产生的金额 |
+
+ 游戏内充值合计游戏现金金额+平台币直充支出+平台币内充支出 |
+
+ 操作 |
+
+
+
+
+
+
+
+ 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';
From c0fac39c188e4c5804ba9d6e503c9afb59c51a17 Mon Sep 17 00:00:00 2001
From: liuweiwen <“529520975@qq.com>
Date: Mon, 16 Dec 2019 21:12:38 +0800
Subject: [PATCH 3/7] =?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
---
.../Admin/Controller/ExportController.class.php | 12 ++++++------
.../Controller/FinanceController.class.php | 12 +++++++++++-
Application/Admin/Model/SpendModel.class.php | 17 +++++++++++++++++
3 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index 5dbe2d6e6..8f93aab6c 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -6456,8 +6456,6 @@ if ($key == 'model'){
*充值-》财务管理-》游戏统计-》导出
*/
public function exportGameStatistics() {
- dd($_REQUEST);
-
$month = I("count_date");
$xlsName = $month . '游戏统计导出';
@@ -6496,10 +6494,12 @@ if ($key == 'model'){
$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);
+ $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,
diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php
index a4cf1141b..6efe2a91a 100644
--- a/Application/Admin/Controller/FinanceController.class.php
+++ b/Application/Admin/Controller/FinanceController.class.php
@@ -719,13 +719,23 @@ class FinanceController extends ThinkController
$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'];
}
+ $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();
diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php
index 5c64df6bd..66ca69505 100644
--- a/Application/Admin/Model/SpendModel.class.php
+++ b/Application/Admin/Model/SpendModel.class.php
@@ -847,5 +847,22 @@ SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count")
return $data;
}
+ /**
+ *获取游戏统计列表数据
+ */
+ public function totalGameStatistics($map)
+ {
+ $data = $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")
+ ->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)
+ ->find();
+ return $data;
+ }
+
}
From ead339046f15f76ff8df2459bea578cad64a02ac Mon Sep 17 00:00:00 2001
From: liuweiwen <“529520975@qq.com>
Date: Mon, 16 Dec 2019 21:30:43 +0800
Subject: [PATCH 4/7] =?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 | 6 +-
.../Controller/FinanceController.class.php | 83 ++++++
.../Admin/View/Finance/gameStatistics.html | 40 +--
.../View/Finance/gameStatisticsDetail.html | 250 ++++++++++++++++++
4 files changed, 361 insertions(+), 18 deletions(-)
create mode 100644 Application/Admin/View/Finance/gameStatisticsDetail.html
diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index 8f93aab6c..034046398 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -6489,9 +6489,9 @@ if ($key == 'model'){
$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'];
+ $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);
diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php
index 6efe2a91a..ad2411cd3 100644
--- a/Application/Admin/Controller/FinanceController.class.php
+++ b/Application/Admin/Controller/FinanceController.class.php
@@ -738,6 +738,89 @@ class FinanceController extends ThinkController
$this->assign('sumAll', $sumAll);
$this->assign('data',$data);
+ $this->display();
+ }
+
+ public function gameStatisticsDetail($p = 1) {
+ set_time_limit(0);
+ if (!empty(I("promote_id"))) {
+ $promote_id[] = I("promote_id");
+ }
+
+ if (!empty(I("root_id"))) {
+ $root_id = I("root_id");
+ $promote_id = $this->getPromoteList($root_id);
+ array_push($promote_id,$root_id);
+ }
+
+ if ($_REQUEST['root_id']=='0') {
+ $map['promote_id'] = $_REQUEST['root_id'];
+ }
+
+ if (!empty(I("parent_id"))) {
+ $parent_id = I("parent_id");
+ $promote_id = $this->getPromoteList($parent_id);
+ array_push($promote_id,$parent_id);
+ }
+
+ $promote_id = implode(',',$promote_id);
+ if ($promote_id) {
+ $map['promote_id'] = ['in',$promote_id];
+ }
+
+ 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];
+ }
+// var_dump($map);die();
+ $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");
+ $tarry = explode('-',$month);
+ $startTime=mktime(0,0,0,$tarry[1],1,$tarry[0]);
+ $endTime =mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1;
+ $map['pay_time'] = array('between',array($startTime,$endTime));
+ }
+
+ $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);
+// echo D("spend")->_sql();die();
+
+ foreach($data as $key => $value) {
+ $data[$key]['pay_way'] = getPayType($value['pay_way']);
+ }
+
+ $sum = D('spend')->sumSpend($map,'pay_amount');
+
+ $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->assign('sum_amount',$sum);
+
$this->display();
}
diff --git a/Application/Admin/View/Finance/gameStatistics.html b/Application/Admin/View/Finance/gameStatistics.html
index d8ce722db..5c3af308e 100644
--- a/Application/Admin/View/Finance/gameStatistics.html
+++ b/Application/Admin/View/Finance/gameStatistics.html
@@ -115,19 +115,20 @@
-
-
-
-
-
@@ -181,10 +182,14 @@
| {$data.inside_cash_count}0 |
{$data.all_cash_count}0 |
- 查看
+ 查看
|
@@ -195,10 +200,15 @@