更新
This commit is contained in:
parent
ae94b1368c
commit
505371444d
@ -2,12 +2,16 @@
|
|||||||
|
|
||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\common\enum\PayEnum;
|
||||||
use app\common\enum\user\UserTerminalEnum;
|
use app\common\enum\user\UserTerminalEnum;
|
||||||
|
use app\common\logic\PayNotifyLogic;
|
||||||
|
use app\common\model\retail\Cashierclass;
|
||||||
use app\common\service\pay\WeChatPayService;
|
use app\common\service\pay\WeChatPayService;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use Error;
|
use Error;
|
||||||
use support\Log;
|
use support\Log;
|
||||||
|
use Webman\Config;
|
||||||
|
use Yansongda\Pay\Pay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付
|
* 支付
|
||||||
@ -31,10 +35,24 @@ class PayController extends BaseApiController
|
|||||||
*/
|
*/
|
||||||
public function notifyMnp()
|
public function notifyMnp()
|
||||||
{
|
{
|
||||||
return (new WeChatPayService(UserTerminalEnum::WECHAT_MMP))->notify();
|
$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;
|
||||||
|
}
|
||||||
|
return Pay::wechat()->success();
|
||||||
|
}
|
||||||
|
// return (new WeChatPayService(UserTerminalEnum::WECHAT_MMP))->notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,7 @@
|
|||||||
"next/var-dumper": "^0.1.0",
|
"next/var-dumper": "^0.1.0",
|
||||||
"w7corp/easywechat": "^6.8",
|
"w7corp/easywechat": "^6.8",
|
||||||
"hyperf/pimple": "~2.2.0",
|
"hyperf/pimple": "~2.2.0",
|
||||||
"yansongda/pay": "^3.6",
|
"yansongda/pay": "^3.6"
|
||||||
"guzzlehttp/guzzle": "^7.8"
|
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-event": "For better performance. "
|
"ext-event": "For better performance. "
|
||||||
|
12
composer.lock
generated
12
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": "aec3bdabbcd3d781fd7d055878ca0a66",
|
"content-hash": "10536b047d5ed5c08b1aa7a603970cb7",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aliyuncs/oss-sdk-php",
|
"name": "aliyuncs/oss-sdk-php",
|
||||||
@ -6996,16 +6996,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "workerman/webman-framework",
|
"name": "workerman/webman-framework",
|
||||||
"version": "v1.5.5",
|
"version": "v1.5.16",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/walkor/webman-framework.git",
|
"url": "https://github.com/walkor/webman-framework.git",
|
||||||
"reference": "7c2a987e43077ce85b2ee242f64cae791fd7976f"
|
"reference": "84335520a340ee60adf7cf17aeb0edb9536c24e8"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/walkor/webman-framework/zipball/7c2a987e43077ce85b2ee242f64cae791fd7976f",
|
"url": "https://api.github.com/repos/walkor/webman-framework/zipball/84335520a340ee60adf7cf17aeb0edb9536c24e8",
|
||||||
"reference": "7c2a987e43077ce85b2ee242f64cae791fd7976f",
|
"reference": "84335520a340ee60adf7cf17aeb0edb9536c24e8",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -7060,7 +7060,7 @@
|
|||||||
"source": "https://github.com/walkor/webman-framework",
|
"source": "https://github.com/walkor/webman-framework",
|
||||||
"wiki": "https://doc.workerman.net/"
|
"wiki": "https://doc.workerman.net/"
|
||||||
},
|
},
|
||||||
"time": "2023-04-04T02:11:22+00:00"
|
"time": "2024-01-15T12:11:49+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "workerman/workerman",
|
"name": "workerman/workerman",
|
||||||
|
@ -36,11 +36,11 @@ if ($worker) {
|
|||||||
}, time());
|
}, time());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (class_exists('Dotenv\Dotenv') && file_exists(base_path() . '/.env')) {
|
if (class_exists('Dotenv\Dotenv') && file_exists(base_path(false) . '/.env')) {
|
||||||
if (method_exists('Dotenv\Dotenv', 'createUnsafeMutable')) {
|
if (method_exists('Dotenv\Dotenv', 'createUnsafeMutable')) {
|
||||||
Dotenv::createUnsafeMutable(base_path())->load();
|
Dotenv::createUnsafeMutable(base_path(false))->load();
|
||||||
} else {
|
} else {
|
||||||
Dotenv::createMutable(base_path())->load();
|
Dotenv::createMutable(base_path(false))->load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ use Twig\Error\SyntaxError;
|
|||||||
use Webman\App;
|
use Webman\App;
|
||||||
use Webman\Config;
|
use Webman\Config;
|
||||||
use Webman\Route;
|
use Webman\Route;
|
||||||
|
use Workerman\Protocols\Http\Session;
|
||||||
use Workerman\Worker;
|
use Workerman\Worker;
|
||||||
|
|
||||||
// Project base path
|
// Project base path
|
||||||
@ -300,7 +301,7 @@ function route(string $name, ...$parameters): string
|
|||||||
* Session
|
* Session
|
||||||
* @param mixed $key
|
* @param mixed $key
|
||||||
* @param mixed $default
|
* @param mixed $default
|
||||||
* @return mixed
|
* @return mixed|bool|Session
|
||||||
*/
|
*/
|
||||||
function session($key = null, $default = null)
|
function session($key = null, $default = null)
|
||||||
{
|
{
|
||||||
@ -379,7 +380,7 @@ function copy_dir(string $source, string $dest, bool $overwrite = false)
|
|||||||
$files = scandir($source);
|
$files = scandir($source);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if ($file !== "." && $file !== "..") {
|
if ($file !== "." && $file !== "..") {
|
||||||
copy_dir("$source/$file", "$dest/$file");
|
copy_dir("$source/$file", "$dest/$file", $overwrite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (file_exists($source) && ($overwrite || !file_exists($dest))) {
|
} else if (file_exists($source) && ($overwrite || !file_exists($dest))) {
|
||||||
@ -514,3 +515,14 @@ function cpu_count(): int
|
|||||||
}
|
}
|
||||||
return $count > 0 ? $count : 4;
|
return $count > 0 ? $count : 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get request parameters, if no parameter name is passed, an array of all values is returned, default values is supported
|
||||||
|
* @param string|null $param param's name
|
||||||
|
* @param mixed|null $default default value
|
||||||
|
* @return mixed|null
|
||||||
|
*/
|
||||||
|
function input(string $param = null, $default = null)
|
||||||
|
{
|
||||||
|
return is_null($param) ? request()->all() : request()->input($param, $default);
|
||||||
|
}
|
||||||
|
@ -61,6 +61,7 @@ function write_process_file($runtimeProcessPath, $processName, $firm): string
|
|||||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||||
|
|
||||||
use Workerman\Worker;
|
use Workerman\Worker;
|
||||||
|
use Workerman\Connection\TcpConnection;
|
||||||
use Webman\Config;
|
use Webman\Config;
|
||||||
use support\App;
|
use support\App;
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ worker_start('$processParam', $configParam);
|
|||||||
|
|
||||||
if (DIRECTORY_SEPARATOR != "/") {
|
if (DIRECTORY_SEPARATOR != "/") {
|
||||||
Worker::\$logFile = config('server')['log_file'] ?? Worker::\$logFile;
|
Worker::\$logFile = config('server')['log_file'] ?? Worker::\$logFile;
|
||||||
|
TcpConnection::\$defaultMaxPackageSize = config('server')['max_package_size'] ?? 10*1024*1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
Worker::runAll();
|
Worker::runAll();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user