优化上游新增服务器费用结算包名

master
chenzhi 5 years ago
parent 51c4b07eea
commit 16a3bea172

@ -143,7 +143,7 @@ class CompanyStatementSetController extends Controller {
$cp_id = implode(",",array_flip(array_flip(array_keys($cpList))));
$js_id = implode(",",array_unique($js_id));
//获取cp公司
$tmpp = M("Partner","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank,channel_rate,invoice_rate,company_type,ali_user,ali_account")->where(["id"=>['in',$cp_id]])->select();
$tmpp = M("Partner","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank,channel_rate,invoice_rate,company_type,ali_user,ali_account,has_advance_charge,has_server_fee")->where(["id"=>['in',$cp_id]])->select();
$cp =[];
foreach ($tmpp as $v) {
$cp[$v['id']]=$v;
@ -298,14 +298,15 @@ class CompanyStatementSetController extends Controller {
if($type < 2){
//非补点奖罚
$rrmap = array(
"reward_time" => ['between', [$begintime,$endtime]],
"confirm_time" => ['between', [$begintime,$endtime]],
"company_type"=>1,
"company_id"=>$add_data['company_id']
"company_id"=>$add_data['company_id'],
"settlement_type"=>2,
);
$rfres = M("RewardRecord","tab_")
$rfres = M("RewardDetail","tab_")
->field("
IFNULL(SUM(CASE WHEN reward_type = 1 THEN money ELSE 0 END),0) as reward_count,
IFNULL(SUM(CASE WHEN reward_type = 2 THEN money ELSE 0 END),0) as fine_count
IFNULL(SUM(CASE WHEN type = 1 THEN amount ELSE 0 END),0) as reward_count,
IFNULL(SUM(CASE WHEN type = 2 THEN amount ELSE 0 END),0) as fine_count
")
->where($rrmap)->find();
if($rfres['reward_count'] > 0){
@ -333,7 +334,21 @@ class CompanyStatementSetController extends Controller {
);
$add_data['statement_money'] -= $fine_count;
$add_data['pay_amount'] -= $fine_count;;
}
}
//获取服务器费用
if($v['has_server_fee'] == 1 && $v['server_fee'] >0){
$server_count = $v['server_fee'];
$add_data['statement_info'][] = array(
"statement_begin_time"=>$statement_begin_time,
"statement_end_time"=>$statement_end_time,
'statement_type'=>1,
"game_name"=>"服务器费用",
'pay_amount'=>$server_count,
'sum_money'=>$server_count,
);
$add_data['statement_money'] -= $server_count;
$add_data['pay_amount'] -= $server_count;;
}
}
$add_data['statement_info'] = json_encode($add_data['statement_info'],JSON_UNESCAPED_UNICODE);

Loading…
Cancel
Save