diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 074084d12..faec62a22 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -1990,6 +1990,7 @@ class CompanyStatementPoolController extends ThinkController } else { $save['statement_money'] = $amount; } + $save['final_statement_money'] = $save['statement_money']; // $setStatementInfo = json_decode($svalue['statement_info'],true); // foreach ($setStatementInfo as $sskey => $ssvalue) { // @@ -2019,6 +2020,7 @@ class CompanyStatementPoolController extends ThinkController $save['company_info'] = $svalue['company_info']; $save['statement_num'] = "JS_" . date("YmdHis", time()) . $save['company_id'] . sp_random_string(5); $save['statement_money'] = $statement_money; + $save['final_statement_money'] = $save['statement_money']; $save['statement_info_id'] = $svalue['id']; $save['fine'] = $svalue['fine']; $save['reward'] = $svalue['reward']; @@ -2057,6 +2059,7 @@ class CompanyStatementPoolController extends ThinkController } else { $save['statement_money'] = $amount; } + $save['final_statement_money'] = $save['statement_money']; $setStatementInfo = json_decode($svalue['statement_info'],true); foreach ($setStatementInfo as $sskey => $ssvalue) { @@ -2086,6 +2089,7 @@ class CompanyStatementPoolController extends ThinkController $save['company_info'] = $svalue['company_info']; $save['statement_num'] = "JS_" . date("YmdHis", time()) .$svalue['company_id'] . sp_random_string(5); $save['statement_money'] = $svalue['statement_money']; + $save['final_statement_money'] = $save['statement_money']; $save['statement_info_id'] = $svalue['id']; $save['fine'] = $svalue['fine']; diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index d84aad1f8..35c8b4ded 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -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); + + } + } } diff --git a/Application/Payment/Controller/PublicController.class.php b/Application/Payment/Controller/PublicController.class.php index 48a41f7bb..60c0664d5 100644 --- a/Application/Payment/Controller/PublicController.class.php +++ b/Application/Payment/Controller/PublicController.class.php @@ -130,9 +130,9 @@ class PublicController extends \Think\Controller public function checksafecode($phone, $code) { //测试验证码 - if($code == "txsb0601"){ - return true; - } +// if($code == "txsb0601"){ +// return true; +// } $taskClient = new TaskClient(); $result = $taskClient->checkSms($phone, $code); $data = []; diff --git a/Application/Payment/View/Payment/showPayment.html b/Application/Payment/View/Payment/showPayment.html index 63975b947..e40d20c73 100644 --- a/Application/Payment/View/Payment/showPayment.html +++ b/Application/Payment/View/Payment/showPayment.html @@ -148,7 +148,7 @@ {$vo.company_info.ali_user} {$vo.company_info.ali_account} {$vo.statement_num} - {$vo.statement_money} + {$vo.final_statement_money} {$vo.remark}