From 7f99dafb2c9a74d26722105713a715eb64ce9fb7 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Fri, 10 Jan 2020 14:46:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E4=B8=8A=E6=B8=B8=E7=BB=93=E7=AE=97=E6=B5=81?= =?UTF-8?q?=E6=B0=B4bug=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 11 ++++++++ .../Controller/QueryController.class.php | 25 ++++++++++++------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 5daf3fc13..4c38f8749 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2009,6 +2009,17 @@ function getWithdrawNumber() { return $data; } +//上有流水计算 +function caculateUpstream($game_id,$pay_amount) { + + $data = M('cp_game_ratio','tab_') + ->where(['game_id'=>$game_id,'begin_total_amount'=>['elt',$pay_amount],'is_del'=>0]) + ->order('begin_total_amount Desc') + ->find(); + + return number_format($pay_amount*($data['ratio']/100),2,'.',''); + +} ?> diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index a3c0ff00f..1779e918b 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -1015,10 +1015,15 @@ class QueryController extends ThinkController } $map = []; - setPowerPromoteIds($map,'root_id'); +// setPowerPromoteIds($map,'root_id'); if ($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') { - $map['root_id'] = $_REQUEST['promote_id']; + if ($_REQUEST['promote_id']=='0') { + unset($map['root_id']); + $map['promote_account'] = '官方渠道'; + } else { + $map['root_id'] = $_REQUEST['promote_id']; + } } if ($_REQUEST['game_name']) { @@ -1053,10 +1058,10 @@ class QueryController extends ThinkController //关联表获取会长账号名 $data = M()->table('('.$data.') as a') - ->field("my_time,pay_amount,a.game_id,game_name,game_names,a.promote_id,a.promote_account,a.company_relation,a.company_belong,CASE WHEN root_id is null THEN 0 ELSE root_id END as root_id,CASE WHEN account is null THEN '官方渠道' ELSE account END as account,tab_ratio.ratio as ratio,turnover_ratio,game_ratio.ratio as games_ratio") + ->field("my_time,pay_amount,a.game_id,game_name,game_names,a.promote_id,a.promote_account,a.company_relation,a.company_belong,CASE WHEN root_id is null THEN 0 ELSE root_id END as root_id,CASE WHEN account is null THEN '官方渠道' ELSE account END as account,tab_ratio.ratio as ratio,turnover_ratio") ->join("left join tab_promote on root_id = tab_promote.id") ->join("left join tab_promote_game_ratio as tab_ratio on tab_ratio.game_id = a.game_id and tab_ratio.promote_id=root_id") - ->join("left join tab_cp_game_ratio as game_ratio on game_ratio.game_id = a.game_id") +// ->join("left join tab_cp_game_ratio as game_ratio on game_ratio.game_id = a.game_id") ->page($page,$row) ->where($map) ->group("my_time,game_names,root_id") @@ -1071,11 +1076,11 @@ class QueryController extends ThinkController foreach($data as $key => $value) { - if ($value['games_ratio']) { - $data[$key]['upstream'] = $value['pay_amount'] * ($value['games_ratio']*0.01); - } else { - $data[$key]['upstream'] = $value['pay_amount'] * 0; - } +// if ($value['games_ratio']) { +// $data[$key]['upstream'] = $value['pay_amount'] * ($value['games_ratio']*0.01); +// } else { + $data[$key]['upstream'] = caculateUpstream($value['game_id'],$value['pay_amount']); +// } if ($value['ratio']) { $data[$key]['downstream'] = $value['pay_amount'] * ($value['ratio']*0.01); @@ -1086,6 +1091,8 @@ class QueryController extends ThinkController $value['turnover_ratio'] = json_decode($value['turnover_ratio'],true); +// dd($value); + if (is_array($value['turnover_ratio'])) { foreach($value['turnover_ratio'] as $k =>$v) { if($value['pay_amount']>$v['turnover']) {