From f167d63c4abf692bf7c80c105dedf172e2a3567e Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 8 Jul 2020 11:46:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancePromoteController.class.php | 81 +++++++++++-------- .../Controller/SpendController.class.php | 25 +++--- .../Admin/Model/PromoteModel.class.php | 2 +- .../View/FinancePromote/gameStatistics.html | 2 +- .../Admin/View/FinancePromote/index.html | 2 +- .../View/FinancePromote/promoteUser.html | 2 +- 6 files changed, 59 insertions(+), 55 deletions(-) diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index ffb8dcf53..2192aa350 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -253,7 +253,7 @@ class FinancePromoteController extends AdminController } $adminId = 0; - $havingPids = []; + // $havingPids = []; $isMarketAdmin = isMarketAdmin(); if ($isMarketAdmin) { $userAuth = session('user_auth'); @@ -263,10 +263,10 @@ class FinancePromoteController extends AdminController $adminId = I('admin_id'); } } - if ($adminId > 0) { + /* if ($adminId > 0) { $havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true); $havingPids = count($havingPids) > 0 ? $havingPids : [0]; - } + } */ if($type == "spend"){ if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) { @@ -291,16 +291,16 @@ class FinancePromoteController extends AdminController ->join("tab_promote promote ON s.promote_id = promote.id","left") ->join("tab_promote_company company ON promote.company_id = company.id","left") ->group('p_id'); - if (count($havingPids) > 0) { + /* if (count($havingPids) > 0) { $query->having('p_id in (' . implode(',', $havingPids) . ')'); - } + } */ return $query->select(); }else{ if($istimeselect){ $map['s.create_time']=$istimeselect; } $adminId = 0; - $havingPids = []; + // $havingPids = []; $isMarketAdmin = isMarketAdmin(); if ($isMarketAdmin) { $userAuth = session('user_auth'); @@ -311,8 +311,9 @@ class FinancePromoteController extends AdminController } } if ($adminId > 0) { - $havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true); - $havingPids = count($havingPids) > 0 ? $havingPids : [0]; + $map['promote.admin_id'] = $adminId; + // $havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true); + // $havingPids = count($havingPids) > 0 ? $havingPids : [0]; } $map['s.status']=1; $map['s.source_id']=0; @@ -325,9 +326,9 @@ class FinancePromoteController extends AdminController ->join("tab_promote promote ON s.promote_id = promote.id","left") ->join("tab_promote_company company ON promote.company_id = company.id","left") ->group('p_id'); - if (count($havingPids) > 0) { + /* if (count($havingPids) > 0) { $query->having('p_id in (' . implode(',', $havingPids) . ')'); - } + } */ return $query->select(); } @@ -520,13 +521,6 @@ class FinancePromoteController extends AdminController ->join("tab_promote_company company ON promote.company_id = company.id", "left") ->group('promote_id'); - $havingPids = []; - if ($adminId > 0) { - $topIds = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true); - $havingPids = getPromoteIdsByTopIds($topIds); - $havingPids = count($havingPids) > 0 ? $havingPids : [0]; - $query->having('promote_id in (' . implode(',', $havingPids) . ')'); - } return $query->select(); }else{ if($istimeselect){ @@ -547,9 +541,12 @@ class FinancePromoteController extends AdminController } $isMarketLeader = isMarketLeader(); - if ($isMarketLeader) { + if ($adminId > 0) { + $map['promote.admin_id'] = $adminId; + } elseif ($isMarketLeader) { $map['promote.admin_id'] = ['gt', 0]; } + $field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount, IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,IFNULL(promote.company_belong,0) company_belong"; $query = M("promote_coin s","tab_") @@ -559,13 +556,13 @@ class FinancePromoteController extends AdminController ->join("tab_promote_company company ON promote.company_id = company.id", "left") ->group('promote_id'); - $havingPids = []; + /* $havingPids = []; if ($adminId > 0) { $topIds = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true); $havingPids = getPromoteIdsByTopIds($topIds); $havingPids = count($havingPids) > 0 ? $havingPids : [0]; $query->having('promote_id in (' . implode(',', $havingPids) . ')'); - } + } */ return $query->select(); } } @@ -860,6 +857,21 @@ class FinancePromoteController extends AdminController private function gameStatisticsData($map, $row = 0, $page = 1) { + $adminId = 0; + $isMarketAdmin = isMarketAdmin(); + if ($isMarketAdmin) { + $userAuth = session('user_auth'); + $adminId = $userAuth['uid']; + } else { + if (!empty(I('admin_id'))) { + $adminId = I('admin_id'); + } + } + + if ($adminId > 0) { + $map['s.market_admin_id'] = $adminId; + } + $map['s.pay_status']=1; $query = M("spend","tab_")->alias("s") ->field("s.game_id,s.game_name,s.sdk_version,p.partner as partner_name, @@ -878,6 +890,17 @@ class FinancePromoteController extends AdminController if ($row != 0) { $query = $query->page($page,$row); } + $data = $query->select(false); + $data = M() + ->table("(".$data.") a") + ->field("a.*,IFNULL(promote.account,'官方渠道') account") + ->join("tab_promote promote ON a.p_id = promote.id","left") + ->select(); + + return $data; + } + private function totalGameStatisticsData($map, $join = true) + { $adminId = 0; $isMarketAdmin = isMarketAdmin(); if ($isMarketAdmin) { @@ -888,23 +911,11 @@ class FinancePromoteController extends AdminController $adminId = I('admin_id'); } } - $havingPids = []; + if ($adminId > 0) { - $havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true); - $havingPids = count($havingPids) > 0 ? $havingPids : [0]; - $query->having('p_id in (' . implode(',', $havingPids) . ')'); + $map['s.market_admin_id'] = $adminId; } - $data = $query->select(false); - $data = M() - ->table("(".$data.") a") - ->field("a.*,IFNULL(promote.account,'官方渠道') account") - ->join("tab_promote promote ON a.p_id = promote.id","left") - ->select(); - - return $data; - } - private function totalGameStatisticsData($map, $join = true) - { + $query = M("spend","tab_")->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, diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index cc1c4a612..fc537e30a 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -72,26 +72,19 @@ class SpendController extends ThinkController unset($_REQUEST['pay_game_status']); } - $marketAdminId = I('market_admin_id', 0); - if ($marketAdminId) { - $map['market_admin_id'] = $marketAdminId; - } - + $marketAdminId = 0; $isMarketAdmin = isMarketAdmin(); if ($isMarketAdmin) { $userAuth = session('user_auth'); - $map['market_admin_id'] = $userAuth['uid']; + $marketAdminId = $userAuth['uid']; + } else { + $marketAdminId = I('market_admin_id', 0); + } + if ($marketAdminId > 0) { + $map['market_admin_id'] = $marketAdminId; + } else { + setPowerPromoteIds($map,'promote_id'); } - -// $promoteRoot = getPowerPromoteIds(); -// $data_empower_type = session('user_auth')['data_empower_type']; -// -// if ($promoteRoot) { -// $map['promote_id'] =array('in',$promoteRoot); -// } else if(!$promoteRoot&&$data_empower_type!=1){ -// $map['id'] = array('lt',1); -// } - setPowerPromoteIds($map,'promote_id'); if (isset($_REQUEST['promote_id'])) { $promoteId = intval($_REQUEST['promote_id']); diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index f015a4e4d..f61c4a71d 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -406,7 +406,7 @@ class PromoteModel extends Model{ $where['level'] = $level; $userAuth = session('user_auth'); - setPowerPromoteIds($where,'id'); + // setPowerPromoteIds($where,'id'); $offcialData = [0=>['id'=>0,'nickname'=>C('OFFICIEL_CHANNEL')]]; diff --git a/Application/Admin/View/FinancePromote/gameStatistics.html b/Application/Admin/View/FinancePromote/gameStatistics.html index f46117538..b1f47860f 100644 --- a/Application/Admin/View/FinancePromote/gameStatistics.html +++ b/Application/Admin/View/FinancePromote/gameStatistics.html @@ -194,7 +194,7 @@ 推广公司 会长账号 - 所属市场专员 + 当前所属市场专员 团体类型 开发类型 游戏 diff --git a/Application/Admin/View/FinancePromote/index.html b/Application/Admin/View/FinancePromote/index.html index b7bdae4c9..545faf957 100644 --- a/Application/Admin/View/FinancePromote/index.html +++ b/Application/Admin/View/FinancePromote/index.html @@ -183,7 +183,7 @@ 推广公司 会长渠道 - 所属市场专员 + 当前所属市场专员 内外团 开发类型 diff --git a/Application/Admin/View/FinancePromote/promoteUser.html b/Application/Admin/View/FinancePromote/promoteUser.html index 21dc5d37a..efac2aafa 100644 --- a/Application/Admin/View/FinancePromote/promoteUser.html +++ b/Application/Admin/View/FinancePromote/promoteUser.html @@ -174,7 +174,7 @@ 推广公司 推广员账号 - 所属市场专员 + 当前所属市场专员 团体类型 开发类型