From 4ea5eb7147f1732f2a3fc2f28a01e3586a252b68 Mon Sep 17 00:00:00 2001 From: lyt Date: Mon, 15 Apr 2019 10:51:32 +0800 Subject: [PATCH] =?UTF-8?q?alipay=20=E5=A2=9E=E5=8A=A0=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E5=8F=B7=E6=9F=A5=E8=AF=A2=E6=B2=A1=E6=9C=89=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=9A=84=E6=94=B6=E6=AC=BE(=E6=9D=A5?= =?UTF-8?q?=E8=87=AA=E6=94=B6=E9=92=B1=E7=A0=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/AlipayTradeService.php | 44 ++++++++++++++----- .../pay/models/Alipay_note_model.php | 3 +- webht/third_party/pay/views/alipay_list.php | 9 +++- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index 808c6b0c..2c414461 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -509,29 +509,24 @@ class AlipayTradeService extends CI_Controller $request = new AlipayTradeQueryRequest(); $request->setBizContent ( $biz_content ); - $response = $this->aopclientRequestExecute ($request,true); + $response = $this->aopclientRequestExecute ($request); $response = $response->alipay_trade_query_response; return $response; } - public function query_pay($dealId,$orderId=NULL) + public function query_pay($dealId=NULL,$orderId=NULL) { + if ($dealId === NULL) { + $dealId = $this->input->get_post('dealid'); + $dealId = trim($dealId); + } $this->AlipayTradeQueryContentBuilder->setTradeNo($dealId); if ($orderId) { $this->AlipayTradeQueryContentBuilder->setOutTradeNo($orderId); } $response = $this->Query($this->AlipayTradeQueryContentBuilder); - if ( strcmp(trim($response->code), "10000")) { - log_message('error',"Alipay query failed! error code:".$response->code."; result Msg: ".$response->msg.'; orderId:'.$response->out_trade_no.'; dealId:'.$response->trade_no."; "); - } - $html = ''; - foreach ($response as $key => $value) { - $html .= ""; - } - $html .= '
$key$value
'; - echo $html; - return; + return $response; } /*! @@ -624,6 +619,30 @@ var_dump($response->$responseNode); empty($data['date']) ? $data['date'] = date('Y-m-d') : false; if (!empty($data['keywords'])) { $data['notelist'] = $this->Alipay_note_model->search_key($data['keywords']); + /** 手动查询通过收钱码的收款, 必须输入交易号 */ + if (empty($data['notelist'])) { + $query_pay = $this->query_pay($data["keywords"]); + if ( ! empty($query_pay) && strval($query_pay->code)==="10000" && strval($query_pay->trade_status)==="TRADE_SUCCESS") { + $pay_type = $query_pay->total_amount>0 ? "pay" : "refund"; + $new_record = $this->Alipay_note_model->save_alipay( + strval($query_pay->trade_no) + ,strval($query_pay->out_trade_no) + ,"CNY" + ,strval($query_pay->total_amount) + ,NULL + ,NULL + ,strval($query_pay->send_pay_date) + ,strval($query_pay->send_pay_date) + ,json_encode($query_pay) + ,$pay_type + ,NULL + ,strval($query_pay->trade_status) + ,NULL + ,strval($query_pay->buyer_logon_id) + ); + $data['notelist'][] = $new_record; + } + } } else { $data['notelist'] = $this->Alipay_note_model->search_date($data['date']); } @@ -743,6 +762,7 @@ var_dump($response->$responseNode); return array( "WAIT_BUYER_PAY" => "Pending", "TRADE_SUCCESS" => "Payment success", + "TRADE_CLOSED" => "Payment closed", "TRADE_FINISHED" => "Payment success" ); } diff --git a/webht/third_party/pay/models/Alipay_note_model.php b/webht/third_party/pay/models/Alipay_note_model.php index 15294ba7..cafe422b 100644 --- a/webht/third_party/pay/models/Alipay_note_model.php +++ b/webht/third_party/pay/models/Alipay_note_model.php @@ -118,7 +118,8 @@ class Alipay_note_model extends CI_Model { ,$ALI_payerEmail )); $insertid = $this->INFO->last_id('AlipayLog'); - return $query; + $ret = "SELECT TOP 1 * FROM AlipayLog WHERE ALI_dealId='$ALI_dealId' ORDER BY ALI_sn DESC "; + return $this->INFO->query($ret)->row(); } public function get_list() { diff --git a/webht/third_party/pay/views/alipay_list.php b/webht/third_party/pay/views/alipay_list.php index d3a9c1ad..afe0d5c2 100644 --- a/webht/third_party/pay/views/alipay_list.php +++ b/webht/third_party/pay/views/alipay_list.php @@ -66,6 +66,7 @@ /*.input-group{border: 1px solid #ccc;}*/ .input-group-btn{border: 1px solid #ccc;padding: 5px;} .search-btn{cursor: pointer; background: url(//data.chinahighlights.com/css/images/global/site-search-button.png) no-repeat center center;} + .center-block{display: block;margin: 0 auto;} @@ -75,6 +76,7 @@

Alipay Notes

+