Merge branch 'release' of 47.111.118.107:wmtx/platform into hotfix/change_dabase_bank

master
chenzhi 5 years ago
commit aa6faf7280

@ -748,6 +748,8 @@ class TimingController extends AdminController {
return 9; return 9;
case 'yeepay': //易宝支付17 case 'yeepay': //易宝支付17
return 17; return 17;
case 'ptb_pay':
return 0;
default: default:
return ''; return '';
} }
@ -789,9 +791,24 @@ class TimingController extends AdminController {
->where($spend_map) ->where($spend_map)
->group("tab_spend.id") ->group("tab_spend.id")
->select(false); ->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") $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) ->where($map)
->group("pay_time,promote_id,game_name,pay_way,market_admin_id") ->group("pay_time,promote_id,game_name,pay_way,market_admin_id")
->select(); ->select();
@ -800,7 +817,7 @@ class TimingController extends AdminController {
$paywayData = M("tool","tab_") $paywayData = M("tool","tab_")
->field("name,config") ->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(); ->select();
//公司税费计算 //公司税费计算
@ -824,10 +841,11 @@ class TimingController extends AdminController {
$pay_rate = []; $pay_rate = [];
foreach ($paywayData as $key => $value) { foreach ($paywayData as $key => $value) {
$pay_config = json_decode($value['config'],true); $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; $pay_rate[$this->getPayway($value['name'])] = $pay_config['channel_rate']?$pay_config['channel_rate']:0;
} }
} }
foreach ($payway_spend as $key => $value) { foreach ($payway_spend as $key => $value) {
switch ($value['pay_way']){ switch ($value['pay_way']){
@ -842,15 +860,15 @@ class TimingController extends AdminController {
break; break;
} }
//将时间、推广员id、游戏名、设备类型作为键值标记渠道费用 //将时间、推广员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']) { 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); = $value['pay_amount'] * ($pay_rate[$value['pay_way']]/100);
} else { } else {
$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']]
= $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']]+($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]['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; $tax = 0;
//公司税费 //公司税费
foreach($tax_radio as $k => $v) { foreach($tax_radio as $k => $v) {
@ -1022,15 +1040,40 @@ class TimingController extends AdminController {
} }
// echo "{$value['nickname']}:{$value['pay_time']}\n"; // echo "{$value['nickname']}:{$value['pay_time']}\n";
// dump($market_percentage); // dump($market_percentage);
$all_data[$key]['performance_commission'] =
number_format($value['company_profit']*($market_percentage['develop_commission_ratio']/100) + $settleup_marketorder = M("settleup_marketorder","tab_")
$value['company_profit']*($market_percentage['maintain_commission_ratio']/100), 2, '.', ''); ->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):""; $sum_amount <$market_percentage['performance_revenue'] ? ($all_data[$key]['performance_commission'] = 0):"";
//绩效考核奖金 // $all_data[$key]['achievement_bonus'] =
$all_data[$key]['achievement_bonus'] = // number_format($value['company_profit']*($market_percentage['appraisal_bonuses_ratio']/100) +
number_format($value['company_profit']*($market_percentage['appraisal_bonuses_ratio']/100) + // $value['company_profit']*($market_percentage['maintain_appraisal_bonuses_ratio']/100), 2, '.', '');
$value['company_profit']*($market_percentage['maintain_appraisal_bonuses_ratio']/100), 2, '.', '');
$sum_amount <$market_percentage['appraisal_bonuses'] ? ($all_data[$key]['achievement_bonus'] = 0):""; $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, '.', ''); $all_data[$key]['commission'] = number_format($all_data[$key]['performance_commission']+$all_data[$key]['achievement_bonus'], 2, '.', '');

@ -254,7 +254,7 @@ class ToolController extends ThinkController {
*/ */
public function payset($value='') 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->BaseConfig($str);
$this->meta_title = '支付设置'; $this->meta_title = '支付设置';

@ -1295,6 +1295,20 @@
</tr> </tr>
<tr>
<td class="l noticeinfo">渠道费率</td>
<td class="r">
<input name="config[channel_rate]" type="text" value="{$ptb_pay['channel_rate']}" class="" placeholder="设置支付渠道的的费用比例">
<span class="notice-text">%</span>
</td>
</tr>
</tbody> </tbody>
</table> </table>

Loading…
Cancel
Save