修改二次支付

This commit is contained in:
liu 2024-06-06 15:34:57 +08:00
parent 8515960d83
commit 7ce6403ce4
2 changed files with 7 additions and 6 deletions

View File

@ -33,18 +33,19 @@ class PayController extends BaseApiController
Cache::set('logE1'.time(),$result['event_type']??'');
if ($result && $result->event_type == 'TRANSACTION.SUCCESS') {
$ciphertext = $result->resource['ciphertext'];
Cache::set('logc'.time(),json_decode($result->resource['ciphertext'],true));
Cache::set('logc'.time(),json_encode($result->resource['ciphertext'],true));
if ($ciphertext['trade_state'] === 'SUCCESS') {
$attach = $ciphertext['attach'];
switch ($attach) {
case 'wechat_common':
PayNotifyLogic::handle('wechat_common', $ciphertext['out_trade_no'], $ciphertext);
$app->wechat->success();
break;
case 'recharge':
PayNotifyLogic::handle('recharge', $ciphertext['out_trade_no'], $ciphertext);
$app->wechat->success();
break;
case 'wechat_common':
default:
PayNotifyLogic::handle('wechat_common', $ciphertext['out_trade_no'], $ciphertext);
$app->wechat->success();
break;
}
}
}

View File

@ -304,7 +304,7 @@ class OrderController extends BaseApiController
StoreOrder::where(['id' => $order_id, 'uid' => Request()->userId])->update($_order);
}
}
$result = PaymentLogic::pay($pay_type, 'StoreOrder', $order, $this->userInfo['terminal'], $redirectUrl);
$result = PaymentLogic::pay($pay_type, 'wechat_common', $order, $this->userInfo['terminal'], $redirectUrl);
if (PaymentLogic::hasError()) {
return $this->fail(PaymentLogic::getError());
}