From def549e8ac0f79e4760961e71fb046b8ec16dd87 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 19 Sep 2025 11:36:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E4=BB=98=E5=AE=9D=E9=80=80?= =?UTF-8?q?=E6=AC=BE:=20=E7=8A=B6=E6=80=81=E5=80=BC=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E7=B3=BB=E7=BB=9F=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/AlipayTradeService.php | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index b84d9fba..672c2def 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -622,6 +622,10 @@ class AlipayTradeService extends CI_Controller if (empty($item->ALI_resultMsg)) { return; } + if (($item->ALI_resultMsg) === 'pending') { + // todo: 查询退款结果 + return; + } // raw $raw = json_decode($item->ALI_memo); $parent_order = $raw->out_trade_no; @@ -1462,11 +1466,11 @@ class AlipayTradeService extends CI_Controller // $ret_status_mapped = array( // "Y" => "1", // COMPLETED // "N" => "3", // FAILED - // // "PENDING" => "2", // todo: - // // "CANCELLED" => "-1", // todo: + // // "PENDING" => "4", // todo: + // // "CANCELLED" => "2", // todo: // ); // $refund_res->status = $response->code === '10000' ? '1' : '3'; - $refund_res->status = $response->code === '10000' && $response->fund_change === 'Y' ? '1' : $response->code === '10000' ? '2' : '3'; + $refund_res->status = $response->code === '10000' && $response->fund_change === 'Y' ? '1' : $response->code === '10000' ? '4' : '3'; $refund_res->refund_payload = $refund_payload; // log_message('error','test: ' . __METHOD__ . ': ' . __LINE__ . ' ' . PHP_EOL . var_export($response, 1)); // var_dump($response); @@ -1482,22 +1486,22 @@ class AlipayTradeService extends CI_Controller // if ($refund_res->status !== '3') { if ($refund_res->status2 === '1') { - // $ALI_dealId,$ALI_orderId,$ALI_currencyCode,$ALI_orderAmount,$ALI_payAmount,$ALI_stateCode,$ALI_acquiringTime,$ALI_completeTime,$ALI_memo,$ALI_payType,$ALI_resultCode=null,$ALI_resultMsg=null,$ALI_payerName=null,$ALI_payerEmail=NULL, $check_exists=false $this->Alipay_note_model->save_alipay( - strval($generateId) - ,strval($paymentOrder) - ,"CNY" - ,"-" . strval($query_res->refund_amount) - ,NULL - ,NULL - ,date('Y-m-d H:i:s') - ,date('Y-m-d H:i:s') - ,json_encode($query_res,JSON_UNESCAPED_UNICODE) - ,'refund' - ,NULL - ,$refund_res->status2 === '1' ? 'TRADE_SUCCESS' : '' - ,NULL - ,NULL + strval($generateId) // $ALI_dealId, + ,strval($paymentOrder) // $ALI_orderId, + ,"CNY" // $ALI_currencyCode, + ,"-" . strval($query_res->refund_amount) // $ALI_orderAmount, + ,NULL // $ALI_payAmount, + ,NULL // $ALI_stateCode, + ,date('Y-m-d H:i:s') // $ALI_acquiringTime, + ,date('Y-m-d H:i:s') // $ALI_completeTime, + ,json_encode($query_res,JSON_UNESCAPED_UNICODE) // $ALI_memo, + ,'refund' // $ALI_payType, + ,NULL // $ALI_resultCode=null, + ,$refund_res->status2 === '1' ? 'TRADE_SUCCESS' : 'pending' // $ALI_resultMsg=null, + ,NULL // $ALI_payerName=null, + ,NULL // $ALI_payerEmail=NULL, + // $check_exists=false ); }