更新
This commit is contained in:
parent
505371444d
commit
49a3a88069
@ -37,22 +37,26 @@ class PayController extends BaseApiController
|
||||
{
|
||||
$config = Config::get('payment');
|
||||
Pay::config($config);
|
||||
$message = Pay::wechat()->callback();
|
||||
if ($message['trade_state'] === 'SUCCESS') {
|
||||
$extra['transaction_id'] = $message['transaction_id'];
|
||||
$attach = $message['attach'];
|
||||
$message['out_trade_no'] = mb_substr($message['out_trade_no'], 0, 18);
|
||||
switch ($attach) {
|
||||
case 'cashierclass':
|
||||
$order = Cashierclass::where(['number' => $message['out_trade_no']])->findOrEmpty();
|
||||
if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) {
|
||||
return true;
|
||||
}
|
||||
PayNotifyLogic::handle('cashierclass', $message['out_trade_no'], $extra);
|
||||
break;
|
||||
$result = Pay::wechat()->callback(Request()->post());
|
||||
if($result && $result->event_type=='TRANSACTION.SUCCESS'){
|
||||
$ciphertext=$result->resource->ciphertext;
|
||||
if ($ciphertext['trade_state'] === 'SUCCESS') {
|
||||
$extra['transaction_id'] = $ciphertext['transaction_id'];
|
||||
$attach = $ciphertext['attach'];
|
||||
$message['out_trade_no'] = mb_substr($ciphertext['out_trade_no'], 0, 18);
|
||||
switch ($attach) {
|
||||
case 'cashierclass':
|
||||
$order = Cashierclass::where(['number' => $message['out_trade_no']])->findOrEmpty();
|
||||
if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) {
|
||||
return true;
|
||||
}
|
||||
PayNotifyLogic::handle('cashierclass', $message['out_trade_no'], $ciphertext);
|
||||
break;
|
||||
}
|
||||
return Pay::wechat()->success();
|
||||
}
|
||||
return Pay::wechat()->success();
|
||||
}
|
||||
|
||||
// return (new WeChatPayService(UserTerminalEnum::WECHAT_MMP))->notify();
|
||||
}
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ class PayNotifyLogic extends BaseLogic
|
||||
|
||||
// 更新充值订单状态
|
||||
// $order->transaction_id = $extra['transaction_id'];
|
||||
$order->paid = PayEnum::ISPAID;
|
||||
$order->save();
|
||||
// $order->paid = PayEnum::ISPAID;
|
||||
// $order->save();
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,9 +25,9 @@
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"workerman/webman-framework": "^1.4.7",
|
||||
"monolog/monolog": "^2.0",
|
||||
"webman/think-orm": "^1.0",
|
||||
"workerman/webman-framework": "v1.5.16",
|
||||
"monolog/monolog": "^2.2",
|
||||
"webman/think-orm": "v1.1.1",
|
||||
"vlucas/phpdotenv": "^5.4",
|
||||
"psr/container": "^1.1.1",
|
||||
"ext-json": "*",
|
||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "10536b047d5ed5c08b1aa7a603970cb7",
|
||||
"content-hash": "738295d764b0a7e25449d6502fca73ac",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aliyuncs/oss-sdk-php",
|
||||
|
Loading…
x
Reference in New Issue
Block a user