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 ); }