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