From cb99c63223a233d76257301078447b6f7173d782 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 20 Dec 2019 15:48:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E4=BC=9A=E7=BB=9F=E8=AE=A16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancePromoteController.class.php | 149 +++++++++--------- .../View/FinancePromote/gameCoinDetail.html | 80 +++++++--- .../Admin/View/FinancePromote/index.html | 10 +- .../View/FinancePromote/insideCoinDetail.html | 72 ++++----- .../View/FinancePromote/promoteUser.html | 9 +- 5 files changed, 173 insertions(+), 147 deletions(-) diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index 7c6da3112..e938aa1ae 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -30,35 +30,11 @@ class FinancePromoteController extends AdminController } $senddata = []; - //获取各会长的现金充值 - $cash = self::getJoinPromoteData(array("pay_way"=>array("GT",0)),$istimeselect); + //获取各会长的充值方式 + $cash = self::getJoinPromoteData([],$istimeselect); foreach($cash as $k=>$v){ - $v['cash_count'] = $v['pay_amount']; - unset($v['pay_amount']); $senddata[$v['p_id']] = $v; } - //平台币直充支出 - $balance = self::getJoinPromoteData(array("pay_way"=>array("EQ",0)),$istimeselect); - foreach($balance as $k=>$v){ - if(array_key_exists($v['p_id'],$senddata)){ - $senddata[$v['p_id']]['balance_coin_count']= $v['pay_amount']; - }else{ - $v['balance_coin_count'] = $v['pay_amount']; - unset($v['pay_amount']); - $senddata[$v['p_id']] = $v; - }; - } - //平台币内充 - $bind = self::getJoinPromoteData(array("pay_way"=>array("LT",0)),$istimeselect); - foreach($bind as $k=>$v){ - if(array_key_exists($v['p_id'],$senddata)){ - $senddata[$v['p_id']]['bind_coin_count']= $v['pay_amount']; - }else{ - $v['bind_coin_count'] = $v['pay_amount']; - unset($v['pay_amount']); - $senddata[$v['p_id']] = $v; - }; - } //内冲 $inside = self::getJoinPromoteData([],$istimeselect,"promote_coin"); foreach($inside as $k=>$v){ @@ -133,7 +109,11 @@ class FinancePromoteController extends AdminController } $map['s.pay_status']=1; - $field= "sum(pay_amount) pay_amount,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_id,0) company_id,company_name"; + $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 bind_coin_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_id,0) company_id,company_name"; return M() ->table("tab_spend s") ->field($field) @@ -182,34 +162,10 @@ class FinancePromoteController extends AdminController } $senddata = []; //获取各会长的现金充值 - $cash = self::promoteUserData(array("pay_way"=>array("GT",0)),$istimeselect); + $cash = self::promoteUserData([],$istimeselect); foreach($cash as $k=>$v){ - $v['cash_count'] = $v['pay_amount']; - unset($v['pay_amount']); $senddata[$v['promote_id']] = $v; } - //平台币直充支出 - $balance = self::promoteUserData(array("pay_way"=>array("EQ",0)),$istimeselect); - foreach($balance as $k=>$v){ - if(array_key_exists($v['promote_id'],$senddata)){ - $senddata[$v['promote_id']]['balance_coin_count']= $v['pay_amount']; - }else{ - $v['balance_coin_count'] = $v['pay_amount']; - unset($v['pay_amount']); - $senddata[$v['promote_id']] = $v; - }; - } - //平台币内充 - $bind = self::promoteUserData(array("pay_way"=>array("LT",0)),$istimeselect); - foreach($bind as $k=>$v){ - if(array_key_exists($v['promote_id'],$senddata)){ - $senddata[$v['promote_id']]['bind_coin_count']= $v['pay_amount']; - }else{ - $v['bind_coin_count'] = $v['pay_amount']; - unset($v['pay_amount']); - $senddata[$v['promote_id']] = $v; - }; - } $inside = self::promoteUserData([],$istimeselect,"promote_coin"); foreach($inside as $k=>$v){ if(array_key_exists($v['promote_id'],$senddata)){ @@ -295,7 +251,10 @@ class FinancePromoteController extends AdminController $map['s.pay_time']=$istimeselect; } $map['s.pay_status']=1; - $field= "sum(pay_amount) pay_amount,IFNULL(company_id,0) company_id,company_name,promote_id"; + $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 bind_coin_count, + IFNULL(company_id,0) company_id,company_name,promote_id"; return M() ->table("tab_spend s") ->field($field) @@ -669,6 +628,17 @@ class FinancePromoteController extends AdminController } $map['s.promote_id'] = $_REQUEST['promote_id']; } + //检索 + if (isset($_REQUEST['sn'])) { + $pmap['order_number'] = array("LIKE","%".$_REQUEST['sn']."%"); + $map['sn'] = array("LIKE","%".$_REQUEST['sn']."%"); + } + if (isset($_REQUEST['type'])) { + if($_REQUEST['type'] == 2){ + $pmap['op_id'] =0;//肯定false + } + $map['s.type'] =$_REQUEST['type']; + } // $senddata = []; @@ -679,47 +649,72 @@ class FinancePromoteController extends AdminController if($istimeselect){ $pmap['create_time'] = $istimeselect; } - $admininside = M("provide_user p","tab_") - ->field("order_number,user_account,amount,balance") - ->join("left join tab_user as u on u.id = p.user_id") - ->page($page, $row) - ->where($pmap) - ->select(); - foreach ($admininside as $k => $v) { - $temp = [ - "sn"=>$v['order_number'], - "op_type"=>"收入", - "op_sty"=>"后台发放玩家", - "" - ]; - # code... - } - $admincount = M("provide_user p","tab_")->field("sum(amount) amount,count(*) count")->where($pmap)->find(); $count = $admincount["count"]?:0; $total_cost = $admincount["amount"]?:0; + if($count >0){ + $admininside = M("provide_user p","tab_") + ->field("order_number,user_account,amount,balance,create_time") + ->join("left join tab_user as u on u.id = p.user_id") + ->page($page, $row) + ->where($pmap) + ->select(); + foreach ($admininside as $k => $v) { + $temp = [ + "sn"=>$v['order_number'], + "op_type"=>"收入", + "op_sty"=>"后台发放玩家", + "account"=>"管理员", + "op_num"=>$v['amount'], + "balance_coin"=>$v['balance']?:'0.00', + "mark"=>"后台发放平台币", + "create_time"=>date("Y-m-d H:i:s",$v['create_time']) + ]; + $senddata[] = $temp; + } + } + }else{ if($istimeselect){ $map['s.create_time']=$istimeselect; } $map['s.status']=1; $map['s.source_id']=0; - $field= "num,sn,promote.balance_coin,account,s.type"; - $ininside = M("promote_coin s","tab_") - ->field($field) - ->where($map) - ->page($page, $row) - ->join("tab_promote promote ON s.promote_id = promote.id","left") - ->select(); $ininsidecount = M("promote_coin s","tab_") ->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,count(*) count") ->where($map) ->find(); $count = $ininsidecount["count"]?:0; $total_cost = ($ininsidecount["pay_amount"]-$ininsidecount["back_amount"]); + if ($count >0) { + $field= "num,sn,promote.balance_coin,account,s.type,remark,s.create_time"; + $ininside = M("promote_coin s", "tab_") + ->field($field) + ->where($map) + ->page($page, $row) + ->join("tab_promote promote ON s.promote_id = promote.id", "left") + ->select(); + foreach ($ininside as $k => $v) { + $temp = [ + "sn"=>$v['sn'], + "op_type"=>($v['type'] == 1) ? "收入":"支出", + "op_sty"=>($v['type'] == 1) ? "后台发放":"后台回收", + "account"=>"管理员", + "op_num"=>$v['num']?:'0.00', + "balance_coin"=>$v['balance_coin'], + "mark"=>$v["remark"]?:"后台发放平台币", + "create_time"=>date("Y-m-d H:i:s",$v['create_time']) + ]; + $senddata[] = $temp; + } + } } - + $this->assign('total_cost', $total_cost); + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + $this->assign('data',$senddata); + $this->display(); } diff --git a/Application/Admin/View/FinancePromote/gameCoinDetail.html b/Application/Admin/View/FinancePromote/gameCoinDetail.html index ce9338edc..805b30370 100644 --- a/Application/Admin/View/FinancePromote/gameCoinDetail.html +++ b/Application/Admin/View/FinancePromote/gameCoinDetail.html @@ -29,9 +29,12 @@
- - - + + + + + +
  @@ -45,8 +48,25 @@  
