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)
{
// if ($params["pay_type"] == "alipay") {
try {
$pay_model = new PayModel($params[ 'site_id' ]);
$result = $pay_model->close($params);
return $result;
} catch (\Exception $e) {
return error(-1, $e->getMessage());
} catch (\Throwable $e) {
return error(-1, $e->getMessage());
if ($params["pay_type"] == "alipay") {
try {
$pay_model = new PayModel($params[ 'site_id' ]);
$result = $pay_model->close($params);
return $result;
} catch (\Exception $e) {
return error(-1, $e->getMessage());
} catch (\Throwable $e) {
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' ])) {
$out_trade_no = $_POST[ 'out_trade_no' ];
$pay = new PayCommon();

View File

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