diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 7debc9146..d2e378244 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 ''; } @@ -789,9 +791,24 @@ class TimingController extends AdminController { ->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") + ->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(); @@ -800,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(); //公司税费计算 @@ -824,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']){ @@ -842,15 +860,15 @@ 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']] = 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)); } } @@ -889,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) { @@ -1022,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 @@ +