+ + + +
+ +
+
+ +
+
+
- 搜索 0 ){ - url += '&' + query; - } else { - url += '?' + query; + $("#search").click(function(){ + console.log(222); + var url = $(this).attr('url'); + var query = $('.jssearch').find('input').serialize(); + query += "&" + $('.jssearch').find('select').serialize(); + query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,''); + query = query.replace(/^&/g,''); + if ( url.indexOf('?')>0 ){ + url += '&' + query; + } else { + url += '?' + query; + } + window.parent.reloadIframe(url); + parent.document.getElementsByTagName('iframe').src = url; + console.log(url); + }); + function get_game_list() + { + var game_name = "{:I('game_name')}"; + $.ajax({ + url:"{:U('Finance/getGameList')}", + type:"post", + data:{partner_id:$("#partner_id option:selected").val(), sdk_type:$("#sdk_version1 option:selected").val()}, + dataType:'json', + success:function(data){ + var str = ""; + for (var i in data){ + str += "" + } + // console.log(str); + $("#game_name").empty(); + $("#game_name").append(str); + // $("#server_id").select2(); + + } + }) } - window.parent.reloadIframe(url); - parent.document.getElementsByTagName('iframe').src = url; - console.log(url); - }); + get_game_list(); }); diff --git a/Application/Admin/View/FinancePromote/index.html b/Application/Admin/View/FinancePromote/index.html index c56995c34..eb4e51695 100644 --- a/Application/Admin/View/FinancePromote/index.html +++ b/Application/Admin/View/FinancePromote/index.html @@ -212,9 +212,11 @@ {$data.bind_coin_count} + + {$data.inside_cash_count} - {$data.inside_cash_count} + {$data.allcount} @@ -289,6 +291,10 @@ });