|
|
|
@ -837,7 +837,7 @@ class PaymentController extends BaseController
|
|
|
|
|
|
|
|
|
|
$CompanyInfo = M("pay_statement_info","tab_")
|
|
|
|
|
->alias('i')
|
|
|
|
|
->field("i.id,c.pool_id,i.company_name,i.company_info,i.statement_money,p.statement_num,i.remark,i.pay_status")
|
|
|
|
|
->field("i.id,c.pool_id,i.company_name,i.company_info,i.statement_money,p.statement_num,i.remark,i.pay_status,i.final_statement_money")
|
|
|
|
|
->join("left join tab_company_statement_info c ON c.id = i.statement_info_id")
|
|
|
|
|
->join("left join tab_company_statement_pool p ON p.id = c.pool_id")
|
|
|
|
|
->where("i.id in ({$ids})")
|
|
|
|
@ -848,7 +848,7 @@ class PaymentController extends BaseController
|
|
|
|
|
$v['company_info']['ali_account'] ?? '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$count = M("pay_statement_info","tab_")->field("sum(statement_money) statement_money")->where("id in ({$ids})")->find();
|
|
|
|
|
$count = M("pay_statement_info","tab_")->field("sum(final_statement_money) statement_money")->where("id in ({$ids})")->find();
|
|
|
|
|
$this->getAccountMoney();
|
|
|
|
|
// dd($CompanyInfo);
|
|
|
|
|
|
|
|
|
@ -903,7 +903,8 @@ class PaymentController extends BaseController
|
|
|
|
|
if ($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1) {
|
|
|
|
|
//执行打款
|
|
|
|
|
$title = "信息服务费";
|
|
|
|
|
$amount = $dbres['statement_money'];
|
|
|
|
|
$amount = $dbres['final_statement_money'];
|
|
|
|
|
|
|
|
|
|
$payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title);
|
|
|
|
|
$resultCode = $payres->code;
|
|
|
|
|
$savedata = ["id"=>$dbres['id']];
|
|
|
|
@ -925,7 +926,7 @@ class PaymentController extends BaseController
|
|
|
|
|
if ($savedata["pay_status"] == -1) {
|
|
|
|
|
//支付详单bug修改
|
|
|
|
|
$this->setPayVerifyStatus(-1,$savedata["pay_type"],$id);
|
|
|
|
|
$this->ajaxReturn(["success"=>"打款成功","data"=>["status"=>0],'amount'=>$dbres['statement_money']]);
|
|
|
|
|
$this->ajaxReturn(["success"=>"打款成功","data"=>["status"=>0],'amount'=>$dbres['final_statement_money']]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//支付详单bug修改
|
|
|
|
@ -1079,6 +1080,35 @@ class PaymentController extends BaseController
|
|
|
|
|
'statement_money'=>['elt',0]
|
|
|
|
|
])
|
|
|
|
|
->save(['pay_status'=>1,'pay_time'=>time(),'pay_type'=>2,'pay_info'=>$pay_info]);
|
|
|
|
|
|
|
|
|
|
$pay_statement_info = M("pay_statement_info","tab_")
|
|
|
|
|
->where([
|
|
|
|
|
'statement_info_id'=>['in',$value['id']]
|
|
|
|
|
])
|
|
|
|
|
->order("statement_money ASC")
|
|
|
|
|
->select();
|
|
|
|
|
$subtraction = 0;
|
|
|
|
|
foreach ($pay_statement_info as $sk => $sv) {
|
|
|
|
|
|
|
|
|
|
if ($sv['statement_money'] < 0) {
|
|
|
|
|
$subtraction += -($sv['statement_money']);
|
|
|
|
|
} elseif($sv['statement_money'] > 0 && $subtraction > 0) {
|
|
|
|
|
if($sv['statement_money'] >= $subtraction) {
|
|
|
|
|
$sv['final_statement_money'] = $sv['statement_money']-$subtraction;
|
|
|
|
|
$subtraction = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$sv['final_statement_money'] = 0;
|
|
|
|
|
$subtraction =-$sv['final_statement_money'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
M("pay_statement_info","tab_")
|
|
|
|
|
->where([
|
|
|
|
|
'id'=>$sv['id']
|
|
|
|
|
])->save($sv);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|