市场结算管理bug修正

master
zhengyongxing 5 years ago
parent c72d60b37d
commit bd9af09830

@ -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 '';
} }
@ -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") 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_promote on tab_spend.promote_id = tab_promote.id")
->join("left join tab_game game on game.id=tab_spend.game_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) ->where($spend_map)
->group("tab_spend.id") ->group("tab_spend.id")
->select(false); ->select(false);
$desposit = M("deposit","tab_") // $desposit = M("deposit","tab_")
->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(payed_time,'%Y-%m') pay_time, // ->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, // 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") // 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("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_promote on tab_deposit.promote_id = tab_promote.id")
->join("left join tab_game game on game.id=tab_pay_info.game_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(['tab_deposit.pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'pay_source'=>2])
->where($spend_map) // ->where($spend_map)
->group("tab_deposit.id") // ->group("tab_deposit.id")
->select(false); // ->select(false);
//
$spend = "{$spend} UNION ALL {$desposit}"; // $spend = "{$spend} UNION ALL {$desposit}";
// var_dump($desposit);die(); // var_dump($desposit);die();
$payway_spend = M()->table("({$spend}) spend") $payway_spend = M()->table("({$spend}) spend")
@ -815,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();
//公司税费计算 //公司税费计算
@ -839,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']){
@ -1037,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