diff --git a/src/applet/app/controllers/AliCallBackController.php b/src/applet/app/controllers/AliCallBackController.php new file mode 100644 index 0000000..139c512 --- /dev/null +++ b/src/applet/app/controllers/AliCallBackController.php @@ -0,0 +1,117 @@ +request->get(); + $this->logger($params, 'aliEcoCommonCallBack', true); + + //获取支付宝行业云公钥 + $alipayrsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuWFuSpwY/2llLhy5Hxkqcc0qQFQOvemkYOI4S43L4qArX4x+DQN1RFuvfGuwOLScBKaoDYHsu9PSoTtcIj4obhhexbWHfelcsouV7Pj4YChrOkOLHAMLDQhGRXaZyXQAJdk2DoBkJ0vBDD/b1gZT8QznPopvuT4Y0rx/a2vK+5B/XV0wUuP2PnpWoPxNSwr7neFWvUdkC7yJJg4zJ1INLYy9TgHH3LKYrsEDbQzPJyMPFhD0zDb36b62q3tQYc1w8JknS6XeXMkX1Tu4zZbAxyIiv3J1FK8y7dtoRi9gLgo0uLsXWDn5AwAlzqfOERgLMWD2r6FE8tOXVbMha6IImQIDAQAB'; + //支付宝提供的密钥 + $secretKey = "HOrPS0V4BthAPfgSdbHWwy0TwPnC8TQAQZIOjc8vOzI="; + //配置应用公私钥 中生成的私钥 + $privateKey = 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINMZLo5eDHCvBTU4AW7sItw1Q7MQ8l3wBl7hW62gQKBgQDZT1SEaeBtOJxt3vrK7o/kCWNh/4h9oENFhDIuTvLQk9tirKw0BSiZedjbEHqnqM+bgeuvxazCp9uqoYXgC/dtIooy1P8aso+ZrroC/0vZV7TQBGBjbSSkKPn7ShZM2hfYQFpmLznwpel7KJbP6AJ8atv99wjB6uvqNf6fMU7IbQKBgQCsG3mj0amsYbS5ZQZpl2v65QnlkAxv0dxcstx15kW0hXRugLOu7EGcJNZMhO4gbn8dzMOaJANZPG1VLcFpe/QyP/AW7vDt9vTWdeQkQCD5xcXEDihLLCq0pFaSkmuOHWCI+aepSHUILlJ1P/K/5biD7MTdPg6tyLqyM+rjUd/38QKBgQCNu2fsVQHDOsEMB/qakK3YlSb0q61iAjzeAjKYcXV9BHJ6ERTfeN3Z+9asSjs1TqzZSAtoQQ1EiCaFS4P9dNCTpYttS+52gy+VlJhNjCT0RHfxlGkpb+4OA4vHkbKpvTUAHjjXnMW1ZwC5CugSAchdTXTeV1im4Yms4DqJqacwoQKBgQCocPd7An8qTDIBZMOC4oT29+TYvUO+yMkAHLmx1h4QkLCkWegB4g5QkKkAGPWp3hshAj/KA0cXthFXVUG/SGZ2K6eB+nbon1N+9cDETdM4QXzN5gE/mUlupIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W'; + $publicKey = "xxxxxxx"; + + $iv = ""; + // 1、验签、请求报文 + //判断请求数据数组是否为空 + if (empty($params)) { + $response = [ + "code" => '40000', + "sub_code" => 'ISV-VERIFICATION-FAILED', + "sub_msg" => "入参数据错误", + ]; + } else { + + if (array_key_exists('biz_content', $params)) { + $biz_content = $params['biz_content']; + } else { + $biz_content = ''; + } + + + $response = [ + "code" => "10000", + "msg" => "Success", + "face_group_key" => "K12_2088323332233424", + ]; + + } + // 3、业务处理结果加签,业务返回结果需要进行排序 + + ksort($response);//数组排序 + + $contentToSign = json_encode($response);//数组转json + + $responseSecretText = $this->encrypt($contentToSign, $secretKey, $iv);//加密方法,只有当前调用的业务接口需要加解密时才需要 + + + //用 接入准备 > 3.配置应用公私钥 中生成的私钥,对第4步的加密字符串进行加签,放到 sign 参数里。 + + $sign1 = $this->RSA2($responseSecretText, $privateKey);//加签 + + $result = [ + "sign" => $sign1, + "response" => $responseSecretText + ]; + + exit(json_encode( + $result + )); + } + +} \ No newline at end of file diff --git a/src/applet/app/controllers/CallBackCashBookController.php b/src/applet/app/controllers/CallBackCashBookController.php deleted file mode 100644 index ef7e090..0000000 --- a/src/applet/app/controllers/CallBackCashBookController.php +++ /dev/null @@ -1,572 +0,0 @@ -request->get(); - } - - /** - * Todo::支付宝 - 授权回调 - */ - public function alipayAuthorizeCallBackAction() - { - $args = $this->request->get(); - $this->logger($args, 'alipay_authorize_callBack_action', true); - if (empty($args['app_id']) || empty($args['app_auth_code']) || empty($args["state"])) { - dd(['msg' => '缺少参数', 'success' => -1]); - } - $result = (new AlipayService())->alipayOpenAuthTokenAppRequest($args['app_auth_code']); - if ($result["status"] != true) { - dd((['msg' => '授权失败', 'success' => -2, "result" => $result])); - } - $app_id = explode("=", base64_decode($args["state"]))[1]; - $merchant_sn = explode("=", base64_decode($args["state"]))[0]; - $uid = explode("_", $merchant_sn)[0]; - $model = MerchantAlipayAuthorize::findFirst("uid = '{$uid}' AND app_id = '{$app_id}' AND merchant_sn = '{$merchant_sn}'"); - $model = empty($model) ? new MerchantAlipayAuthorize() : $model; - $model->uid = $uid; - $model->app_id = $app_id; - $model->merchant_sn = $merchant_sn; - $model->app_auth_token = $result["data"]["tokens"][0]["app_auth_token"]; - $model->app_refresh_token = $result["data"]["tokens"][0]["app_refresh_token"]; - $model->ali_app_id = $args['app_id']; - $model->ali_auth_app_id = $result['data']["tokens"][0]["auth_app_id"]; - $model->ali_user_id = $result["data"]["tokens"][0]["user_id"]; - $model->created_at = date("Y-m-d H:i:s"); - $model->updated_at = date("Y-m-d H:i:s"); - $model->state = ICommon::MERCHANT_STATE_USE; - $model->save(); - dd((['msg' => '授权成功!', 'success' => 0])); - } - - /** - * 本系统自身支付回调 - 同步 - */ - public function alipayOwnSyncReturnAction() - { - dump($_GET); - $args = $this->request->get(); - logger(json_encode([ - "msg" => "同步回调", - "data" => $args, - ], 320), 'alipay_sync_return', true); - dd($args); - } - - /** - * 本系统自身支付回调 - 异步 - */ - public function alipayOwnSyncNotifyAction() - { - if ($this->request->isPost()) { - try { - $verify_result = (new EasyAlipayService())->verifyNotify($_POST); - logger(json_encode([ - "msg" => "异步回调", - "data" => $_POST, - "res" => $verify_result - ], 320), 'alipay_sync_notify', true); - if ($verify_result) {//验证成功 - $out_trade_no = $_POST['out_trade_no']; - //支付宝交易号 - $trade_no = $_POST['trade_no']; - //交易状态 - $trade_status = $_POST['trade_status']; - - //判断该笔订单是否在 - $model = OwnOrder::findFirst("out_trade_no = '{$out_trade_no}'"); - if (!$model) { - //未查到訂單 - logger(json_encode([ - "msg" => "异步回调失败-訂單未查到", - "data" => $_POST, - ], 320), 'alipay_sync_notify_not_find', true); - //验证失败 - echo "fail"; - die(); - } - $model->return_data = json_encode($_POST); - $model->trade_no = $trade_no; - $model->updated_at = date("Y-m-d H:i:s"); - - if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') { - //商户网站中已经做过处理 - if ($model->status == IPay::PAY_STATE_FOR_ALREADY) { - logger(json_encode([ - "msg" => "异步回调成功", - "data" => $_POST, - ], 320), 'alipay_sync_notify_already', true); - echo "success"; - die(); - } - $model->status = IPay::PAY_STATE_FOR_ALREADY; - if ($model->save() == false) { - logger(json_encode([ - "msg" => "异步回调-支付成功-更新訂單失敗", - "data" => $_POST, - ], 320), 'alipay_sync_notify_success_update_fail', true); - echo "fail"; - die(); - } - logger(json_encode([ - "msg" => "异步回调支付成功", - "data" => $_POST, - ], 320), 'alipay_sync_notify_success', true); - } else { - $model->status = IPay::PAY_STATE_FOR_FAIL; - if ($model->save() == false) { - logger(json_encode([ - "msg" => "异步回调-支付失敗-更新訂單失敗", - "data" => $_POST, - ], 320), 'alipay_sync_notify_fail_update_fail', true); - echo "fail"; - die(); - } - logger(json_encode([ - "msg" => "异步回调支付失敗", - "data" => $_POST, - ], 320), 'alipay_sync_notify_fail', true); - } - echo "success"; - die(); - } else { - logger(json_encode([ - "msg" => "异步回调驗證失败", - "data" => $_POST, - ], 320), 'alipay_sync_notify_verify_fail', true); - //验证失败 - echo "fail"; - die(); - } - } catch (\Exception $e) { - logger(json_encode([ - "msg" => "异步回调處理异常", - "data" => $params ?? [], - "exception" => $e->getMessage() - ], 320), 'alipay_sync_notify_exception', true); - //回調異常 - echo "fail"; - die(); - } - } - } - - /** - * 支付宝 - 公共网关回调 - */ - public function alipayCommonCallBackAction() - { -// if ($this->request->isPost()) { -// try { -// $verify_result = (new EasyAlipayService())->verifyNotify($_POST); -// logger(json_encode([ -// "msg" => "异步回调", -// "data" => $_POST, -// "res" => $verify_result -// ], 320), 'common_alipay_sync_notify', true); -// if ($verify_result) {//验证成功 -// $self_order_sn = $_POST['out_trade_no']; -// //支付宝交易号 -// $trade_no = $_POST['trade_no']; -// //交易状态 -// $trade_status = $_POST['trade_status']; -// //判断该笔订单是否在 -// $model = UserMerchantOrder::findFirst("self_trade_no = '{$self_order_sn}'"); -// if (!$model) { -// //未查到訂單 -// logger(json_encode([ -// "msg" => "异步回调失败-訂單未查到", -// "data" => $_POST, -// ], 320), 'common_alipay_sync_notify_not_find', true); -// //验证失败 -// echo "fail"; -// die(); -// } -// $model->return_data = json_encode($_POST); -// $model->trade_no = $trade_no; -// $model->updated_at = date("Y-m-d H:i:s"); -// -// #TODO::回調第三方平台的 notify_url -// $passback_params = json_decode(urldecode($_POST["passback_params"]), true); -// $notify_url = $passback_params["notify_url"]; -// $out_trade_no = $passback_params["out_trade_no"]; -// $ext_info = $passback_params["ext_info"] ?? []; -// $isOk = (new GetPlatformCertificateService())->commonCurlNotifyUrl($notify_url, ["out_trade_no" => $out_trade_no, -// "trade_no" => $trade_no, -// "pay_trade_no" => $self_order_sn, -// "trade_status" => $trade_status, -// "ext_info" => $ext_info -// ]); -// if ($isOk) { -// if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') { -// //商户网站中已经做过处理 -// if ($model->status == IPay::PAY_STATE_FOR_ALREADY) { -// logger(json_encode([ -// "msg" => "异步回调成功", -// "data" => $_POST, -// ], 320), 'alipay_sync_notify_already', true); -// echo "success"; -// die(); -// } -// $model->status = IPay::PAY_STATE_FOR_ALREADY; -// if ($model->save() == false) { -// logger(json_encode([ -// "msg" => "异步回调-支付成功-更新訂單失敗", -// "data" => $_POST, -// ], 320), 'alipay_sync_notify_success_update_fail', true); -// echo "fail"; -// die(); -// } -// logger(json_encode([ -// "msg" => "异步回调支付成功", -// "data" => $_POST, -// ], 320), 'alipay_sync_notify_success', true); -// } else { -// $model->status = IPay::PAY_STATE_FOR_FAIL; -// if ($model->save() == false) { -// logger(json_encode([ -// "msg" => "异步回调-支付失敗-更新訂單失敗", -// "data" => $_POST, -// ], 320), 'alipay_sync_notify_fail_update_fail', true); -// echo "fail"; -// die(); -// } -// logger(json_encode([ -// "msg" => "异步回调支付失敗", -// "data" => $_POST, -// ], 320), 'alipay_sync_notify_fail', true); -// } -// echo "success"; -// die(); -// } else { -// logger(json_encode([ -// "msg" => "异步回调 - 回調第三方平台失敗", -// "data" => $_POST, -// "isOk" => false -// ], 320), 'alipay_sync_notify_fail', true); -// echo "fail"; -// die(); -// } -// } else { -// logger(json_encode([ -// "msg" => "异步回调驗證失败", -// "data" => $_POST, -// ], 320), 'alipay_sync_notify_verify_fail', true); -// //验证失败 -// echo "fail"; -// die(); -// } -// } catch (\Exception $e) { -// logger(json_encode([ -// "msg" => "异步回调處理异常", -// "data" => $params ?? [], -// "exception" => $e->getMessage() -// ], 320), 'alipay_sync_notify_exception', true); -// //回調異常 -// echo "fail"; -// die(); -// } -// } - } - - /** - * 支付宝 - 公共异步回调 - */ - public function alipayAsyncNotifyCallBackAction() - { - if ($this->request->isPost()) { - try { - $verify_result = (new EasyAlipayService())->verifyNotify($_POST); - logger(json_encode([ - "msg" => "异步回调", - "data" => $_POST, - "res" => $verify_result - ], 320), 'common_alipay_sync_notify', true); - if ($verify_result) {//验证成功 - $self_order_sn = $_POST['out_trade_no']; - //支付宝交易号 - $trade_no = $_POST['trade_no']; - //交易状态 - $trade_status = $_POST['trade_status']; - //判断该笔订单是否在 - $model = UserMerchantOrder::findFirst("self_trade_no = '{$self_order_sn}'"); - if (!$model) { - //未查到訂單 - logger(json_encode([ - "msg" => "异步回调失败-訂單未查到", - "data" => $_POST, - ], 320), 'common_alipay_sync_notify_not_find', true); - //验证失败 - echo "fail"; - die(); - } - //商户网站中已经做过处理 - if ($model->status != IPay::PAY_STATE_FOR_WAIT) { - logger(json_encode([ - "msg" => "异步回调已处理", - "data" => $_POST, - ], 320), 'alipay_sync_notify_already', true); - echo "success"; - die(); - } - - $model->return_data = json_encode($_POST); - $model->trade_no = $trade_no; - $model->updated_at = date("Y-m-d H:i:s"); - - #TODO::回調第三方平台的 notify_url - $passback_params = json_decode(urldecode($_POST["passback_params"]), true); - $notify_url = $passback_params["notify_url"]; - $out_trade_no = $passback_params["out_trade_no"]; - $ext_info = $passback_params["ext_info"] ?? []; - $isOk = (new PayService())->commonCurlNotifyUrl($notify_url, ["out_trade_no" => $out_trade_no, - "trade_no" => $trade_no, - "pay_trade_no" => $self_order_sn, - "trade_status" => $trade_status, - "ext_info" => $ext_info - ]); - if ($isOk) { - if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') { - $model->status = IPay::PAY_STATE_FOR_ALREADY; - if ($model->save() == false) { - logger(json_encode([ - "msg" => "异步回调-支付成功-更新訂單失敗", - "data" => $_POST, - ], 320), 'alipay_sync_notify_success_update_fail', true); - echo "fail"; - die(); - } - logger(json_encode([ - "msg" => "异步回调支付成功", - "data" => $_POST, - ], 320), 'alipay_sync_notify_success', true); - } else { - $model->status = IPay::PAY_STATE_FOR_FAIL; - if ($model->save() == false) { - logger(json_encode([ - "msg" => "异步回调-支付失敗-更新訂單失敗", - "data" => $_POST, - ], 320), 'alipay_sync_notify_fail_update_fail', true); - echo "fail"; - die(); - } - logger(json_encode([ - "msg" => "异步回调支付失敗", - "data" => $_POST, - ], 320), 'alipay_sync_notify_fail', true); - } - echo "success"; - die(); - } else { - logger(json_encode([ - "msg" => "异步回调 - 回調第三方平台失敗", - "data" => $_POST, - "isOk" => false - ], 320), 'alipay_sync_notify_fail', true); - echo "fail"; - die(); - } - } else { - logger(json_encode([ - "msg" => "异步回调驗證失败", - "data" => $_POST, - ], 320), 'alipay_sync_notify_verify_fail', true); - //验证失败 - echo "fail"; - die(); - } - } catch (\Exception $e) { - logger(json_encode([ - "msg" => "异步回调處理异常", - "data" => $params ?? [], - "exception" => $e->getMessage() - ], 320), 'alipay_sync_notify_exception', true); - //回調異常 - echo "fail"; - die(); - } - } - } - - /** - * 微信 - 公共异步回调 - */ - public function wxPayAsyncNotifyCallBackAction() - { - try { - //获取接口数据,若是$_REQUEST拿不到数据,则使用file_get_contents函数获取 - $post = file_get_contents("php://input"); - if ($post == null) { - $post = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : ''; - } - $inWechatpaySignature = $_SERVER["HTTP_WECHATPAY_SIGNATURE"] ?? ""; - $inWechatpayTimestamp = $_SERVER["HTTP_WECHATPAY_TIMESTAMP"] ?? ""; - $inWechatpaySerial = $_SERVER["HTTP_WECHATPAY_SERIAL"] ?? ""; //暫時未用到 - $inWechatpayNonce = $_SERVER["HTTP_WECHATPAY_NONCE"] ?? ""; - $this->logger([ - "inWechatpaySignature" => $inWechatpaySignature, - "inWechatpayTimestamp" => $inWechatpayTimestamp, - "inWechatpaySerial" => $inWechatpaySerial, - "inWechatpayNonce" => $inWechatpayNonce, - ], 'wx_pay_async_notify_call_back', true); - - if (empty($post) || $post == null || $post == '') { - $this->wxApi(Msg::WxErr); - } - - $this->logger($post, 'wx_pay_async_notify_call_back', true); - $data = (new EcommercePayService())->decryptToString($inWechatpayTimestamp, $inWechatpayNonce, $inWechatpaySignature, $post); - $this->logger($data, 'wx_pay_async_notify_call_back', true); - if (!empty($data)) { - #TODO::以下為驗簽成功邏輯處理 - /** 解析出来的数组 - *Array - * { - * "sp_mchid":"1611682472", - * "sub_mchid":"1618679040", - * "sp_appid":"wx02391df091871eb7", - * "sub_appid":"wx5ea1176d277eb1a9", - * "out_trade_no":"949112453c0ab718164148217297094", - * "transaction_id":"4200001369202201069176784818", - * "trade_type":"JSAPI", - * "trade_state":"SUCCESS", - * "trade_state_desc":"支付成功", - * "bank_type":"OTHERS", - * "attach":"api.zhiyingos.com/api/v1/o2oc/customer/pay/callback", - * "success_time":"2022-01-06T23:16:17+08:00", - * "payer":{ - * "sp_openid":"ocGgU6FplTZ87emz-JH2prRo6d7M", - * "sub_openid":"oy8kY5fNACAivrxQbij4g1z6vQGQ" - * }, - * "amount":{ - * "total":100, - * "payer_total":100, - * "currency":"CNY", - * "payer_currency":"CNY" - * } - * } - **/ - //支付聯盟订单号 - $self_order_sn = isset($data['out_trade_no']) && !empty($data['out_trade_no']) ? $data['out_trade_no'] : 0; - //微信支付交易號 - $trade_no = $data["transaction_id"]; - //交易狀態 - $trade_status = $data['trade_state'] == "SUCCESS" || $data['trade_state'] == "FINISHED" ? "TRADE_SUCCESS" : "TRADE_FAIL"; - - //判断该笔订单是否在 - $model = UserMerchantOrder::findFirst("self_trade_no = '{$self_order_sn}'"); - if (!$model) { - //未查到訂單 - logger(json_encode([ - "msg" => "异步回调失败-訂單未查到", - "data" => $_POST, - ], 320), 'common_wx_sync_notify_not_find', true); - //验证失败 - $this->wxApi(Msg::WxErr); - } - //商户网站中已经做过处理 - if ($model->status != IPay::PAY_STATE_FOR_WAIT) { - logger(json_encode([ - "msg" => "异步回调已处理", - "data" => $_POST, - ], 320), 'wxpay_sync_notify_already', true); - $this->wxApi(Msg::WxSuc); - } - - $model->return_data = json_encode($data); - $model->trade_no = $trade_no; - $model->updated_at = date("Y-m-d H:i:s"); - - #TODO::回調第三方平台的 notify_url - $notify_url = $data["attach"]; - $out_trade_no = $model->out_trade_no; - $ext_info = json_decode($model->ext, true) ?? []; - $isOk = (new PayService())->commonCurlNotifyUrl($notify_url, ["out_trade_no" => $out_trade_no, - "trade_no" => $trade_no, - "pay_trade_no" => $self_order_sn, - "trade_status" => $trade_status, - "ext_info" => $ext_info - ]); - if ($isOk) { - if ($trade_status == 'FINISHED' || $trade_status == 'TRADE_SUCCESS') { - $model->status = IPay::PAY_STATE_FOR_ALREADY; - if ($model->save() == false) { - logger(json_encode([ - "msg" => "异步回调-支付成功-更新訂單失敗", - "data" => $_POST, - ], 320), 'wxpay_sync_notify_success_update_fail', true); - $this->wxApi(Msg::WxErr); - } - logger(json_encode([ - "msg" => "异步回调支付成功", - "data" => $_POST, - ], 320), 'wxpay_sync_notify_success', true); - } else { - $model->status = IPay::PAY_STATE_FOR_FAIL; - if ($model->save() == false) { - logger(json_encode([ - "msg" => "异步回调-支付失敗-更新訂單失敗", - "data" => $_POST, - ], 320), 'wxpay_sync_notify_fail_update_fail', true); - $this->wxApi(Msg::WxErr); - } - logger(json_encode([ - "msg" => "异步回调支付失敗", - "data" => $_POST, - ], 320), 'wxpay_sync_notify_fail', true); - } - $this->wxApi(Msg::WxSuc); - } else { - logger(json_encode([ - "msg" => "异步回调 - 回調第三方平台失敗", - "url" => $notify_url, - "data" => ["out_trade_no" => $out_trade_no, - "trade_no" => $trade_no, - "pay_trade_no" => $self_order_sn, - "trade_status" => $trade_status, - "ext_info" => $ext_info - ], - "isOk" => false - ], 320), 'wxpay_sync_notify_fail', true); - $this->wxApi(Msg::WxErr); - } - } else { - logger(json_encode([ - "msg" => "异步回调驗證失败", - "data" => $_POST, - ], 320), 'wxpay_sync_notify_verify_fail', true); - //验证失败 - $this->wxApi(Msg::WxErr); - } - } catch (\Exception $e) { - logger(json_encode([ - "msg" => "异步回调處理异常", - "data" => $params ?? [], - "exception" => $e->getMessage() - ], 320), 'wxpay_sync_notify_exception', true); - //回調異常 - echo "fail"; - die(); - } - } -} \ No newline at end of file