From 51fb6a3ebd82a3068797b6b4b8795a5051e796b3 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 31 Jul 2020 15:21:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=93=E6=AC=BE=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExcelPaymentController.class.php | 39 ++++++++++-------- .../Controller/PaymentController.class.php | 40 +++++++++---------- 2 files changed, 43 insertions(+), 36 deletions(-) diff --git a/Application/Payment/Controller/ExcelPaymentController.class.php b/Application/Payment/Controller/ExcelPaymentController.class.php index e94ce3af8..2891ee590 100644 --- a/Application/Payment/Controller/ExcelPaymentController.class.php +++ b/Application/Payment/Controller/ExcelPaymentController.class.php @@ -307,12 +307,16 @@ class ExcelPaymentController extends BaseController } public function getAccountMoney(){ Vendor("Alipay2020/Fund"); - $fund = new \Fund(C("ALI_PAYMENT")); - $money = $fund->account(); - if($money !== -1){ - $money = $money['amount']; + if(empty(C("ALI_PAYMENT"))){ + $money = "测试站无法查看"; }else{ - $money = "--"; + $fund = new \Fund(C("ALI_PAYMENT")); + $money = $fund->account(); + if($money !== -1){ + $money = $money['amount']; + }else{ + $money = "--"; + } } $this->assign("money",$money); } @@ -331,41 +335,44 @@ class ExcelPaymentController extends BaseController { $id = $_REQUEST['id']; $remark = $_REQUEST['remark']; - + if (empty(C("ALI_PAYMENT"))) { + $this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>[]]); + } + Vendor("Alipay2020/Fund"); $fund = new \Fund(C("ALI_PAYMENT")); - - $dbres = M("ExcelStatementInfo","tab_")->where("id='{$id}'")->find(); - $company_info = json_decode($dbres['company_info'],true); + $dbres = M("ExcelStatementInfo", "tab_")->where("id='{$id}'")->find(); + $company_info = json_decode($dbres['company_info'], true); - if($dbres['pay_status'] != 1){ + if ($dbres['pay_status'] != 1) { //执行打款 $title = $remark; $amount = $dbres['statement_money']; - $payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title); + $payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title); $resultCode = $payres->code; $savedata = ["id"=>$dbres['id']]; - if(!empty($resultCode)&&$resultCode == 10000){ + if (!empty($resultCode)&&$resultCode == 10000) { $savedata["pay_status"]=1; } else { $savedata["pay_status"]=-1; } - $payres = json_decode( json_encode($payres),true); + $payres = json_decode(json_encode($payres), true); $payres["remark"] = $remark; - $savedata["pay_info"] = json_encode($payres,JSON_UNESCAPED_UNICODE); + $savedata["pay_info"] = json_encode($payres, JSON_UNESCAPED_UNICODE); $savedata["pay_time"]=time(); $pu = [ "mobile"=>$this->admininfo['mobile'], "real_name"=>$this->admininfo['real_name'], "time"=>date("Y-m-d H:i:s") ]; - $savedata['payment_user'] = json_encode($pu,JSON_UNESCAPED_UNICODE); + $savedata['payment_user'] = json_encode($pu, JSON_UNESCAPED_UNICODE); } - M("ExcelStatementInfo","tab_")->save($savedata); + M("ExcelStatementInfo", "tab_")->save($savedata); $this->ajaxReturn(["success"=>"打款成功","data"=>[]]); + } /** * 打款详情 diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index 4a652b748..d074b48f5 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -406,13 +406,18 @@ class PaymentController extends BaseController } public function getAccountMoney(){ Vendor("Alipay2020/Fund"); - $fund = new \Fund(C("ALI_PAYMENT")); - $money = $fund->account(); - if($money !== -1){ - $money = $money['amount']; + if(empty(C("ALI_PAYMENT"))){ + $money = "测试站无法查看"; }else{ - $money = "--"; + $fund = new \Fund(C("ALI_PAYMENT")); + $money = $fund->account(); + if($money !== -1){ + $money = $money['amount']; + }else{ + $money = "--"; + } } + $this->assign("money",$money); } //以下打款流程 @@ -430,39 +435,34 @@ class PaymentController extends BaseController { $id = $_REQUEST['id']; $remark = $_REQUEST['remark']; - + if(empty(C("ALI_PAYMENT"))){ + $this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>[]]); + } Vendor("Alipay2020/Fund"); $fund = new \Fund(C("ALI_PAYMENT")); - - $dbres = M("company_statement_info","tab_")->where("id='{$id}'")->find(); - $company_info = json_decode($dbres['company_info'],true); - - if($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1){ + $dbres = M("company_statement_info", "tab_")->where("id='{$id}'")->find(); + $company_info = json_decode($dbres['company_info'], true); + if ($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1) { //执行打款 $title = "信息服务费"; $amount = $dbres['statement_money']; - $payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title); + $payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title); $resultCode = $payres->code; - - $savedata = ["id"=>$dbres['id']]; - if(!empty($resultCode)&&$resultCode == 10000){ + if (!empty($resultCode)&&$resultCode == 10000) { $savedata["pay_status"]=1; } else { $savedata["pay_status"]=-1; } - - $payres = json_decode( json_encode($payres),true); + $payres = json_decode(json_encode($payres), true); $payres["remark"] = $remark; - $savedata["pay_info"] = json_encode($payres,JSON_UNESCAPED_UNICODE); + $savedata["pay_info"] = json_encode($payres, JSON_UNESCAPED_UNICODE); $savedata["pay_type"]=2; $savedata["pay_time"]=time(); - } M("company_statement_info","tab_")->save($savedata); $this->ajaxReturn(["success"=>"打款成功","data"=>[]]); - # code... } /** * 执行最后聚合表统计