From 223c69797c0036e58df5080684178518a6acafad Mon Sep 17 00:00:00 2001 From: zyx Date: Thu, 6 Aug 2020 22:22:29 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=B8=81=E5=AF=BC?= =?UTF-8?q?=E5=87=BAbug=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/TimingController.class.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 7debc9146..d86a58756 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -785,11 +785,26 @@ class TimingController extends AdminController { CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id") ->join("left join tab_promote on tab_spend.promote_id = tab_promote.id") ->join("left join tab_game game on game.id=tab_spend.game_id") - ->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',0]]) + ->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',1]]) ->where($spend_map) ->group("tab_spend.id") ->select(false); -// var_dump($spend);die(); + + $desposit = M("deposit","tab_") + ->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(payed_time,'%Y-%m') pay_time, + substring_index(substring_index(tab_pay_info.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_deposit.sdk_version, + CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE tab_pay_info.promote_id END promote_id,tab_deposit.pay_way,market_admin_id") + ->join("inner join tab_pay_info on tab_pay_info.order_id=tab_deposit.pay_order_number") + ->join("left join tab_promote on tab_deposit.promote_id = tab_promote.id") + ->join("left join tab_game game on game.id=tab_pay_info.game_id") + ->where(['tab_deposit.pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'pay_source'=>2]) + ->where($spend_map) + ->group("tab_deposit.id") + ->select(false); + + $spend = "{$spend} UNION ALL {$desposit}"; + +// var_dump($desposit);die(); $payway_spend = M()->table("({$spend}) spend") ->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,pay_way,sdk_version") ->where($map) From bd9af09830306c5e876ae5655d263b2f9c3e4cc5 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Fri, 7 Aug 2020 18:29:40 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=AE=A1=E7=90=86bug=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/TimingController.class.php | 74 +++++++++++++------ .../Admin/Controller/ToolController.class.php | 2 +- Application/Admin/View/Tool/payset.html | 14 ++++ 3 files changed, 66 insertions(+), 24 deletions(-) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index d86a58756..477fb4c97 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -748,6 +748,8 @@ class TimingController extends AdminController { return 9; case 'yeepay': //易宝支付17 return 17; + case 'ptb_pay': + return 0; default: return ''; } @@ -785,24 +787,24 @@ class TimingController extends AdminController { CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id") ->join("left join tab_promote on tab_spend.promote_id = tab_promote.id") ->join("left join tab_game game on game.id=tab_spend.game_id") - ->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',1]]) + ->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',0]]) ->where($spend_map) ->group("tab_spend.id") ->select(false); - $desposit = M("deposit","tab_") - ->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(payed_time,'%Y-%m') pay_time, - substring_index(substring_index(tab_pay_info.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_deposit.sdk_version, - CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE tab_pay_info.promote_id END promote_id,tab_deposit.pay_way,market_admin_id") - ->join("inner join tab_pay_info on tab_pay_info.order_id=tab_deposit.pay_order_number") - ->join("left join tab_promote on tab_deposit.promote_id = tab_promote.id") - ->join("left join tab_game game on game.id=tab_pay_info.game_id") - ->where(['tab_deposit.pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'pay_source'=>2]) - ->where($spend_map) - ->group("tab_deposit.id") - ->select(false); - - $spend = "{$spend} UNION ALL {$desposit}"; +// $desposit = M("deposit","tab_") +// ->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(payed_time,'%Y-%m') pay_time, +// substring_index(substring_index(tab_pay_info.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_deposit.sdk_version, +// CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE tab_pay_info.promote_id END promote_id,tab_deposit.pay_way,market_admin_id") +// ->join("inner join tab_pay_info on tab_pay_info.order_id=tab_deposit.pay_order_number") +// ->join("left join tab_promote on tab_deposit.promote_id = tab_promote.id") +// ->join("left join tab_game game on game.id=tab_pay_info.game_id") +// ->where(['tab_deposit.pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'pay_source'=>2]) +// ->where($spend_map) +// ->group("tab_deposit.id") +// ->select(false); +// +// $spend = "{$spend} UNION ALL {$desposit}"; // var_dump($desposit);die(); $payway_spend = M()->table("({$spend}) spend") @@ -815,7 +817,7 @@ class TimingController extends AdminController { $paywayData = M("tool","tab_") ->field("name,config") - ->where(['name'=>['in',"alipay,weixin,wei_xin,wei_xin_app,jubaobar,weixin_gf,jft,jft_wap,goldpig,ptb_pay,bind_pay,sqpay,heepay,yeepay"]]) + ->where(['name'=>['in',"alipay,weixin,wei_xin,wei_xin_app,jubaobar,weixin_gf,jft,jft_wap,goldpig,ptb_pay,bind_pay,sqpay,heepay,yeepay,ptb_pay"]]) ->select(); //公司税费计算 @@ -839,10 +841,11 @@ class TimingController extends AdminController { $pay_rate = []; foreach ($paywayData as $key => $value) { $pay_config = json_decode($value['config'],true); - if ($this->getPayway($value['name'])) { + if ($this->getPayway($value['name'])||$this->getPayway($value['name'])=='0') { $pay_rate[$this->getPayway($value['name'])] = $pay_config['channel_rate']?$pay_config['channel_rate']:0; } } + foreach ($payway_spend as $key => $value) { switch ($value['pay_way']){ @@ -1037,15 +1040,40 @@ class TimingController extends AdminController { } // echo "{$value['nickname']}:{$value['pay_time']}\n"; // dump($market_percentage); - $all_data[$key]['performance_commission'] = - number_format($value['company_profit']*($market_percentage['develop_commission_ratio']/100) + - $value['company_profit']*($market_percentage['maintain_commission_ratio']/100), 2, '.', ''); + + $settleup_marketorder = M("settleup_marketorder","tab_") + ->where(['admin_id'=>$value['admin_id'],'pay_time'=>$value['pay_time']]) + ->select(); + + $all_data[$key]['performance_commission'] = 0; + $all_data[$key]['achievement_bonus'] = 0; + foreach ($settleup_marketorder as $k => $v) { + + if($v['develop_type'] == 1 || $v['develop_type'] == 2) { + $all_data[$key]['performance_commission'] += $v['company_profit']*($market_percentage['develop_commission_ratio']/100); + } + + if ($v['develop_type'] == 3) { + $all_data[$key]['performance_commission'] += $v['company_profit']*($market_percentage['maintain_commission_ratio']/100); + } + + //绩效考核奖金 + if($v['develop_type'] == 1 || $v['develop_type'] == 2) { + $all_data[$key]['achievement_bonus'] +=$v['company_profit']*($market_percentage['appraisal_bonuses_ratio']/100); + } + + if ($v['develop_type'] == 3) { + $all_data[$key]['achievement_bonus'] += $v['company_profit']*($market_percentage['maintain_appraisal_bonuses_ratio']/100); + } + + } + $all_data[$key]['performance_commission'] = number_format($all_data[$key]['performance_commission'], 2, '.', ''); + $all_data[$key]['achievement_bonus'] = number_format($all_data[$key]['achievement_bonus'], 2, '.', ''); $sum_amount <$market_percentage['performance_revenue'] ? ($all_data[$key]['performance_commission'] = 0):""; - //绩效考核奖金 - $all_data[$key]['achievement_bonus'] = - number_format($value['company_profit']*($market_percentage['appraisal_bonuses_ratio']/100) + - $value['company_profit']*($market_percentage['maintain_appraisal_bonuses_ratio']/100), 2, '.', ''); +// $all_data[$key]['achievement_bonus'] = +// number_format($value['company_profit']*($market_percentage['appraisal_bonuses_ratio']/100) + +// $value['company_profit']*($market_percentage['maintain_appraisal_bonuses_ratio']/100), 2, '.', ''); $sum_amount <$market_percentage['appraisal_bonuses'] ? ($all_data[$key]['achievement_bonus'] = 0):""; //总提成 $all_data[$key]['commission'] = number_format($all_data[$key]['performance_commission']+$all_data[$key]['achievement_bonus'], 2, '.', ''); diff --git a/Application/Admin/Controller/ToolController.class.php b/Application/Admin/Controller/ToolController.class.php index 489ee8bb5..b93ad68cf 100644 --- a/Application/Admin/Controller/ToolController.class.php +++ b/Application/Admin/Controller/ToolController.class.php @@ -254,7 +254,7 @@ class ToolController extends ThinkController { */ public function payset($value='') { - $str = "alipay,weixin,wei_xin,wei_xin_app,jubaobar,weixin_gf,jft,jft_wap,goldpig,ptb_pay,bind_pay,sqpay,heepay,yeepay"; + $str = "alipay,weixin,wei_xin,wei_xin_app,jubaobar,weixin_gf,jft,jft_wap,goldpig,ptb_pay,bind_pay,sqpay,heepay,yeepay,ptb_pay"; $this->BaseConfig($str); $this->meta_title = '支付设置'; diff --git a/Application/Admin/View/Tool/payset.html b/Application/Admin/View/Tool/payset.html index d52419164..0bbc4365f 100644 --- a/Application/Admin/View/Tool/payset.html +++ b/Application/Admin/View/Tool/payset.html @@ -1295,6 +1295,20 @@ + + + 渠道费率 + + + + + + % + + + + + From a140a4c9d529c858c547866b2cd0086c89020a6e Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 10 Aug 2020 15:43:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=AE=A1=E7=90=86bug=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/TimingController.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 477fb4c97..1d61092e8 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -808,7 +808,7 @@ class TimingController extends AdminController { // var_dump($desposit);die(); $payway_spend = M()->table("({$spend}) spend") - ->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,pay_way,sdk_version") + ->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,pay_way,sdk_version,market_admin_id") ->where($map) ->group("pay_time,promote_id,game_name,pay_way,market_admin_id") ->select(); @@ -862,13 +862,13 @@ class TimingController extends AdminController { //将时间、推广员id、游戏名、设备类型作为键值标记渠道费用 if (!$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name']]) { if (!$value['pay_way']) { - $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name']] = 0; + $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']] = 0; } - $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name']] + $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']] = $value['pay_amount'] * ($pay_rate[$value['pay_way']]/100); } else { - $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name']] - = $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name']]+($value['pay_amount'] * ($pay_rate[$value['pay_way']]/100)); + $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']] + = $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']]+($value['pay_amount'] * ($pay_rate[$value['pay_way']]/100)); } } @@ -907,7 +907,7 @@ class TimingController extends AdminController { //下游流水 $promote_data[$key]['promote_amount'] = $value['pay_amount'] * ($promote_radio * 0.01); //渠道费用 - $promote_data[$key]['channel_amount'] = $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name']]; + $promote_data[$key]['channel_amount'] = $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['admin_id']]; $tax = 0; //公司税费 foreach($tax_radio as $k => $v) { From ccca696de23ac042584940f5da62a7fdda41b82d Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 10 Aug 2020 16:08:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=AE=A1=E7=90=86bug=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/TimingController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 1d61092e8..d2e378244 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -860,7 +860,7 @@ class TimingController extends AdminController { break; } //将时间、推广员id、游戏名、设备类型作为键值标记渠道费用 - if (!$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name']]) { + if (!$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']]) { if (!$value['pay_way']) { $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']] = 0; }