fix(addon): alipay 及 wechatpay 没有判断支付类型

This commit is contained in:
2025-12-04 11:19:14 +08:00
parent eef56291eb
commit 776f0ed029
3 changed files with 19 additions and 17 deletions

View File

@@ -16,16 +16,16 @@ class PayClose
*/ */
public function handle($params) public function handle($params)
{ {
// if ($params["pay_type"] == "alipay") { if ($params["pay_type"] == "alipay") {
try { try {
$pay_model = new PayModel($params[ 'site_id' ]); $pay_model = new PayModel($params[ 'site_id' ]);
$result = $pay_model->close($params); $result = $pay_model->close($params);
return $result; return $result;
} catch (\Exception $e) { } catch (\Exception $e) {
return error(-1, $e->getMessage()); return error(-1, $e->getMessage());
} catch (\Throwable $e) { } catch (\Throwable $e) {
return error(-1, $e->getMessage()); return error(-1, $e->getMessage());
}
} }
// }
} }
} }

View File

@@ -13,8 +13,10 @@ class PayNotify
/** /**
* 支付方式及配置 * 支付方式及配置
*/ */
public function handle() public function handle($param)
{ {
if ($param[ "pay_type" ] != "alipay") return false;
if (isset($_POST[ 'out_trade_no' ])) { if (isset($_POST[ 'out_trade_no' ])) {
$out_trade_no = $_POST[ 'out_trade_no' ]; $out_trade_no = $_POST[ 'out_trade_no' ];
$pay = new PayCommon(); $pay = new PayCommon();

View File

@@ -15,11 +15,11 @@ class PayNotify
*/ */
public function handle($param) public function handle($param)
{ {
if ($param[ "pay_type" ] == "wechatpay") { if ($param[ "pay_type" ] != "wechatpay") return false;
$reqData = empty($GLOBALS[ 'HTTP_RAW_POST_DATA' ]) ? file_get_contents('php://input') : $GLOBALS[ 'HTTP_RAW_POST_DATA' ];
Log::write('微信支付回调数据'); $reqData = empty($GLOBALS[ 'HTTP_RAW_POST_DATA' ]) ? file_get_contents('php://input') : $GLOBALS[ 'HTTP_RAW_POST_DATA' ];
Log::write($reqData); Log::write('微信支付回调数据');
return ( new PayModel() )->payNotify(); Log::write($reqData);
} return ( new PayModel() )->payNotify();
} }
} }