This commit is contained in:
luofei 2024-06-06 15:47:20 +08:00
commit cf79b9e139
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']??''); Cache::set('logE1'.time(),$result['event_type']??'');
if ($result && $result->event_type == 'TRANSACTION.SUCCESS') { if ($result && $result->event_type == 'TRANSACTION.SUCCESS') {
$ciphertext = $result->resource['ciphertext']; $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') { if ($ciphertext['trade_state'] === 'SUCCESS') {
$attach = $ciphertext['attach']; $attach = $ciphertext['attach'];
switch ($attach) { switch ($attach) {
case 'wechat_common':
PayNotifyLogic::handle('wechat_common', $ciphertext['out_trade_no'], $ciphertext);
$app->wechat->success();
break;
case 'recharge': case 'recharge':
PayNotifyLogic::handle('recharge', $ciphertext['out_trade_no'], $ciphertext); PayNotifyLogic::handle('recharge', $ciphertext['out_trade_no'], $ciphertext);
$app->wechat->success(); $app->wechat->success();
break; 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); 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()) { if (PaymentLogic::hasError()) {
return $this->fail(PaymentLogic::getError()); return $this->fail(PaymentLogic::getError());
} }