From a0150c300f815a0212d310c2755bc6953b8ac5f7 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 15 Dec 2020 13:46:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?12=E6=9C=88=E5=8A=9F=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Payment/Controller/PublicController.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 = []; From 309b195986430f6a37ae8afd900f0790d4e314fe Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 15 Dec 2020 14:55:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?12=E6=9C=88=E5=8A=9F=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementPoolController.class.php | 4 ++ .../Controller/PaymentController.class.php | 38 +++++++++++++++++-- .../Payment/View/Payment/showPayment.html | 2 +- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 5b242e20c..b64383c74 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -1917,6 +1917,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) { // @@ -1946,6 +1947,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']; @@ -1984,6 +1986,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) { @@ -2013,6 +2016,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/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}