diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index 79ff49961..d1ee51c64 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -191,6 +191,10 @@ class AjaxController extends ThinkController{ foreach ($data as &$item) { $item['nickname'] = $item['account'] . ($item['nickname'] ? "({$item['nickname']})" : ""); } + if($company_id <= 0){ + array_unshift($data,["id"=>0,"nickname"=>"官方渠道","account"=>"官方渠道","company_id"=>0]); + + } $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>$data]); } diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index b14d030a7..c858d129a 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -2,7 +2,8 @@ namespace Admin\Controller; class FinancePromoteController extends AdminController { - public function _initialize(Type $var = null) + public $COMPANY_NAME = "万盟天下科技"; + public function _initialize() { parent::_initialize(); // echo "
"; @@ -114,7 +115,7 @@ class FinancePromoteController extends AdminController } else { $v['company_belong']='内团'; } - if(empty($v['company_name'])) $v['company_name']= "万盟天下科技"; + if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME; if(empty($v['p_id'])) $v['p_id']= "0"; if(!array_key_exists('cash_count',$v)) $v['cash_count']=0; if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0; @@ -308,7 +309,7 @@ class FinancePromoteController extends AdminController foreach($senddata as $k=>$v){ $v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团'; - if(empty($v['company_name'])) $v['company_name']= "万盟天下科技"; + if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME; if(empty($v['promote_account'])) $v['promote_account']= "官方渠道"; if(!array_key_exists('cash_count',$v)) $v['cash_count']=0; if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0; @@ -585,16 +586,26 @@ class FinancePromoteController extends AdminController ->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") + SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count, + IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id, + IFNULL(company_name,'{$this->COMPANY_NAME}') company_name") ->join('LEFT JOIN tab_game as g ON s.game_id=g.id') + ->join("tab_promote promote ON s.promote_id = promote.id","left") + ->join("tab_promote_company company ON promote.company_id = company.id","left") ->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id') + ->order("p_id asc,cash_count desc") ->where($map) - ->group('s.game_id'); + ->group('p_id,game_id'); if ($row != 0) { $query = $query->page($page,$row); } - $data = $query->select(); - // dump($data);die(); + $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) @@ -621,27 +632,15 @@ class FinancePromoteController extends AdminController $map['pay_way'] = $_REQUEST['pay_way']; $this->assign('pay_way', $map['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['tab_spend.game_id'] = ['in',$gameId]; - // } if (!empty(I("game_id"))) { $map['tab_spend.game_id'] = I("game_id"); } if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type']) || isset($_REQUEST['partner_id'])) { $map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameidByPartnerNameType($_REQUEST['partner_id'],$_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) ); } - // if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) { - // $map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) ); - // } - if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { $map['pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]]; } elseif (isset($_REQUEST['time_start'])) { @@ -649,7 +648,6 @@ class FinancePromoteController extends AdminController } elseif (isset($_REQUEST['time_end'])) { $map['pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399]; } - if ($_REQUEST['promote_id'] != '') { if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) { $map['tab_spend.promote_id'] = $_REQUEST['promote_id']; @@ -725,8 +723,6 @@ class FinancePromoteController extends AdminController $count = count($count); $page = set_pagination($count,$row); - - // $map['pay_game_status'] = 1; $total_cost = D('spend')->sumSpend($map, 'cost');//订单金额合计 $total_pay_amount = D('spend')->sumSpend($map, 'pay_amount');//实付金额合计 @@ -888,7 +884,7 @@ class FinancePromoteController extends AdminController $pmap['company_id'] = $_REQUEST['company_id']; //获取公司名称 if($pmap['company_id'] == 0){ - $title .= "万盟天下科技-"; + $title .= "{$this->COMPANY_NAME}-"; }else{ $gfflg = false; $title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-"); @@ -921,9 +917,10 @@ class FinancePromoteController extends AdminController $t_in = implode(',', array_column($promoter_ids, 'id')); } $map[$field] = ['in',$t_in]; + }else{ + $map[$field] = ['in',"-1"]; } } - //判断是否有推广员 $level = 1; if ($_REQUEST['promote_id'] != '') { @@ -939,7 +936,6 @@ class FinancePromoteController extends AdminController } } } - // dd($map); $_POST['promote_level'] = $level; } diff --git a/Application/Admin/View/FinancePromote/gameStatistics.html b/Application/Admin/View/FinancePromote/gameStatistics.html index ab804df9f..5cc6975b3 100644 --- a/Application/Admin/View/FinancePromote/gameStatistics.html +++ b/Application/Admin/View/FinancePromote/gameStatistics.html @@ -95,6 +95,23 @@ ++ +++ ++- - + + - +@@ -150,6 +167,8 @@+ 推广公司 +会长账号 合作公司 游戏 @@ -180,11 +199,13 @@+ {$data.company_name} +{$data.account} {$data.partner_name} {$data.game_name} {$data.cash_count} -{$data.balance_coin_count} -+ {$data.balance_coin_count} +{$data.inside_cash_count} {$data.all_cash_count} @@ -194,7 +215,7 @@- 总计 +总计 {$sumCash} 0 {$sumBalance} 0 @@ -250,7 +271,7 @@ }); - $('.page a:eq(1)').click(function () { + $('.page a').click(function () { var href = $(this).attr('href'); $(this).removeAttr('href'); window.location.replace(href) @@ -348,6 +369,35 @@ } }) } + var promote_id = "{:I('promote_id')}"; + var company_id = "{:I('company_id')}"; + function getPromotersByCompanyid() { + var company_id = $("#company_id option:selected").val(); + if(!company_id){ + company_id = -1; + } + $.ajax({ + url: "{:U('Ajax/getPromotersByCompanyid')}", + type: "get", + data: { company_id:company_id}, + dataType: 'json', + success: function (response) { + str = ''; + data = response.data; + for (var i in data) { + str += "" + } + $("#promote_id").empty(); + $("#promote_id").append(str); + $("#promote_id").select2(); + } + }) + } + getPromotersByCompanyid(); + + $("#company_id").change(function(){ + getPromotersByCompanyid(); + }) // $("#game_name, #game_type").change(function(){ // get_partnet_list(); // }); diff --git a/Application/Admin/View/FinancePromote/gameStatisticsDetail.html b/Application/Admin/View/FinancePromote/gameStatisticsDetail.html index e93266324..59acf1702 100644 --- a/Application/Admin/View/FinancePromote/gameStatisticsDetail.html +++ b/Application/Admin/View/FinancePromote/gameStatisticsDetail.html @@ -244,7 +244,7 @@ highlight_subnav('{:U("FinancePromote/index")}'); $(function(){ - $('.page a:eq(1)').click(function () { + $('.page a').click(function () { var href = $(this).attr('href'); $(this).removeAttr('href'); window.location.replace(href) diff --git a/Application/Admin/View/FinancePromote/promoteUser.html b/Application/Admin/View/FinancePromote/promoteUser.html index 0ed92f16e..3619e61fd 100644 --- a/Application/Admin/View/FinancePromote/promoteUser.html +++ b/Application/Admin/View/FinancePromote/promoteUser.html @@ -307,7 +307,7 @@ window.location.replace(url); // window.location.href = url; }); - $('.page a:eq(1)').click(function () { + $('.page a').click(function () { var href = $(this).attr('href'); $(this).removeAttr('href'); window.location.replace(href) {$sumInside} 0