From 0cc4ef4451329aded2a6ff595cbd30be9fb622ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 13:27:13 +0800 Subject: [PATCH 01/33] =?UTF-8?q?feat:=20#20220808=20=E5=BF=AB=E5=9B=A2?= =?UTF-8?q?=E5=9B=A2=E6=9C=8D=E5=8A=A1=E5=95=86=E8=B4=A6=E5=8F=B7=E5=B8=AE?= =?UTF-8?q?=E5=BF=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index d75d708..8803dab 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -14,9 +14,9 @@ class KuaiTuanTuan extends BusinessClient // 如果请求的content-type是 application/x-www-form-urlencoded,所有参数值也做urlencode编码; // 如果是multipart/form-data格式,每个表单字段的参数值无需编码,但每个表单字段的charset需要指定为utf-8 // 如果指定接口返回数据格式为JSON,请指明header头content-type: application/json - protected $clientId = ''; + protected $clientId = '8d7ca13bc27247b6a04e08404b51dfd8'; - protected $clientSecret = ''; + protected $clientSecret = '4478bc82dc1e1f68fe06c9f2bc683f1dcb3e6d83'; protected $publicParams = [ 'type' => '', From 0e4fe053362a83f2788a0893dff5126fec5786cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 13:30:59 +0800 Subject: [PATCH 02/33] =?UTF-8?q?feat:=20#10000=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=BF=81=E7=A7=BB=E8=84=9A=E6=9C=AC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022_08_05_030834_create_business_goods_skus_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php b/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php index 8dce10b..18c9b5b 100644 --- a/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php +++ b/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateBusinessGoodsTable extends Migration +class CreateBusinessGoodsSkusTable extends Migration { /** * Run the migrations. From 92e9f33663e531ef91d3bcce4f1aa0314811209c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 13:32:42 +0800 Subject: [PATCH 03/33] =?UTF-8?q?feat:=20#10000=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=BF=81=E7=A7=BB=E8=84=9A=E6=9C=AC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022_08_05_093629_create_business_orders_table.php | 1 - 1 file changed, 1 deletion(-) diff --git a/database/migrations/2022_08_05_093629_create_business_orders_table.php b/database/migrations/2022_08_05_093629_create_business_orders_table.php index b5b0311..7561823 100644 --- a/database/migrations/2022_08_05_093629_create_business_orders_table.php +++ b/database/migrations/2022_08_05_093629_create_business_orders_table.php @@ -53,7 +53,6 @@ class CreateBusinessOrdersTable extends Migration $table->integer('supply_participate_no')->nullable(); $table->mediumInteger('theoretical_refund_amount')->nullable(); $table->string('transaction_id')->nullable(); - $table->mediumInteger('updated_at')->nullable(); $table->integer('verification_status')->nullable(); $table->timestamps(); }); From 6831dbb2e40f93e8380fb1d29ddf16ede8db4a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 13:45:54 +0800 Subject: [PATCH 04/33] feat: --- app/Http/Controllers/Shop/ShopsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index d32528c..37be306 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -60,7 +60,7 @@ class ShopsController extends Controller $platList = $shop->getPlatList(); $shop = $shop->find($shopId); if ($platList[$platId] === $shop->plat_id) { - BusinessFactory::init()->make($shop->plat_id)->authCallback($request->get('code'), $shop->id); + BusinessFactory::init()->make($shop->plat_id)->authCallback($request->get('code'), $shop); } else { $this->res = [ 'httpCode' => 403, From a1e93f54e4027d7a0a447842d3a214453f0553b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 13:59:44 +0800 Subject: [PATCH 05/33] =?UTF-8?q?feat:=20#10000=20=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Business/BusinessClient.php | 4 +- .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 2 +- composer.json | 1 + composer.lock | 1657 ++++++++++++++++- 4 files changed, 1607 insertions(+), 57 deletions(-) diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index cc36aeb..cbc6eac 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -3,7 +3,7 @@ namespace App\Services\Business; use App\Models\Log; use App\Models\Shop; -use Facade\FlareClient\Http\Client; +use GuzzleHttp\Client; abstract class BusinessClient { @@ -69,7 +69,7 @@ abstract class BusinessClient 'headers' => ['Content-type' => 'multipart/form-data;charset=UTF-8'], 'form_params' => $params ]; - $res = (new Client())->makeCurlRequest('POST', $url, $headers); + $res = (new Client())->request('POST', $url, $headers); $res = json_decode($res->getBody()->getContents(), true); if (isset($res['error_response'])) { $log = new Log(); diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 8803dab..27fd06d 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -99,7 +99,7 @@ class KuaiTuanTuan extends BusinessClient protected function getSign($params) { - $params = ksort($params); + ksort($params); $str = ''; foreach ($params as $key => $val) { $str .= $key . $val; diff --git a/composer.json b/composer.json index e442ecc..d12ec93 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "require": { "php": "^7.2.5|^8.0", "aliyuncs/oss-sdk-php": "^2.5", + "beyondcode/laravel-websockets": "^1.13", "fideloper/proxy": "^4.4", "intervention/image": "^2.7", "laravel/framework": "^6.20.26", diff --git a/composer.lock b/composer.lock index b66292d..9b5df2a 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "87b78d5c6e1dfc1285abb501c7eb8372", + "content-hash": "0d3d2fbbec4c9922fb38612b6fa05ac0", "packages": [ { "name": "aliyuncs/oss-sdk-php", @@ -51,6 +51,151 @@ }, "time": "2022-05-13T07:41:28+00:00" }, + { + "name": "beyondcode/laravel-websockets", + "version": "1.13.1", + "source": { + "type": "git", + "url": "https://github.com/beyondcode/laravel-websockets.git", + "reference": "f0649b65fb5562d20eff66f61716ef98717e228a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/beyondcode/laravel-websockets/zipball/f0649b65fb5562d20eff66f61716ef98717e228a", + "reference": "f0649b65fb5562d20eff66f61716ef98717e228a", + "shasum": "" + }, + "require": { + "cboden/ratchet": "^0.4.1", + "ext-json": "*", + "facade/ignition-contracts": "^1.0", + "guzzlehttp/psr7": "^1.7|^2.0", + "illuminate/broadcasting": "^6.0|^7.0|^8.0|^9.0", + "illuminate/console": "^6.0|^7.0|^8.0|^9.0", + "illuminate/http": "^6.0|^7.0|^8.0|^9.0", + "illuminate/routing": "^6.0|^7.0|^8.0|^9.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0", + "php": "^7.2|^8.0", + "pusher/pusher-php-server": "^3.0|^4.0|^5.0|^6.0|^7.0", + "react/dns": "^1.1", + "react/http": "^1.1", + "symfony/http-kernel": "^4.0|^5.0|^6.0", + "symfony/psr-http-message-bridge": "^1.1|^2.0" + }, + "require-dev": { + "mockery/mockery": "^1.3.3", + "orchestra/testbench": "^4.0|^5.0|^6.0", + "phpunit/phpunit": "^8.0|^9.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "BeyondCode\\LaravelWebSockets\\WebSocketsServiceProvider" + ], + "aliases": { + "WebSocketRouter": "BeyondCode\\LaravelWebSockets\\Facades\\WebSocketRouter" + } + } + }, + "autoload": { + "psr-4": { + "BeyondCode\\LaravelWebSockets\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marcel Pociot", + "email": "marcel@beyondco.de", + "homepage": "https://beyondcode.de", + "role": "Developer" + }, + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "An easy to use WebSocket server", + "homepage": "https://github.com/beyondcode/laravel-websockets", + "keywords": [ + "beyondcode", + "laravel-websockets" + ], + "support": { + "issues": "https://github.com/beyondcode/laravel-websockets/issues", + "source": "https://github.com/beyondcode/laravel-websockets/tree/1.13.1" + }, + "time": "2022-03-03T08:41:47+00:00" + }, + { + "name": "cboden/ratchet", + "version": "v0.4.4", + "source": { + "type": "git", + "url": "https://github.com/ratchetphp/Ratchet.git", + "reference": "5012dc954541b40c5599d286fd40653f5716a38f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ratchetphp/Ratchet/zipball/5012dc954541b40c5599d286fd40653f5716a38f", + "reference": "5012dc954541b40c5599d286fd40653f5716a38f", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.7|^2.0", + "php": ">=5.4.2", + "ratchet/rfc6455": "^0.3.1", + "react/event-loop": ">=0.4", + "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5", + "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0", + "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ratchet\\": "src/Ratchet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "role": "Developer" + }, + { + "name": "Matt Bonneau", + "role": "Developer" + } + ], + "description": "PHP WebSocket library", + "homepage": "http://socketo.me", + "keywords": [ + "Ratchet", + "WebSockets", + "server", + "sockets", + "websocket" + ], + "support": { + "chat": "https://gitter.im/reactphp/reactphp", + "issues": "https://github.com/ratchetphp/Ratchet/issues", + "source": "https://github.com/ratchetphp/Ratchet/tree/v0.4.4" + }, + "time": "2021-12-14T00:20:41+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.4", @@ -350,6 +495,53 @@ ], "time": "2020-12-29T14:50:06+00:00" }, + { + "name": "evenement/evenement", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7", + "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Evenement": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/master" + }, + "time": "2017-07-23T21:35:13+00:00" + }, { "name": "ezyang/htmlpurifier", "version": "v4.14.0", @@ -401,6 +593,59 @@ }, "time": "2021-12-25T01:21:49+00:00" }, + { + "name": "facade/ignition-contracts", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition-contracts.git", + "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^v2.15.8", + "phpunit/phpunit": "^9.3.11", + "vimeo/psalm": "^3.17.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facade\\IgnitionContracts\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://flareapp.io", + "role": "Developer" + } + ], + "description": "Solution contracts for Ignition", + "homepage": "https://github.com/facade/ignition-contracts", + "keywords": [ + "contracts", + "flare", + "ignition" + ], + "support": { + "issues": "https://github.com/facade/ignition-contracts/issues", + "source": "https://github.com/facade/ignition-contracts/tree/1.0.2" + }, + "time": "2020-10-16T08:27:54+00:00" + }, { "name": "fideloper/proxy", "version": "4.4.2", @@ -459,6 +704,270 @@ }, "time": "2022-02-09T13:33:34+00:00" }, + { + "name": "fig/http-message-util", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message-util.git", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/9d94dc0154230ac39e5bf89398b324a86f63f765", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "suggest": { + "psr/http-message": "The package containing the PSR-7 interfaces" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "issues": "https://github.com/php-fig/http-message-util/issues", + "source": "https://github.com/php-fig/http-message-util/tree/1.1.5" + }, + "time": "2020-11-24T22:02:12+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.4.5", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1dd98b0564cb3f6bd16ce683cb755f94c10fbd82", + "reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.9 || ^2.4", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-curl": "*", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.4-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.4.5" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2022-06-20T22:16:13+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2021-10-22T20:56:57+00:00" + }, { "name": "guzzlehttp/psr7", "version": "2.4.0", @@ -1815,6 +2324,92 @@ }, "time": "2020-10-15T08:29:30+00:00" }, + { + "name": "paragonie/sodium_compat", + "version": "v1.17.1", + "source": { + "type": "git", + "url": "https://github.com/paragonie/sodium_compat.git", + "reference": "ac994053faac18d386328c91c7900f930acadf1e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/ac994053faac18d386328c91c7900f930acadf1e", + "reference": "ac994053faac18d386328c91c7900f930acadf1e", + "shasum": "" + }, + "require": { + "paragonie/random_compat": ">=1", + "php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8" + }, + "require-dev": { + "phpunit/phpunit": "^3|^4|^5|^6|^7|^8|^9" + }, + "suggest": { + "ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.", + "ext-sodium": "PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security." + }, + "type": "library", + "autoload": { + "files": [ + "autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com" + }, + { + "name": "Frank Denis", + "email": "jedisct1@pureftpd.org" + } + ], + "description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists", + "keywords": [ + "Authentication", + "BLAKE2b", + "ChaCha20", + "ChaCha20-Poly1305", + "Chapoly", + "Curve25519", + "Ed25519", + "EdDSA", + "Edwards-curve Digital Signature Algorithm", + "Elliptic Curve Diffie-Hellman", + "Poly1305", + "Pure-PHP cryptography", + "RFC 7748", + "RFC 8032", + "Salpoly", + "Salsa20", + "X25519", + "XChaCha20-Poly1305", + "XSalsa20-Poly1305", + "Xchacha20", + "Xsalsa20", + "aead", + "cryptography", + "ecdh", + "elliptic curve", + "elliptic curve cryptography", + "encryption", + "libsodium", + "php", + "public-key cryptography", + "secret-key cryptography", + "side-channel resistant" + ], + "support": { + "issues": "https://github.com/paragonie/sodium_compat/issues", + "source": "https://github.com/paragonie/sodium_compat/tree/v1.17.1" + }, + "time": "2022-03-23T19:32:04+00:00" + }, { "name": "phpoffice/phpspreadsheet", "version": "1.24.1", @@ -2375,6 +2970,67 @@ }, "time": "2022-07-07T13:49:11+00:00" }, + { + "name": "pusher/pusher-php-server", + "version": "7.0.2", + "source": { + "type": "git", + "url": "https://github.com/pusher/pusher-http-php.git", + "reference": "af3eeaefc0c7959f5b3852f0a4dd5547245d33df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pusher/pusher-http-php/zipball/af3eeaefc0c7959f5b3852f0a4dd5547245d33df", + "reference": "af3eeaefc0c7959f5b3852f0a4dd5547245d33df", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "guzzlehttp/guzzle": "^7.2", + "paragonie/sodium_compat": "^1.6", + "php": "^7.3|^8.0", + "psr/log": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "overtrue/phplint": "^2.3", + "phpunit/phpunit": "^8.5|^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Pusher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Library for interacting with the Pusher REST API", + "keywords": [ + "events", + "messaging", + "php-pusher-server", + "publish", + "push", + "pusher", + "real time", + "real-time", + "realtime", + "rest", + "trigger" + ], + "support": { + "issues": "https://github.com/pusher/pusher-http-php/issues", + "source": "https://github.com/pusher/pusher-http-php/tree/7.0.2" + }, + "time": "2021-12-07T13:09:00+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", @@ -2524,6 +3180,864 @@ ], "time": "2021-09-25T23:07:42+00:00" }, + { + "name": "ratchet/rfc6455", + "version": "v0.3.1", + "source": { + "type": "git", + "url": "https://github.com/ratchetphp/RFC6455.git", + "reference": "7c964514e93456a52a99a20fcfa0de242a43ccdb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/7c964514e93456a52a99a20fcfa0de242a43ccdb", + "reference": "7c964514e93456a52a99a20fcfa0de242a43ccdb", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^2 || ^1.7", + "php": ">=5.4.2" + }, + "require-dev": { + "phpunit/phpunit": "^5.7", + "react/socket": "^1.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ratchet\\RFC6455\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "role": "Developer" + }, + { + "name": "Matt Bonneau", + "role": "Developer" + } + ], + "description": "RFC6455 WebSocket protocol handler", + "homepage": "http://socketo.me", + "keywords": [ + "WebSockets", + "rfc6455", + "websocket" + ], + "support": { + "chat": "https://gitter.im/reactphp/reactphp", + "issues": "https://github.com/ratchetphp/RFC6455/issues", + "source": "https://github.com/ratchetphp/RFC6455/tree/v0.3.1" + }, + "time": "2021-12-09T23:20:49+00:00" + }, + { + "name": "react/cache", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "4bf736a2cccec7298bdf745db77585966fc2ca7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/4bf736a2cccec7298bdf745db77585966fc2ca7e", + "reference": "4bf736a2cccec7298bdf745db77585966fc2ca7e", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.1.1" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-02-02T06:47:52+00:00" + }, + { + "name": "react/dns", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb", + "reference": "6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.0 || ^2.7 || ^1.2.1", + "react/promise-timer": "^1.8" + }, + "require-dev": { + "clue/block-react": "^1.2", + "phpunit/phpunit": "^9.3 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.9.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-12-20T08:46:54+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "187fb56f46d424afb6ec4ad089269c72eec2e137" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/187fb56f46d424afb6ec4ad089269c72eec2e137", + "reference": "187fb56f46d424afb6ec4ad089269c72eec2e137", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "suggest": { + "ext-event": "~1.0 for ExtEventLoop", + "ext-pcntl": "For signal handling support when using the StreamSelectLoop", + "ext-uv": "* for ExtUvLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-03-17T11:10:22+00:00" + }, + { + "name": "react/http", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/http.git", + "reference": "59961cc4a5b14481728f07c591546be18fa3a5c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/http/zipball/59961cc4a5b14481728f07c591546be18fa3a5c7", + "reference": "59961cc4a5b14481728f07c591546be18fa3a5c7", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "fig/http-message-util": "^1.1", + "php": ">=5.3.0", + "psr/http-message": "^1.0", + "react/event-loop": "^1.2", + "react/promise": "^2.3 || ^1.2.1", + "react/promise-stream": "^1.1", + "react/socket": "^1.9", + "react/stream": "^1.2", + "ringcentral/psr7": "^1.2" + }, + "require-dev": { + "clue/block-react": "^1.5", + "clue/http-proxy-react": "^1.7", + "clue/reactphp-ssh-proxy": "^1.3", + "clue/socks-react": "^1.3", + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Http\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven, streaming HTTP client and server implementation for ReactPHP", + "keywords": [ + "async", + "client", + "event-driven", + "http", + "http client", + "http server", + "https", + "psr-7", + "reactphp", + "server", + "streaming" + ], + "support": { + "issues": "https://github.com/reactphp/http/issues", + "source": "https://github.com/reactphp/http/tree/v1.6.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-02-03T13:17:37+00:00" + }, + { + "name": "react/promise", + "version": "v2.9.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v2.9.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-02-11T10:27:51+00:00" + }, + { + "name": "react/promise-stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise-stream.git", + "reference": "ef05517b99e4363beaa7993d4e2d6c50f1b22a09" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise-stream/zipball/ef05517b99e4363beaa7993d4e2d6c50f1b22a09", + "reference": "ef05517b99e4363beaa7993d4e2d6c50f1b22a09", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/promise": "^3 || ^2.1 || ^1.2", + "react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.6" + }, + "require-dev": { + "clue/block-react": "^1.0", + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3", + "react/promise-timer": "^1.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "The missing link between Promise-land and Stream-land for ReactPHP", + "homepage": "https://github.com/reactphp/promise-stream", + "keywords": [ + "Buffer", + "async", + "promise", + "reactphp", + "stream", + "unwrap" + ], + "support": { + "issues": "https://github.com/reactphp/promise-stream/issues", + "source": "https://github.com/reactphp/promise-stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-06-20T10:36:51+00:00" + }, + { + "name": "react/promise-timer", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise-timer.git", + "reference": "aa7a73c74b8d8c0f622f5982ff7b0351bc29e495" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise-timer/zipball/aa7a73c74b8d8c0f622f5982ff7b0351bc29e495", + "reference": "aa7a73c74b8d8c0f622f5982ff7b0351bc29e495", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/event-loop": "^1.2", + "react/promise": "^3.0 || ^2.7.0 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\Timer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A trivial implementation of timeouts for Promises, built on top of ReactPHP.", + "homepage": "https://github.com/reactphp/promise-timer", + "keywords": [ + "async", + "event-loop", + "promise", + "reactphp", + "timeout", + "timer" + ], + "support": { + "issues": "https://github.com/reactphp/promise-timer/issues", + "source": "https://github.com/reactphp/promise-timer/tree/v1.9.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-06-13T13:41:03+00:00" + }, + { + "name": "react/socket", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "f474156aaab4f09041144fa8b57c7d70aed32a1c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/f474156aaab4f09041144fa8b57c7d70aed32a1c", + "reference": "f474156aaab4f09041144fa8b57c7d70aed32a1c", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.8", + "react/event-loop": "^1.2", + "react/promise": "^2.6.0 || ^1.2.1", + "react/promise-timer": "^1.8", + "react/stream": "^1.2" + }, + "require-dev": { + "clue/block-react": "^1.5", + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/promise-stream": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.11.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-01-14T10:14:32+00:00" + }, + { + "name": "react/stream", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/7a423506ee1903e89f1e08ec5f0ed430ff784ae9", + "reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-07-11T12:37:55+00:00" + }, + { + "name": "ringcentral/psr7", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/ringcentral/psr7.git", + "reference": "360faaec4b563958b673fb52bbe94e37f14bc686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ringcentral/psr7/zipball/360faaec4b563958b673fb52bbe94e37f14bc686", + "reference": "360faaec4b563958b673fb52bbe94e37f14bc686", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "RingCentral\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "support": { + "source": "https://github.com/ringcentral/psr7/tree/master" + }, + "time": "2018-05-29T20:21:04+00:00" + }, { "name": "spatie/laravel-permission", "version": "5.3.2", @@ -4319,6 +5833,94 @@ ], "time": "2022-04-04T10:19:07+00:00" }, + { + "name": "symfony/psr-http-message-bridge", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/psr-http-message-bridge.git", + "reference": "22b37c8a3f6b5d94e9cdbd88e1270d96e2f97b34" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/22b37c8a3f6b5d94e9cdbd88e1270d96e2f97b34", + "reference": "22b37c8a3f6b5d94e9cdbd88e1270d96e2f97b34", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0", + "symfony/http-foundation": "^4.4 || ^5.0 || ^6.0" + }, + "require-dev": { + "nyholm/psr7": "^1.1", + "psr/log": "^1.1 || ^2 || ^3", + "symfony/browser-kit": "^4.4 || ^5.0 || ^6.0", + "symfony/config": "^4.4 || ^5.0 || ^6.0", + "symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0", + "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0", + "symfony/http-kernel": "^4.4 || ^5.0 || ^6.0", + "symfony/phpunit-bridge": "^5.4@dev || ^6.0" + }, + "suggest": { + "nyholm/psr7": "For a super lightweight PSR-7/17 implementation" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-main": "2.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\PsrHttpMessage\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "PSR HTTP message bridge", + "homepage": "http://symfony.com", + "keywords": [ + "http", + "http-message", + "psr-17", + "psr-7" + ], + "support": { + "issues": "https://github.com/symfony/psr-http-message-bridge/issues", + "source": "https://github.com/symfony/psr-http-message-bridge/tree/v2.1.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-05T13:13:39+00:00" + }, { "name": "symfony/routing", "version": "v4.4.41", @@ -5090,59 +6692,6 @@ }, "time": "2022-02-23T20:20:52+00:00" }, - { - "name": "facade/ignition-contracts", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/facade/ignition-contracts.git", - "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/3c921a1cdba35b68a7f0ccffc6dffc1995b18267", - "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267", - "shasum": "" - }, - "require": { - "php": "^7.3|^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^v2.15.8", - "phpunit/phpunit": "^9.3.11", - "vimeo/psalm": "^3.17.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Facade\\IgnitionContracts\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://flareapp.io", - "role": "Developer" - } - ], - "description": "Solution contracts for Ignition", - "homepage": "https://github.com/facade/ignition-contracts", - "keywords": [ - "contracts", - "flare", - "ignition" - ], - "support": { - "issues": "https://github.com/facade/ignition-contracts/issues", - "source": "https://github.com/facade/ignition-contracts/tree/1.0.2" - }, - "time": "2020-10-16T08:27:54+00:00" - }, { "name": "fakerphp/faker", "version": "v1.20.0", From 7bd32293a64f28d0b0d6ee3da7ffdfbefa1cff6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 14:20:54 +0800 Subject: [PATCH 06/33] =?UTF-8?q?feat:=20#10000=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=9F=9F=E5=90=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 27fd06d..979be48 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -109,7 +109,7 @@ class KuaiTuanTuan extends BusinessClient return strtoupper(md5($str)); } - public function doRequest($type, $appendParams = [], $url = 'http://gw-api.pinduoduo.com/api/router') + public function doRequest($type, $appendParams = [], $url = 'https://gw-api.pinduoduo.com/api/router') { $publicParams = [ 'type' => $type, From d8373b8fc78eec36fd71d416ca5792de14d820e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 15:05:17 +0800 Subject: [PATCH 07/33] =?UTF-8?q?feat:=20#10000=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=AF=B7=E4=BC=98=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Business/BusinessClient.php | 41 +++++++++++-------- .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 16 ++------ app/Services/Business/MiaoXuan/Goods.php | 13 +++--- app/Services/Business/MiaoXuan/MiaoXuan.php | 11 +---- composer.json | 1 + composer.lock | 5 ++- 6 files changed, 41 insertions(+), 46 deletions(-) diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index cbc6eac..af1c81d 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -10,6 +10,7 @@ abstract class BusinessClient protected $redirectUri = 'http://erp.chutang66.com/callback'; protected $code; protected $shop; + protected $skuId = 0; abstract public function auth(); @@ -51,39 +52,47 @@ abstract class BusinessClient return $this->shop; } - protected function setCode($code) + public function setCode($code) { $this->code = $code; return $this; } - protected function getCode() + public function getCode() { return $this->code; } + public function setSkuId($skuId) + { + $this->skuId = $skuId; + + return $this; + } + + public function getSkuId() + { + return $this->skuId; + } + public function formDataPostRequest($url, $params) { $headers = [ - 'headers' => ['Content-type' => 'multipart/form-data;charset=UTF-8'], + 'headers' => ['Content-type' => 'application/x-www-form-urlencoded;charset=UTF-8'], 'form_params' => $params ]; $res = (new Client())->request('POST', $url, $headers); $res = json_decode($res->getBody()->getContents(), true); - if (isset($res['error_response'])) { - $log = new Log(); - $log->module = 'plat'; - $log->action = 'POST'; - $log->target_type = 'kuaituantuan'; - $log->target_id = 0; - $log->target_field = '更新库存'; - $log->user_id = 1; - $log->message = json_encode($res, 256); - $log->save(); - - throw new \Exception($res['error_response']['error_msg'], $res['error_response']['error_code']); - } + $log = new Log(); + $log->module = 'plat'; + $log->action = 'POST'; + $log->target_type = $this->shop->plat_id; + $log->target_id = $this->skuId; + $log->target_field = $params['type']; + $log->user_id = 1; + $log->message = json_encode($res, 256); + $log->save(); return $res; } diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 979be48..e63da0c 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -2,7 +2,6 @@ namespace App\Services\Business\KuaiTuanTuan; -use App\Listeners\BindBusinessGoods; use App\Models\BusinessGoodsSku; use App\Models\GoodsSku; use App\Services\Business\BusinessClient; @@ -40,7 +39,7 @@ class KuaiTuanTuan extends BusinessClient public function downloadGoods($page = 1) { [$type, $appendParams] = Goods::downloadGoods($this->shop->owner_name, $page); - $res = $this->formDataPostRequest($type, $appendParams); + $res = $this->doRequest($type, $appendParams); $goods = $res['ktt_goods_query_list_response']['goods_list']; $this->bindGoods($goods); $pageNum = ceil($res['total'] / $appendParams['size']); @@ -59,16 +58,7 @@ class KuaiTuanTuan extends BusinessClient $goodsSku = GoodsSku::query()->find($skuId); $business = BusinessGoodsSku::query()->where('shop_id', $this->shop->id)->where('self_sku_id', $skuId)->first(['goods_id', 'sku_id']); [$type, $appendParams] = Goods::incrQuantity($business->goodsId, $goodsSku->stock, $business->sku_id); - $this->formDataPostRequest($type, $appendParams); - $log = new Log(); - $log->module = 'plat'; - $log->action = 'POST'; - $log->target_type = 'kuaituantuan'; - $log->target_id = 0; - $log->target_field = $type; - $log->user_id = 1; - $log->message = 'success'; - $log->save(); + $this->doRequest($type, $appendParams); } public function downloadOrders($beginTime, $endTime, $activityNo, $downloadType = 'default') @@ -78,7 +68,7 @@ class KuaiTuanTuan extends BusinessClient } else { [$type, $appendParams] = Order::downloadOrders($beginTime, $endTime, $activityNo); } - $res = $this->formDataPostRequest($type, $appendParams); + $res = $this->doRequest($type, $appendParams); return $res['ktt_order_list_response']['order_list']; diff --git a/app/Services/Business/MiaoXuan/Goods.php b/app/Services/Business/MiaoXuan/Goods.php index 06ceddf..8276fa6 100644 --- a/app/Services/Business/MiaoXuan/Goods.php +++ b/app/Services/Business/MiaoXuan/Goods.php @@ -19,11 +19,14 @@ class Goods public static function incrQuantity($shopId, $quantity, $businessGoods) { return [ - 'stock' => $quantity, - 'business_sku_id' => $businessGoods['sku_id'], - 'business_goods_id' => $businessGoods['goods_id'], - 'erp_shop_id' => $shopId, - 'erp_sku_id' => $businessGoods['external_sku_id'] + 'data' => [ + 'stock' => $quantity, + 'business_sku_id' => $businessGoods['sku_id'], + 'business_goods_id' => $businessGoods['goods_id'], + 'erp_shop_id' => $shopId, + 'erp_sku_id' => $businessGoods['external_sku_id'], + ], + 'type' => '更新库存', ]; } } diff --git a/app/Services/Business/MiaoXuan/MiaoXuan.php b/app/Services/Business/MiaoXuan/MiaoXuan.php index 3415a33..300b967 100644 --- a/app/Services/Business/MiaoXuan/MiaoXuan.php +++ b/app/Services/Business/MiaoXuan/MiaoXuan.php @@ -29,17 +29,8 @@ class MiaoXuan extends BusinessClient $goodsSku = GoodsSku::query()->find($skuId); $business = BusinessGoodsSku::query()->where('shop_id', $this->shop->id)->where('self_sku_id', $skuId)->first(['goods_id', 'sku_id', 'external_sku_id'])->toArray(); $appendParams = Goods::incrQuantity($this->shop->id, $goodsSku->stock, $business); - $url = ''; // http://shop.chutang66.com/miaoxuan/stock + $url = 'http://shop.chutang66.com/miaoxuan/stock'; $this->formDataPostRequest($url, $appendParams); - $log = new Log(); - $log->module = 'plat'; - $log->action = 'POST'; - $log->target_type = 'miaoxuan'; - $log->target_id = 0; - $log->target_field = '更新库存'; - $log->user_id = 1; - $log->message = 'success'; - $log->save(); } public function downloadOrders($beginTime, $endTime, $activityNo, $downloadType = 'default') diff --git a/composer.json b/composer.json index d12ec93..979cd8b 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "license": "MIT", "require": { "php": "^7.2.5|^8.0", + "ext-json": "^1.7", "aliyuncs/oss-sdk-php": "^2.5", "beyondcode/laravel-websockets": "^1.13", "fideloper/proxy": "^4.4", diff --git a/composer.lock b/composer.lock index 9b5df2a..1e34c06 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "0d3d2fbbec4c9922fb38612b6fa05ac0", + "content-hash": "5a01163bdf570af5226c567ad02f45d7", "packages": [ { "name": "aliyuncs/oss-sdk-php", @@ -9109,7 +9109,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.2.5|^8.0" + "php": "^7.2.5|^8.0", + "ext-json": "^1.7" }, "platform-dev": [], "plugin-api-version": "2.3.0" From a4d9d6cc9a3f155ee907fe9523e615d45e1e34c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 15:11:16 +0800 Subject: [PATCH 08/33] =?UTF-8?q?feat:=20#10000=20json=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 979cd8b..4bbc05d 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "license": "MIT", "require": { "php": "^7.2.5|^8.0", - "ext-json": "^1.7", + "ext-json": "*", "aliyuncs/oss-sdk-php": "^2.5", "beyondcode/laravel-websockets": "^1.13", "fideloper/proxy": "^4.4", From d86418ea8cf3fd5cc6b3ef667da47af329de8e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 16:00:47 +0800 Subject: [PATCH 09/33] =?UTF-8?q?feat:=20#10000=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Test.php | 48 +++++++++++++++++++ .../Controllers/Goods/GoodsSkusController.php | 3 +- app/Http/Requests/GoodsSkuRequest.php | 10 ++-- app/Models/Shop.php | 4 +- app/Services/Business/BusinessClient.php | 3 ++ .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 4 +- .../2022_08_02_022448_create_shops_table.php | 4 +- ...30834_create_business_goods_skus_table.php | 20 ++++---- ...05_093629_create_business_orders_table.php | 16 +++---- ...3658_create_business_order_items_table.php | 16 +++---- 10 files changed, 92 insertions(+), 36 deletions(-) create mode 100644 app/Console/Commands/Test.php diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php new file mode 100644 index 0000000..cda01ab --- /dev/null +++ b/app/Console/Commands/Test.php @@ -0,0 +1,48 @@ +find(2); + $business = BusinessFactory::init()->make($shop->plat_id); + $business->setShop($shop); + $res = $business->downloadGoods(); + var_dump($res); + } +} diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index 71a6e25..3cf21f9 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -119,7 +119,8 @@ class GoodsSkusController extends Controller Rule::exists('goods_skus', 'id'), ], ]; - $validator = $this->validateUpdate($request->all(), $appendRules); + $skuRules = (new GoodsSkuRequest())->arrayRules('skus.*.'); + $validator = Validator::make($request->all(), array_merge($appendRules, $skuRules)); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); diff --git a/app/Http/Requests/GoodsSkuRequest.php b/app/Http/Requests/GoodsSkuRequest.php index c403df0..c12ba05 100644 --- a/app/Http/Requests/GoodsSkuRequest.php +++ b/app/Http/Requests/GoodsSkuRequest.php @@ -27,11 +27,11 @@ class GoodsSkuRequest extends FormRequest return [ 'id' => ['sometimes', 'required', 'integer', 'exists:goods_skus,id'], 'goods_id' => ['sometimes', 'required', 'integer', 'exists:goods,id'], - 'title' => ['required', 'string', 'max:255'], - 'sku_code' => ['required', 'distinct', 'alpha_dash', 'max:32'], - 'status' => ['required', 'integer', Rule::in([0, 1, 2])], - 'num' => ['required', 'integer'], - 'cost' => ['required', 'numeric'], + 'title' => ['sometimes', 'required', 'string', 'max:255'], + 'sku_code' => ['sometimes', 'required', 'distinct', 'alpha_dash', 'max:32'], + 'status' => ['sometimes', 'required', 'integer', Rule::in([0, 1, 2])], + 'num' => ['sometimes', 'required', 'integer'], + 'cost' => ['sometimes', 'required', 'numeric'], 'reference_price' => [ 'sometimes', 'numeric', diff --git a/app/Models/Shop.php b/app/Models/Shop.php index cee46e5..f45960b 100644 --- a/app/Models/Shop.php +++ b/app/Models/Shop.php @@ -16,7 +16,9 @@ class Shop extends Model 'pop_auth_token_create_response', ]; - protected $guarded = []; + protected $fillable = [ + 'access_token', 'expires_at', 'expires_in', 'owner_id', 'owner_name', 'refresh_token', 'refresh_token_expires_at', 'refresh_token_expires_in', 'scope', 'pop_auth_token_create_response', 'status' + ]; public function getStatusAttribute($value) { diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index af1c81d..4ef76d3 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -93,6 +93,9 @@ abstract class BusinessClient $log->user_id = 1; $log->message = json_encode($res, 256); $log->save(); + if (isset($res['error_response'])) { + throw new \Exception($res['error_response']['error_msg'], $res['error_response']['error_code']); + } return $res; } diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index e63da0c..143f07d 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -30,7 +30,9 @@ class KuaiTuanTuan extends BusinessClient public function auth() { $accessToken = $this->getAccessTokenWithCode(); + $accessToken['scope'] = json_encode($accessToken['scope'], 256); $accessToken['pop_auth_token_create_response'] = json_encode($accessToken, 256); + $accessToken['status'] = 1; $this->shop->update($accessToken); return $this->shop; @@ -107,7 +109,7 @@ class KuaiTuanTuan extends BusinessClient 'timestamp' => time() ]; if ('pdd.pop.auth.token.create' !== $type) { - $publicParams['access_token'] = $this->getAccessToken(); + $publicParams['access_token'] = $this->getShop()->access_token; } $publicParams = array_merge($publicParams, $appendParams); $publicParams['sign'] = $this->getSign($publicParams); diff --git a/database/migrations/2022_08_02_022448_create_shops_table.php b/database/migrations/2022_08_02_022448_create_shops_table.php index 7fddb77..2cdeb16 100644 --- a/database/migrations/2022_08_02_022448_create_shops_table.php +++ b/database/migrations/2022_08_02_022448_create_shops_table.php @@ -18,12 +18,12 @@ class CreateShopsTable extends Migration $table->string('name')->unique(); $table->unsignedTinyInteger('plat_id')->comment('平台id'); $table->string('access_token')->nullable(); - $table->unsignedMediumInteger('expires_at')->nullable()->comment('access_token过期时间点'); + $table->unsignedBigInteger('expires_at')->nullable()->comment('access_token过期时间点'); $table->unsignedInteger('expires_in')->nullable()->comment('access_token过期时间段,10(表示10秒后过期)'); $table->string('owner_id')->nullable()->comment('商家店铺id'); $table->string('owner_name')->nullable()->comment('商家账号名称'); $table->string('refresh_token')->nullable()->comment('refresh token,可用来刷新access_token'); - $table->unsignedMediumInteger('refresh_token_expires_at')->nullable()->comment('Refresh token过期时间点'); + $table->unsignedBigInteger('refresh_token_expires_at')->nullable()->comment('Refresh token过期时间点'); $table->unsignedInteger('refresh_token_expires_in')->nullable()->comment('refresh_token过期时间段,10表示10秒后过期'); $table->text('scope')->nullable()->comment('接口列表'); $table->text('pop_auth_token_create_response')->nullable()->comment('授权认证信息'); diff --git a/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php b/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php index 18c9b5b..7a84e15 100644 --- a/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php +++ b/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php @@ -19,27 +19,27 @@ class CreateBusinessGoodsSkusTable extends Migration $table->bigInteger('self_sku_id')->nullable(); $table->string('activity_no')->nullable(); $table->string('category_name')->nullable(); - $table->mediumInteger('create_time')->nullable(); + $table->bigInteger('create_time')->nullable(); $table->text('goods_desc')->nullable(); $table->string('goods_id')->nullable(); $table->text('goods_image_list')->nullable(); $table->string('goods_name')->nullable(); $table->integer('is_activity_delete')->nullable(); $table->integer('limit_buy')->nullable(); - $table->mediumInteger('market_price')->nullable(); - $table->mediumInteger('update_time')->nullable(); + $table->bigInteger('market_price')->nullable(); + $table->bigInteger('update_time')->nullable(); $table->string('external_sku_id')->nullable(); - $table->mediumInteger('goods_purchase_price')->nullable(); - $table->mediumInteger('price_in_fen')->nullable(); - $table->mediumInteger('quantity')->nullable(); + $table->bigInteger('goods_purchase_price')->nullable(); + $table->bigInteger('price_in_fen')->nullable(); + $table->bigInteger('quantity')->nullable(); $table->integer('quantity_type')->nullable(); - $table->mediumInteger('reserve_quantity')->nullable(); - $table->mediumInteger('sku_id')->nullable(); - $table->mediumInteger('sold_quantity')->nullable(); + $table->bigInteger('reserve_quantity')->nullable(); + $table->bigInteger('sku_id')->nullable(); + $table->bigInteger('sold_quantity')->nullable(); $table->text('spec_list')->nullable(); $table->string('spec_name')->nullable(); $table->string('thumb_url')->nullable(); - $table->mediumInteger('total_quantity')->nullable(); + $table->bigInteger('total_quantity')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2022_08_05_093629_create_business_orders_table.php b/database/migrations/2022_08_05_093629_create_business_orders_table.php index 7561823..69baab2 100644 --- a/database/migrations/2022_08_05_093629_create_business_orders_table.php +++ b/database/migrations/2022_08_05_093629_create_business_orders_table.php @@ -18,22 +18,22 @@ class CreateBusinessOrdersTable extends Migration $table->integer('shop_id'); $table->bigInteger('activity_no')->nullable(); $table->string('activity_title')->nullable(); - $table->mediumInteger('after_sales_status')->nullable(); + $table->bigInteger('after_sales_status')->nullable(); $table->string('business_note')->nullable(); $table->string('buyer_memo')->nullable(); $table->integer('cancel_status')->nullable(); - $table->mediumInteger('confirm_at')->nullable(); - $table->mediumInteger('discount_amount')->nullable(); + $table->bigInteger('confirm_at')->nullable(); + $table->bigInteger('discount_amount')->nullable(); $table->string('help_sell_nickname')->nullable(); $table->string('inner_transaction_id')->nullable(); $table->boolean('is_supplier')->nullable(); $table->integer('logistics_type')->nullable(); $table->integer('mall_activity_type')->nullable(); $table->string('nick_name')->nullable(); - $table->mediumInteger('order_amount')->nullable(); + $table->bigInteger('order_amount')->nullable(); $table->string('order_sn')->nullable(); $table->integer('participate_no')->nullable(); - $table->mediumInteger('platform_discount_amount')->nullable(); + $table->bigInteger('platform_discount_amount')->nullable(); $table->string('receiver_address_city')->nullable(); $table->string('receiver_address_detail')->nullable(); $table->string('receiver_address_district')->nullable(); @@ -46,12 +46,12 @@ class CreateBusinessOrdersTable extends Migration $table->string('self_pick_up_contact_mobile')->nullable(); $table->string('self_pick_up_contact_name')->nullable(); $table->string('self_pick_up_site_name')->nullable(); - $table->mediumInteger('service_amount')->nullable(); - $table->mediumInteger('shipping_amount')->nullable(); + $table->bigInteger('service_amount')->nullable(); + $table->bigInteger('shipping_amount')->nullable(); $table->integer('shipping_status')->nullable(); $table->string('supply_activity_no')->nullable(); $table->integer('supply_participate_no')->nullable(); - $table->mediumInteger('theoretical_refund_amount')->nullable(); + $table->bigInteger('theoretical_refund_amount')->nullable(); $table->string('transaction_id')->nullable(); $table->integer('verification_status')->nullable(); $table->timestamps(); diff --git a/database/migrations/2022_08_05_093658_create_business_order_items_table.php b/database/migrations/2022_08_05_093658_create_business_order_items_table.php index 325103c..0495831 100644 --- a/database/migrations/2022_08_05_093658_create_business_order_items_table.php +++ b/database/migrations/2022_08_05_093658_create_business_order_items_table.php @@ -21,21 +21,21 @@ class CreateBusinessOrderItemsTable extends Migration $table->integer('cancel_status')->nullable(); $table->string('category_name')->nullable(); $table->string('external_sku_id')->nullable(); - $table->mediumInteger('goods_amount')->nullable(); - $table->mediumInteger('goods_cost_price')->nullable(); - $table->mediumInteger('goods_id')->nullable(); + $table->bigInteger('goods_amount')->nullable(); + $table->bigInteger('goods_cost_price')->nullable(); + $table->bigInteger('goods_id')->nullable(); $table->string('goods_name')->nullable(); $table->integer('goods_number')->nullable(); - $table->mediumInteger('goods_price')->nullable(); - $table->mediumInteger('goods_purchase_price')->nullable(); + $table->bigInteger('goods_price')->nullable(); + $table->bigInteger('goods_purchase_price')->nullable(); $table->string('goods_specification')->nullable(); - $table->mediumInteger('help_sell_amount')->nullable(); + $table->bigInteger('help_sell_amount')->nullable(); $table->boolean('is_supplier')->nullable(); $table->integer('need_verification_number')->nullable(); $table->integer('shipping_status')->nullable(); - $table->mediumInteger('sku_id')->nullable(); + $table->bigInteger('sku_id')->nullable(); $table->string('sub_order_sn')->nullable(); - $table->mediumInteger('theoretically_refund_amount')->nullable(); + $table->bigInteger('theoretically_refund_amount')->nullable(); $table->string('thumb_url')->nullable(); $table->integer('verification_number')->nullable(); $table->timestamps(); From 73cebca1e5080995101749d8806373c98cb296e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 17:20:49 +0800 Subject: [PATCH 10/33] =?UTF-8?q?feat:=20#10000=20=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=BF=94=E5=9B=9E=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Goods/GoodsSkusController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index 3cf21f9..ffbcffe 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -56,7 +56,7 @@ class GoodsSkusController extends Controller $query->with(['type:id,name', 'brand:id,name']); }]) ->with(['daily' => function ($query) use ($day) { - return $query->where('day', $day)->first(['id', 'sku_id', 'day', 'arrived_today_num', 'loss_num', 'inventory']); + $query->where('day', $day)->first(['arrived_today_num', 'loss_num', 'inventory']); }]) ->paginate(); From 8c3d717561d9890d008c94629b8711345b0ef23c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 17:25:12 +0800 Subject: [PATCH 11/33] =?UTF-8?q?feat:=20#10000=20=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=BF=94=E5=9B=9E=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Goods/GoodsSkusController.php | 2 +- app/Models/DailyStockRecord.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index ffbcffe..dc16c7d 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -56,7 +56,7 @@ class GoodsSkusController extends Controller $query->with(['type:id,name', 'brand:id,name']); }]) ->with(['daily' => function ($query) use ($day) { - $query->where('day', $day)->first(['arrived_today_num', 'loss_num', 'inventory']); + $query->where('day', $day); }]) ->paginate(); diff --git a/app/Models/DailyStockRecord.php b/app/Models/DailyStockRecord.php index 7f609c6..84c1c61 100644 --- a/app/Models/DailyStockRecord.php +++ b/app/Models/DailyStockRecord.php @@ -4,5 +4,5 @@ namespace App\Models; class DailyStockRecord extends Model { - + protected $hidden = ['created_at', 'updated_at']; } From 942d46f7a9de094389f9eb21aaa8d706c6165388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 18:53:38 +0800 Subject: [PATCH 12/33] =?UTF-8?q?feat:=20#10000=20=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E5=BF=AB=E5=9B=A2=E5=9B=A2=E6=B5=8B=E8=AF=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Test.php | 10 ++++-- app/Services/Business/BusinessClient.php | 31 +++++++++++++------ app/Services/Business/KuaiTuanTuan/Goods.php | 11 +++++-- .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 28 +++++++++++++---- app/Services/Business/MiaoXuan/MiaoXuan.php | 7 ++++- ...03559_create_daily_stock_records_table.php | 2 +- 6 files changed, 66 insertions(+), 23 deletions(-) diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index cda01ab..b8ce985 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -2,6 +2,7 @@ namespace App\Console\Commands; +use App\Models\GoodsSku; use App\Models\Shop; use App\Services\Business\BusinessFactory; use Illuminate\Console\Command; @@ -42,7 +43,12 @@ class Test extends Command $shop = Shop::query()->find(2); $business = BusinessFactory::init()->make($shop->plat_id); $business->setShop($shop); - $res = $business->downloadGoods(); - var_dump($res); + // 下载商品 + $business->downloadGoods(1); + + // 库存修改 +// $business->incrQuantity(1); + + $this->info('执行测试成功'); } } diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index 4ef76d3..dd7b1c5 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -1,6 +1,7 @@ request('POST', $url, $headers); $res = json_decode($res->getBody()->getContents(), true); - $log = new Log(); - $log->module = 'plat'; - $log->action = 'POST'; - $log->target_type = $this->shop->plat_id; - $log->target_id = $this->skuId; - $log->target_field = $params['type']; - $log->user_id = 1; - $log->message = json_encode($res, 256); - $log->save(); + $disableLogType = [ + 'pdd.ktt.goods.query.list', + 'pdd.ktt.order.list', + 'pdd.ktt.increment.order.query' + ]; + if (!in_array($params['type'], $disableLogType, true)) { + $log = new Log(); + $log->module = 'plat'; + $log->action = 'POST'; + $log->target_type = $this->shop->plat_id; + $log->target_id = $this->skuId; + $log->target_field = $params['type']; + $log->user_id = 1; + $log->message = json_encode($res, 256); + $log->save(); + } + if (isset($res['error_response'])) { throw new \Exception($res['error_response']['error_msg'], $res['error_response']['error_code']); } diff --git a/app/Services/Business/KuaiTuanTuan/Goods.php b/app/Services/Business/KuaiTuanTuan/Goods.php index 7f4e540..90cc3cd 100644 --- a/app/Services/Business/KuaiTuanTuan/Goods.php +++ b/app/Services/Business/KuaiTuanTuan/Goods.php @@ -10,7 +10,7 @@ class Goods { $type = 'pdd.ktt.goods.query.list'; $appendParams = [ - 'activity_no' => $activityNo, // 非必填,团号(团号和创建时间只能传一个) +// 'activity_no' => $activityNo, // 非必填,团号(团号和创建时间只能传一个) 'page' => $page, 'size' => $size, // 'update_time_end' => '', // 非必填,结束最后更新时间(毫秒级时间戳) @@ -27,6 +27,7 @@ class Goods foreach ($goodsList as $businessGood) { $skuList = $businessGood['sku_list']; unset($businessGood['sku_list']); + $businessGood['goods_image_list'] = json_encode($businessGood['goods_image_list'], 256); foreach ($skuList as $sku) { $sku['spec_list'] = json_encode($sku['spec_list'], 256); $data = array_merge($businessGood, $sku); @@ -38,12 +39,16 @@ class Goods } } - public function downloadSingle($goodsId) + public static function downloadSingle($goodsId) { $type = 'pdd.ktt.goods.query.single'; $appendParams = [ - 'goods_id' => $goodsId + 'goods_id' => $goodsId, + 'page' => 1, + 'size' => 100, ]; + + return [$type, $appendParams]; } public static function incrQuantity($goodsId, $quantity, $skuId, $modifyType = 2) diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 143f07d..08611d9 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -38,13 +38,13 @@ class KuaiTuanTuan extends BusinessClient return $this->shop; } - public function downloadGoods($page = 1) + public function downloadGoodsList($page = 1) { - [$type, $appendParams] = Goods::downloadGoods($this->shop->owner_name, $page); + [$type, $appendParams] = Goods::downloadGoods($this->shop->owner_id, $page); $res = $this->doRequest($type, $appendParams); $goods = $res['ktt_goods_query_list_response']['goods_list']; $this->bindGoods($goods); - $pageNum = ceil($res['total'] / $appendParams['size']); + $pageNum = ceil($res['ktt_goods_query_list_response']['total'] / $appendParams['size']); if ($pageNum > $page && 10 >= $page) { $this->downloadGoods($page + 1); } @@ -57,9 +57,12 @@ class KuaiTuanTuan extends BusinessClient public function incrQuantity($skuId) { - $goodsSku = GoodsSku::query()->find($skuId); - $business = BusinessGoodsSku::query()->where('shop_id', $this->shop->id)->where('self_sku_id', $skuId)->first(['goods_id', 'sku_id']); - [$type, $appendParams] = Goods::incrQuantity($business->goodsId, $goodsSku->stock, $business->sku_id); + $goodsSku = GoodsSku::query() + ->with(['goods:id,goods_code']) + ->find($skuId); + $code = $goodsSku->goods->goods_code . '_' . $goodsSku->sku_code; + $business = BusinessGoodsSku::query()->where('shop_id', $this->shop->id)->where('external_sku_id', $code)->first(['goods_id', 'sku_id']); + [$type, $appendParams] = Goods::incrQuantity($business->goods_id, $goodsSku->stock, $business->sku_id); $this->doRequest($type, $appendParams); } @@ -124,4 +127,17 @@ class KuaiTuanTuan extends BusinessClient return "https://oauth.pinduoduo.com/authorize/ktt?client_id={$this->clientId}&redirect_uri={$this->redirectUri}&state={$state}"; } + + public function downloadGoods($skuId) + { + $goodsSku = GoodsSku::query() + ->with(['goods:id,goods_code']) + ->find($skuId); + $code = $goodsSku->goods->goods_code . '_' . $goodsSku->sku_code; + $business = BusinessGoodsSku::query()->where('shop_id', $this->shop->id)->where('external_sku_id', $code)->first(['goods_id', 'sku_id']); + [$type, $appendParams] = Goods::downloadSingle($business->goods_id); + $res = $this->doRequest($type, $appendParams); + $goods = $res['response']['result']; + $this->bindGoods([$goods]); + } } diff --git a/app/Services/Business/MiaoXuan/MiaoXuan.php b/app/Services/Business/MiaoXuan/MiaoXuan.php index 300b967..afd6faf 100644 --- a/app/Services/Business/MiaoXuan/MiaoXuan.php +++ b/app/Services/Business/MiaoXuan/MiaoXuan.php @@ -15,7 +15,7 @@ class MiaoXuan extends BusinessClient // TODO: Implement auth() method. } - public function downloadGoods() + public function downloadGoodsList() { } @@ -41,4 +41,9 @@ class MiaoXuan extends BusinessClient { Order::saveOrders($orders, $this->shop->id); } + + public function downloadGoods($skuId) + { + // TODO: Implement downloadGoods() method. + } } diff --git a/database/migrations/2022_07_26_103559_create_daily_stock_records_table.php b/database/migrations/2022_07_26_103559_create_daily_stock_records_table.php index 7d97f34..894332f 100644 --- a/database/migrations/2022_07_26_103559_create_daily_stock_records_table.php +++ b/database/migrations/2022_07_26_103559_create_daily_stock_records_table.php @@ -20,7 +20,7 @@ class CreateDailyStockRecordsTable extends Migration $table->unsignedInteger('arrived_today_num')->default(0)->comment('今日到货'); $table->unsignedInteger('loss_num')->default(0)->comment('损耗'); $table->unsignedInteger('inventory')->default(0)->comment('库存盘点'); - $table->unique('sku_id', 'day'); + $table->unique(['sku_id', 'day']); $table->timestamps(); }); } From a379270d7c83d17ccd25ecdca2e35d8d9931161f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 20:02:08 +0800 Subject: [PATCH 13/33] =?UTF-8?q?feat:=20#10000=20=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Goods/GoodsSkusController.php | 5 +++-- app/Http/Requests/GoodsSkuRequest.php | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index dc16c7d..eb69941 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -216,12 +216,13 @@ class GoodsSkusController extends Controller return response($this->res, $this->res['httpCode']); } - private function stock($skus) + private function stock($request) { + $skus = $request->skus; $update = reset($skus); DB::beginTransaction(); try { - $sku = GoodsSku::query()->where('id', $update['id'])->get(['id', 'two_days_ago_num', 'yesterday_num', 'num', 'stock']); + $sku = GoodsSku::query()->where('id', $update['id'])->first(['id', 'two_days_ago_num', 'yesterday_num', 'num', 'stock']); $record = DailyStockRecord::query() ->where('sku_id', $sku->id) ->where('day', FormatUtils::date()) diff --git a/app/Http/Requests/GoodsSkuRequest.php b/app/Http/Requests/GoodsSkuRequest.php index c12ba05..e29cbb6 100644 --- a/app/Http/Requests/GoodsSkuRequest.php +++ b/app/Http/Requests/GoodsSkuRequest.php @@ -45,6 +45,18 @@ class GoodsSkuRequest extends FormRequest 'sometimes', 'integer', ], + 'arrived_today_num' => [ + 'sometimes', + 'integer', + ], + 'yesterday_num' => [ + 'sometimes', + 'integer', + ], + 'two_days_ago_num' => [ + 'sometimes', + 'integer', + ], 'inventory' => [ 'sometimes', 'integer', From 12b734e9160063606e3325346731b9b9fee4ae3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Tue, 9 Aug 2022 10:34:36 +0800 Subject: [PATCH 14/33] =?UTF-8?q?feat:=20#20220809=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Test.php | 14 ++++++-- .../Controllers/Goods/GoodsController.php | 11 ++++-- .../Controllers/Goods/GoodsSkusController.php | 12 +++---- app/Http/Controllers/Menu/MenusController.php | 2 -- app/Services/Business/BusinessClient.php | 18 +++++----- .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 11 +++++- app/Services/Business/KuaiTuanTuan/Order.php | 4 +-- app/Services/Business/MiaoXuan/MiaoXuan.php | 2 +- app/Utils/DateTimeUtils.php | 34 ++++++++++++++++++ app/Utils/FormatUtils.php | 14 -------- resources/templates/goods_skus_import.xlsx | Bin 11 files changed, 81 insertions(+), 41 deletions(-) create mode 100644 app/Utils/DateTimeUtils.php mode change 100644 => 100755 resources/templates/goods_skus_import.xlsx diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index b8ce985..85976af 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -2,9 +2,9 @@ namespace App\Console\Commands; -use App\Models\GoodsSku; use App\Models\Shop; use App\Services\Business\BusinessFactory; +use App\Utils\DateTimeUtils; use Illuminate\Console\Command; class Test extends Command @@ -43,12 +43,20 @@ class Test extends Command $shop = Shop::query()->find(2); $business = BusinessFactory::init()->make($shop->plat_id); $business->setShop($shop); - // 下载商品 - $business->downloadGoods(1); + // 下载商品列表 +// $business->downloadGoodsList(); + + // 下载单个商品 +// $business->downloadGoods(1); // 库存修改 // $business->incrQuantity(1); + // 订单下载 + $beginTime = DateTimeUtils::getMicroTime('2022-08-08'); + $endTime = DateTimeUtils::getMicroTime('2022-08-09'); + $business->downloadOrders($beginTime, $endTime); + $this->info('执行测试成功'); } } diff --git a/app/Http/Controllers/Goods/GoodsController.php b/app/Http/Controllers/Goods/GoodsController.php index 1d25ed8..0dedbb7 100644 --- a/app/Http/Controllers/Goods/GoodsController.php +++ b/app/Http/Controllers/Goods/GoodsController.php @@ -6,7 +6,7 @@ use App\Http\Controllers\Controller; use App\Http\Requests\GoodsSkuRequest; use App\Http\Resources\GoodsResource; use App\Models\Log as LogModel; -use App\Utils\FormatUtils; +use App\Utils\DateTimeUtils; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Validator; @@ -69,7 +69,7 @@ class GoodsController extends Controller foreach ($collection as $sku) { $newRecords[] = [ 'sku_id' => $sku['id'], - 'day' => FormatUtils::date(), + 'day' => DateTimeUtils::getToday(), ]; } $record = new DailyStockRecord(); @@ -89,6 +89,11 @@ class GoodsController extends Controller public function download() { - return Storage::download(resource_path('templates/goods_skus_import.xlsx')); + $file = resource_path('templates/goods_skus_import.xlsx'); + $headers = [ + 'Content-Type: application/xlsx', + ]; + + return response()->download($file, 'goods_skus_import.xlsx', $headers); } } diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index eb69941..664e99b 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -9,7 +9,7 @@ use App\Http\Requests\GoodsSkuRequest; use App\Models\Goods; use App\Models\Log; use App\Models\Log as LogModel; -use App\Utils\FormatUtils; +use App\Utils\DateTimeUtils; use Illuminate\Http\Request; use App\Models\GoodsSku; use App\Http\Resources\GoodsSkuResource; @@ -45,7 +45,7 @@ class GoodsSkusController extends Controller ->pluck('sku_id') ->toArray(); } - $day = FormatUtils::date(); + $day = DateTimeUtils::getToday(); $goodsSkus = GoodsSku::query() ->whereIn('goods_id', $goodsIds) ->when($ids, function ($query, $ids) { @@ -156,7 +156,7 @@ class GoodsSkusController extends Controller $costLog['after_update'] = $goodsSku->cost; $logs[] = $costLog; // 今日到货 - $record = DailyStockRecord::query()->where('sku_id', $sku['id'])->where('day', FormatUtils::date())->first(['id', 'arrived_today_num']); + $record = DailyStockRecord::query()->where('sku_id', $sku['id'])->where('day', DateTimeUtils::getToday())->first(['id', 'arrived_today_num']); $arrivedLog['target_field'] = 'arrived_today_num'; $arrivedLog['before_update'] = $record->arrived_today_num; $record->arrived_today_num += $sku['arrived_today_num']; @@ -193,7 +193,7 @@ class GoodsSkusController extends Controller 'user_id' => $request->user()->id ]; // 今日到货 - $record = DailyStockRecord::query()->where('sku_id', $sku['id'])->where('day', FormatUtils::date())->first(['id', 'inventory']); + $record = DailyStockRecord::query()->where('sku_id', $sku['id'])->where('day', DateTimeUtils::getToday())->first(['id', 'inventory']); $inventoryLog['target_field'] = 'inventory'; $inventoryLog['before_update'] = $record->inventory; $record->inventory = $sku['inventory']; @@ -225,7 +225,7 @@ class GoodsSkusController extends Controller $sku = GoodsSku::query()->where('id', $update['id'])->first(['id', 'two_days_ago_num', 'yesterday_num', 'num', 'stock']); $record = DailyStockRecord::query() ->where('sku_id', $sku->id) - ->where('day', FormatUtils::date()) + ->where('day', DateTimeUtils::getToday()) ->first(); $this->setBeforeUpdate([ 'two_days_ago_num' => $sku->two_days_ago_num, @@ -299,7 +299,7 @@ class GoodsSkusController extends Controller if ('loss_num' === $updateField) { $model = DailyStockRecord::query() ->where('sku_id', $id) - ->where('day', FormatUtils::date()) + ->where('day', DateTimeUtils::getToday()) ->first(['id', 'loss_num']); $this->log->message = $request->get('reason'); $this->setBeforeUpdate($model->loss_num); diff --git a/app/Http/Controllers/Menu/MenusController.php b/app/Http/Controllers/Menu/MenusController.php index dd50b68..4ee8538 100644 --- a/app/Http/Controllers/Menu/MenusController.php +++ b/app/Http/Controllers/Menu/MenusController.php @@ -6,8 +6,6 @@ use App\Http\Controllers\Controller; use App\Models\Log as LogModel; use App\Models\Menu; use App\Http\Resources\MenusResource; -use App\Models\User; -use App\Utils\ArrayUtils; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; use Illuminate\Validation\Rule; diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index dd7b1c5..024a208 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -23,7 +23,7 @@ abstract class BusinessClient abstract public function incrQuantity($skuId); - abstract public function downloadOrders($beginTime, $endTime, $activityNo, $downloadType = 'default'); + abstract public function downloadOrders($beginTime, $endTime, $activityNo = '', $downloadType = 'default'); abstract public function saveOrders($orders); @@ -92,17 +92,17 @@ abstract class BusinessClient 'pdd.ktt.order.list', 'pdd.ktt.increment.order.query' ]; + $log = new Log(); + $log->module = 'plat'; + $log->action = 'POST'; + $log->target_type = $this->shop->plat_id; + $log->target_id = $this->skuId; + $log->target_field = $params['type']; + $log->user_id = 1; if (!in_array($params['type'], $disableLogType, true)) { - $log = new Log(); - $log->module = 'plat'; - $log->action = 'POST'; - $log->target_type = $this->shop->plat_id; - $log->target_id = $this->skuId; - $log->target_field = $params['type']; - $log->user_id = 1; $log->message = json_encode($res, 256); - $log->save(); } + $log->save(); if (isset($res['error_response'])) { throw new \Exception($res['error_response']['error_msg'], $res['error_response']['error_code']); diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 08611d9..9eaf85c 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -66,7 +66,16 @@ class KuaiTuanTuan extends BusinessClient $this->doRequest($type, $appendParams); } - public function downloadOrders($beginTime, $endTime, $activityNo, $downloadType = 'default') + /** + * 没有发起售后,未取消的订单 + * + * @param $beginTime + * @param $endTime + * @param $activityNo + * @param $downloadType + * @return mixed + */ + public function downloadOrders($beginTime, $endTime, $activityNo = '', $downloadType = 'default') { if ('increment' === $downloadType) { [$type, $appendParams] = Order::downloadIncrementOrders($beginTime, $endTime, $activityNo); diff --git a/app/Services/Business/KuaiTuanTuan/Order.php b/app/Services/Business/KuaiTuanTuan/Order.php index fed5f51..9c50b44 100644 --- a/app/Services/Business/KuaiTuanTuan/Order.php +++ b/app/Services/Business/KuaiTuanTuan/Order.php @@ -18,7 +18,7 @@ class Order 'page_number' => 1, // 页码, 必填 'page_size' => 100, // 数量, 必填, 1~100 // 非必填 - 'activity_no' => $activityNo, // 团号 +// 'activity_no' => $activityNo, // 团号 'after_sales_status' => 0, // 售后状态, 可选 0-未发起售后 1-退款中 2-退款成功 3-待处理 4-拒绝退款 6-待(顾客)退货 7-待(团长)确认退货 8-(顾客)撤销 9-(系统)关闭 'cancel_status' => 0, // 取消状态, 可选 0-未取消 1-已取消 // 'shipping_status' => '', // 发货状态 0-未发货 1-已发货 2-部分发货 3-已收货 @@ -40,7 +40,7 @@ class Order 'page_number' => 1, // 页码 'page_size' => 100, // 数量 // 非必填 - 'activity_no' => $activityNo, // 团号 +// 'activity_no' => $activityNo, // 团号 'after_sales_status' => 0, // 售后状态, 可选 0-未发起售后 1-退款中 2-退款成功 3-待处理 4-拒绝退款 6-待(顾客)退货 7-待(团长)确认退货 8-(顾客)撤销 9-(系统)关闭 'cancel_status' => 0, // 取消状态, 可选 0-未取消 1-已取消 // 'shipping_status' => '', // 发货状态 0-未发货 1-已发货 2-部分发货 3-已收货 diff --git a/app/Services/Business/MiaoXuan/MiaoXuan.php b/app/Services/Business/MiaoXuan/MiaoXuan.php index afd6faf..0b3fb35 100644 --- a/app/Services/Business/MiaoXuan/MiaoXuan.php +++ b/app/Services/Business/MiaoXuan/MiaoXuan.php @@ -33,7 +33,7 @@ class MiaoXuan extends BusinessClient $this->formDataPostRequest($url, $appendParams); } - public function downloadOrders($beginTime, $endTime, $activityNo, $downloadType = 'default') + public function downloadOrders($beginTime, $endTime, $activityNo = '', $downloadType = 'default') { } diff --git a/app/Utils/DateTimeUtils.php b/app/Utils/DateTimeUtils.php new file mode 100644 index 0000000..69d0886 --- /dev/null +++ b/app/Utils/DateTimeUtils.php @@ -0,0 +1,34 @@ + Date: Tue, 9 Aug 2022 10:57:03 +0800 Subject: [PATCH 15/33] =?UTF-8?q?feat:=20#10000=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Goods/GoodsSkusController.php | 6 ++++-- app/Imports/GoodsSkusImport.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index 664e99b..9e6e175 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -333,8 +333,10 @@ class GoodsSkusController extends Controller ]; } try { - $collection = Excel::import(new GoodsSkusImport(), $request->file('goodsSkus')); - $this->setAfterUpdate($collection->toArray()); + $import = new GoodsSkusImport(); + $path = $request->file('goodsSkus'); + Excel::import($import, $path); + $this->setAfterUpdate(''); $this->addLog(0, 'import'); } catch (ValidationException $exception) { $this->setValidatorFailResponse($exception->validator->getMessageBag()->getMessages()); diff --git a/app/Imports/GoodsSkusImport.php b/app/Imports/GoodsSkusImport.php index 6ca3402..639aa51 100644 --- a/app/Imports/GoodsSkusImport.php +++ b/app/Imports/GoodsSkusImport.php @@ -33,7 +33,7 @@ class GoodsSkusImport implements ToCollection, SkipsEmptyRows '*.0' => ['required', 'string', 'max:255'], '*.1' => ['required', 'string', 'max:255', 'exists:goods_types,name'], '*.2' => ['string', 'max:255', 'exists:goods_brands,name'], - '*.3' => ['required', 'alpha_dash', 'max:32', 'unique:goods,goods_code'], + '*.3' => ['required', 'alpha_dash', 'max:32'], '*.4' => ['required', 'string', 'max:255'], '*.5' => ['required', 'distinct', 'alpha_dash', 'max:32'], '*.6' => ['required', 'string', Rule::in(['下架', '在售', '预警'])], From 3d40201c179ab4c5be9b8c8ae85bebfb0d4aa50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Tue, 9 Aug 2022 16:56:52 +0800 Subject: [PATCH 16/33] =?UTF-8?q?feat:=20#20220802=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app/Console/Commands/Test.php | 4 +- .../Controllers/Auth/RegisterController.php | 4 +- .../Goods/GoodsBrandsController.php | 4 +- .../Controllers/Goods/GoodsSkusController.php | 1 - .../Goods/GoodsTypesController.php | 4 +- .../Permission/PermissionsController.php | 4 +- app/Http/Controllers/Role/RolesController.php | 4 +- app/Http/Controllers/Shop/ShopsController.php | 2 +- app/Http/Controllers/User/UsersController.php | 4 +- app/Http/Requests/GoodsRequest.php | 4 +- app/Http/Requests/GoodsSkuRequest.php | 2 +- app/Imports/GoodsSkusImport.php | 46 +++++++++++++------ app/Models/BusinessGoodsSku.php | 26 ++++++++++- app/Models/BusinessOrder.php | 37 ++++++++++++++- app/Services/Business/BusinessClient.php | 12 ++--- .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 24 ++++++---- app/Services/Business/KuaiTuanTuan/Order.php | 14 +++--- app/Services/Business/MiaoXuan/MiaoXuan.php | 4 +- config/app.php | 2 +- config/database.php | 8 ++-- .../2014_10_12_000000_create_users_table.php | 3 ++ ..._07_26_061712_create_goods_types_table.php | 1 + ...07_26_085847_create_goods_brands_table.php | 1 + .../2022_07_26_090143_create_goods_table.php | 1 + ...2_07_26_090150_create_goods_skus_table.php | 2 + .../2022_07_28_095523_create_menus_table.php | 1 + .../2022_08_02_022448_create_shops_table.php | 1 + ...05_093629_create_business_orders_table.php | 2 +- 29 files changed, 157 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 2267884..f93375a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ 1. `composer install` 2. `cp .env.example .env` 3. 修改 .env 配置项为本地配置 -4. 创建数据库 `CREATE DATABASE IF NOT EXISTS `erp` DEFAULT CHARACTER SET utf8;` +4. 创建数据库 `CREATE DATABASE IF NOT EXISTS `erp` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci;` 5. `php artisan migrate` 如果数据填充没有执行成功,则需要再次执行 `php artisan migrate:fresh --seed` 6. `php artisan key:generate` 7. `php artisan update:super_admin_permissions` 更新超级管理员角色权限 diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 85976af..dde17fa 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -40,7 +40,7 @@ class Test extends Command */ public function handle() { - $shop = Shop::query()->find(2); + $shop = Shop::query()->find(1); $business = BusinessFactory::init()->make($shop->plat_id); $business->setShop($shop); // 下载商品列表 @@ -55,7 +55,7 @@ class Test extends Command // 订单下载 $beginTime = DateTimeUtils::getMicroTime('2022-08-08'); $endTime = DateTimeUtils::getMicroTime('2022-08-09'); - $business->downloadOrders($beginTime, $endTime); + $business->downloadOrdersAndSave($beginTime, $endTime); $this->info('执行测试成功'); } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index e48e455..dc42522 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -52,8 +52,8 @@ class RegisterController extends Controller protected function validator(array $data) { return Validator::make($data, [ - 'name' => ['required', 'string', 'unique:users', 'max:255'], - 'email' => ['string', 'email', 'max:255', 'unique:users'], + 'name' => ['required', 'string', 'unique:users', 'max:191'], + 'email' => ['string', 'email', 'max:191', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'confirmed'], 'role_id' => ['required', 'numeric', 'exists:roles,id'], ]); diff --git a/app/Http/Controllers/Goods/GoodsBrandsController.php b/app/Http/Controllers/Goods/GoodsBrandsController.php index 6e54c9e..bfe167b 100644 --- a/app/Http/Controllers/Goods/GoodsBrandsController.php +++ b/app/Http/Controllers/Goods/GoodsBrandsController.php @@ -32,7 +32,7 @@ class GoodsBrandsController extends Controller { $validator = Validator::make($request->all(), [ 'names' => 'required|array', - 'names.*' => 'required|string|max:255|unique:goods_brands,name', + 'names.*' => 'required|string|max:191|unique:goods_brands,name', ]); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); @@ -68,7 +68,7 @@ class GoodsBrandsController extends Controller 'name' => [ 'required', 'string', - 'max:255', + 'max:191', Rule::unique('goods_brands')->ignore($id), ] ]); diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index 9e6e175..ab40a9b 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -336,7 +336,6 @@ class GoodsSkusController extends Controller $import = new GoodsSkusImport(); $path = $request->file('goodsSkus'); Excel::import($import, $path); - $this->setAfterUpdate(''); $this->addLog(0, 'import'); } catch (ValidationException $exception) { $this->setValidatorFailResponse($exception->validator->getMessageBag()->getMessages()); diff --git a/app/Http/Controllers/Goods/GoodsTypesController.php b/app/Http/Controllers/Goods/GoodsTypesController.php index 9a7611c..cb7afa7 100644 --- a/app/Http/Controllers/Goods/GoodsTypesController.php +++ b/app/Http/Controllers/Goods/GoodsTypesController.php @@ -32,7 +32,7 @@ class GoodsTypesController extends Controller { $validator = Validator::make($request->all(), [ 'names' => 'required|array', - 'names.*' => 'required|string|max:255|unique:goods_types,name', + 'names.*' => 'required|string|max:191|unique:goods_types,name', ]); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); @@ -68,7 +68,7 @@ class GoodsTypesController extends Controller 'name' => [ 'required', 'string', - 'max:255', + 'max:191', Rule::unique('goods_types')->ignore($id), ] ]); diff --git a/app/Http/Controllers/Permission/PermissionsController.php b/app/Http/Controllers/Permission/PermissionsController.php index 112f82b..43e4d01 100644 --- a/app/Http/Controllers/Permission/PermissionsController.php +++ b/app/Http/Controllers/Permission/PermissionsController.php @@ -39,7 +39,7 @@ class PermissionsController extends Controller public function store(Request $request) { $validator = Validator::make($request->all(), [ - 'name' => 'required|string|max:255|unique:permissions,name', + 'name' => 'required|string|max:191|unique:permissions,name', ]); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); @@ -63,7 +63,7 @@ class PermissionsController extends Controller public function update($id, Request $request) { $validator = Validator::make($request->all(), [ - 'name' => ['required', 'string', 'max:255', Rule::unique('permissions')->ignore($id),] + 'name' => ['required', 'string', 'max:191', Rule::unique('permissions')->ignore($id),] ]); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); diff --git a/app/Http/Controllers/Role/RolesController.php b/app/Http/Controllers/Role/RolesController.php index 2f861c2..1e592c7 100644 --- a/app/Http/Controllers/Role/RolesController.php +++ b/app/Http/Controllers/Role/RolesController.php @@ -40,7 +40,7 @@ class RolesController extends Controller public function store(Request $request) { $validator = Validator::make($request->all(), [ - 'name' => 'required|string|max:255|unique:roles,name', + 'name' => 'required|string|max:191|unique:roles,name', ]); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); @@ -75,7 +75,7 @@ class RolesController extends Controller public function update($id, Request $request) { $validator = Validator::make($request->all(), [ - 'name' => ['required', 'string', 'max:255', Rule::unique('roles')->ignore($id),] + 'name' => ['required', 'string', 'max:191', Rule::unique('roles')->ignore($id),] ]); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index 37be306..e6fc501 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -37,7 +37,7 @@ class ShopsController extends Controller public function store(Request $request) { $validator = Validator::make($request->all(), [ - 'name' => 'required|string|max:255|unique:shops,name', + 'name' => 'required|string|max:191|unique:shops,name', 'plat_id' => 'required|integer', ]); if ($validator->fails()) { diff --git a/app/Http/Controllers/User/UsersController.php b/app/Http/Controllers/User/UsersController.php index e341bae..5a378d7 100644 --- a/app/Http/Controllers/User/UsersController.php +++ b/app/Http/Controllers/User/UsersController.php @@ -33,7 +33,7 @@ class UsersController extends Controller public function store(Request $request, Faker $faker) { $validator = Validator::make($request->all(), [ - 'name' => 'required|string|max:255|unique:users,name', + 'name' => 'required|string|max:191|unique:users,name', 'password' => 'required|string|min:8|confirmed', 'email' => 'email', 'role_name' => 'required|string|exists:roles,name' @@ -67,7 +67,7 @@ class UsersController extends Controller 'name' => [ 'required', 'string', - 'max:255', + 'max:191', Rule::unique('users')->ignore($id), ], // 'old_password' => 'sometimes|required|string|min:8', diff --git a/app/Http/Requests/GoodsRequest.php b/app/Http/Requests/GoodsRequest.php index e0ecc5f..b807bef 100644 --- a/app/Http/Requests/GoodsRequest.php +++ b/app/Http/Requests/GoodsRequest.php @@ -26,8 +26,8 @@ class GoodsRequest extends FormRequest { return [ 'id' => ['sometimes', 'required', 'integer', 'exists:goods,id'], - 'title' => ['required', 'string', 'max:255'], - 'img_url' => ['required', 'string', 'max:255'], + 'title' => ['required', 'string', 'max:191'], + 'img_url' => ['required', 'string', 'max:191'], 'type_id' => ['required', 'integer', 'exists:goods_types,id'], 'brand_id' => ['integer', 'exists:goods_brands,id'], 'goods_code' => ['required', 'alpha_dash', 'max:32', Rule::unique('goods')->ignore(request('goods_id'))], diff --git a/app/Http/Requests/GoodsSkuRequest.php b/app/Http/Requests/GoodsSkuRequest.php index e29cbb6..2af032a 100644 --- a/app/Http/Requests/GoodsSkuRequest.php +++ b/app/Http/Requests/GoodsSkuRequest.php @@ -27,7 +27,7 @@ class GoodsSkuRequest extends FormRequest return [ 'id' => ['sometimes', 'required', 'integer', 'exists:goods_skus,id'], 'goods_id' => ['sometimes', 'required', 'integer', 'exists:goods,id'], - 'title' => ['sometimes', 'required', 'string', 'max:255'], + 'title' => ['sometimes', 'required', 'string', 'max:191'], 'sku_code' => ['sometimes', 'required', 'distinct', 'alpha_dash', 'max:32'], 'status' => ['sometimes', 'required', 'integer', Rule::in([0, 1, 2])], 'num' => ['sometimes', 'required', 'integer'], diff --git a/app/Imports/GoodsSkusImport.php b/app/Imports/GoodsSkusImport.php index 639aa51..61bc4c4 100644 --- a/app/Imports/GoodsSkusImport.php +++ b/app/Imports/GoodsSkusImport.php @@ -2,11 +2,14 @@ namespace App\Imports; +use App\Models\DailyStockRecord; use App\Models\Goods; use App\Models\GoodsBrand; use App\Models\GoodsSku; use App\Models\GoodsType; +use App\Utils\DateTimeUtils; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\DB; use Illuminate\Validation\Rule; use Illuminate\Validation\ValidationException; use Maatwebsite\Excel\Concerns\SkipsEmptyRows; @@ -30,11 +33,11 @@ class GoodsSkusImport implements ToCollection, SkipsEmptyRows unset($collection[0], $collection[1]); $arr = $collection->toArray(); $validator = Validator::make($arr, [ - '*.0' => ['required', 'string', 'max:255'], - '*.1' => ['required', 'string', 'max:255', 'exists:goods_types,name'], - '*.2' => ['string', 'max:255', 'exists:goods_brands,name'], + '*.0' => ['required', 'string', 'max:191'], + '*.1' => ['required', 'string', 'max:191', 'exists:goods_types,name'], + '*.2' => ['string', 'max:191', 'exists:goods_brands,name'], '*.3' => ['required', 'alpha_dash', 'max:32'], - '*.4' => ['required', 'string', 'max:255'], + '*.4' => ['required', 'string', 'max:191'], '*.5' => ['required', 'distinct', 'alpha_dash', 'max:32'], '*.6' => ['required', 'string', Rule::in(['下架', '在售', '预警'])], '*.7' => ['required', 'max:10'], @@ -76,16 +79,33 @@ class GoodsSkusImport implements ToCollection, SkipsEmptyRows } $skus[] = $sku; } - if ($newGoods) { - $goods = new Goods(); - $goods->batchInsert(array_values($newGoods)); - $hasGoods = Goods::query()->whereIn('goods_code', array_column($newGoods, 'goods_code'))->get(['id', 'goods_code'])->toArray(); - $hasGoods = ArrayUtils::index($hasGoods, 'goods_code'); - foreach ($skus as &$sku) { - $sku['goods_id'] = isset($hasGoods[$sku['goods_id']]) ? $hasGoods[$sku['goods_id']]['id'] : $sku['goods_id']; + DB::beginTransaction(); + try { + if ($newGoods) { + $goods = new Goods(); + $goods->batchInsert(array_values($newGoods)); + $hasGoods = Goods::query()->whereIn('goods_code', array_column($newGoods, 'goods_code'))->get(['id', 'goods_code'])->toArray(); + $hasGoods = ArrayUtils::index($hasGoods, 'goods_code'); + foreach ($skus as &$newGoodsSku) { + $newGoodsSku['goods_id'] = isset($hasGoods[$newGoodsSku['goods_id']]) ? $hasGoods[$newGoodsSku['goods_id']]['id'] : $newGoodsSku['goods_id']; + } + unset($newGoodsSku); } + $goodsSku = new GoodsSku(); + $goodsSku->batchInsert(array_values($skus)); + $collection = GoodsSku::query()->whereIn('sku_code', array_column($skus, 'sku_code'))->get(['id', 'sku_code'])->toArray(); + $newRecords = []; + foreach ($collection as $sku) { + $newRecords[] = [ + 'sku_id' => $sku['id'], + 'day' => DateTimeUtils::getToday(), + ]; + } + $record = new DailyStockRecord(); + $record->batchInsert($newRecords); + DB::commit(); + } catch (\Exception $exception) { + DB::rollBack(); } - $goodsSku = new GoodsSku(); - $goodsSku->batchInsert(array_values($skus)); } } diff --git a/app/Models/BusinessGoodsSku.php b/app/Models/BusinessGoodsSku.php index 468332d..6d95bb9 100644 --- a/app/Models/BusinessGoodsSku.php +++ b/app/Models/BusinessGoodsSku.php @@ -9,5 +9,29 @@ class BusinessGoodsSku extends Model * * @var array */ - protected $guarded = []; + protected $fillable = [ + 'shop_id', + 'business_order_id', + 'already_cancel_number', + 'cancel_status', + 'category_name', + 'external_sku_id', + 'goods_amount', + 'goods_cost_price', + 'goods_id', + 'goods_name', + 'goods_number', + 'goods_price', + 'goods_purchase_price', + 'goods_specification', + 'help_sell_amount', + 'is_supplier', + 'need_verification_number', + 'shipping_status', + 'sku_id', + 'sub_order_sn', + 'theoretically_refund_amount', + 'thumb_url', + 'verification_number', + ]; } diff --git a/app/Models/BusinessOrder.php b/app/Models/BusinessOrder.php index bc4ef26..42d4f73 100644 --- a/app/Models/BusinessOrder.php +++ b/app/Models/BusinessOrder.php @@ -9,5 +9,40 @@ class BusinessOrder extends Model * * @var array */ - protected $guarded = []; + protected $fillable = [ + 'shop_id', + 'receiver_address_detail', + 'receiver_address_province', + 'self_pick_site_no', + 'discount_amount', + 'theoretical_refund_amount', + 'receiver_address_district', + 'verification_status', + 'inner_transaction_id', + 'is_supplier', + 'service_amount', + 'supply_participate_no', + 'updated_at', + 'order_amount', + 'receiver_address_city', + 'receiver_name', + 'business_note', + 'buyer_memo', + 'logistics_type', + 'help_sell_nickname', + 'activity_title', + 'after_sales_status', + 'mall_activity_type', + 'transaction_id', + 'activity_no', + 'confirm_at', + 'platform_discount_amount', + 'participate_no', + 'receiver_mobile', + 'shipping_status', + 'shipping_amount', + 'cancel_status', + 'nick_name', + 'order_sn', + ]; } diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index 024a208..fa9af39 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -15,7 +15,7 @@ abstract class BusinessClient abstract public function auth(); - abstract public function downloadGoodsList(); + abstract public function downloadGoodsListAndBind(); abstract public function downloadGoods($skuId); @@ -23,7 +23,7 @@ abstract class BusinessClient abstract public function incrQuantity($skuId); - abstract public function downloadOrders($beginTime, $endTime, $activityNo = '', $downloadType = 'default'); + abstract public function downloadOrdersAndSave($beginTime, $endTime, $page = 1, $activityNo = '', $downloadType = 'default'); abstract public function saveOrders($orders); @@ -86,12 +86,8 @@ abstract class BusinessClient 'form_params' => $params ]; $res = (new Client())->request('POST', $url, $headers); + $size = $res->getBody()->getSize(); $res = json_decode($res->getBody()->getContents(), true); - $disableLogType = [ - 'pdd.ktt.goods.query.list', - 'pdd.ktt.order.list', - 'pdd.ktt.increment.order.query' - ]; $log = new Log(); $log->module = 'plat'; $log->action = 'POST'; @@ -99,7 +95,7 @@ abstract class BusinessClient $log->target_id = $this->skuId; $log->target_field = $params['type']; $log->user_id = 1; - if (!in_array($params['type'], $disableLogType, true)) { + if ($size < 64000) { $log->message = json_encode($res, 256); } $log->save(); diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 9eaf85c..c8aae35 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -38,7 +38,7 @@ class KuaiTuanTuan extends BusinessClient return $this->shop; } - public function downloadGoodsList($page = 1) + public function downloadGoodsListAndBind($page = 1) { [$type, $appendParams] = Goods::downloadGoods($this->shop->owner_id, $page); $res = $this->doRequest($type, $appendParams); @@ -67,25 +67,29 @@ class KuaiTuanTuan extends BusinessClient } /** - * 没有发起售后,未取消的订单 + * 下载没有发起售后,未取消的订单 * * @param $beginTime * @param $endTime - * @param $activityNo - * @param $downloadType + * @param int $page + * @param string $activityNo + * @param string $downloadType * @return mixed */ - public function downloadOrders($beginTime, $endTime, $activityNo = '', $downloadType = 'default') + public function downloadOrdersAndSave($beginTime, $endTime, $page = 1, $activityNo = '', $downloadType = 'default') { if ('increment' === $downloadType) { - [$type, $appendParams] = Order::downloadIncrementOrders($beginTime, $endTime, $activityNo); + [$type, $appendParams] = Order::downloadIncrementOrders($beginTime, $endTime, $page); } else { - [$type, $appendParams] = Order::downloadOrders($beginTime, $endTime, $activityNo); + [$type, $appendParams] = Order::downloadOrders($beginTime, $endTime, $page); } $res = $this->doRequest($type, $appendParams); - - - return $res['ktt_order_list_response']['order_list']; + $this->saveOrders($res['ktt_order_list_response']['order_list']); + exit(); + $pageNum = ceil($res['ktt_order_list_response']['total_count'] / $appendParams['size']); + if ($pageNum > $page && 10 >= $page) { + $this->downloadOrdersAndSave($beginTime, $endTime, $page + 1); + } } public function saveOrders($orders) diff --git a/app/Services/Business/KuaiTuanTuan/Order.php b/app/Services/Business/KuaiTuanTuan/Order.php index 9c50b44..06ddf58 100644 --- a/app/Services/Business/KuaiTuanTuan/Order.php +++ b/app/Services/Business/KuaiTuanTuan/Order.php @@ -3,20 +3,21 @@ namespace App\Services\Business\KuaiTuanTuan; use App\Models\BusinessOrder; +use App\Models\BusinessOrderItem; class Order { /** * 根据成交时间拉取订单列表 */ - public static function downloadOrders($beginTime, $endTime, $activityNo) + public static function downloadOrders($beginTime, $endTime, $page = 1) { $type = 'pdd.ktt.order.list'; $appendParams = [ 'confirm_at_begin' => $beginTime, // 成交启始时间, 必填,毫秒时间戳 'confirm_at_end' => $endTime, // 成交结束时间,必填, 毫秒时间戳,成交结束时间 - 成交启始时间 <= 24h - 'page_number' => 1, // 页码, 必填 - 'page_size' => 100, // 数量, 必填, 1~100 + 'page_number' => $page, // 页码, 必填 + 'page_size' => 1, // 数量, 必填, 1~100 // 非必填 // 'activity_no' => $activityNo, // 团号 'after_sales_status' => 0, // 售后状态, 可选 0-未发起售后 1-退款中 2-退款成功 3-待处理 4-拒绝退款 6-待(顾客)退货 7-待(团长)确认退货 8-(顾客)撤销 9-(系统)关闭 @@ -31,13 +32,13 @@ class Order /** * 快团团增量查订单 */ - public static function downloadIncrementOrders($beginTime, $endTime, $activityNo) + public static function downloadIncrementOrders($beginTime, $endTime, $page = 1) { $type = 'pdd.ktt.increment.order.query'; $appendParams = [ 'start_updated_at' => $beginTime, // 更新起始时间 'end_updated_at' => $endTime, // 更新结束时间 - 'page_number' => 1, // 页码 + 'page_number' => $page, // 页码 'page_size' => 100, // 数量 // 非必填 // 'activity_no' => $activityNo, // 团号 @@ -54,12 +55,13 @@ class Order public static function saveOrders(array $orders, $shopId) { foreach ($orders as $order) { + unset($order['custom_item_list'], $order['logistics_list'], $order['gift_order_list']); $orderRecord = BusinessOrder::updateOrCreate( ['shop_id' => $shopId, 'order_sn' => $order['order_sn']], $order ); foreach ($order['sub_order_list'] as $item) { - $orderRecord = BusinessOrder::updateOrCreate( + BusinessOrderItem::updateOrCreate( ['shop_id' => $shopId, 'business_order_id' => $orderRecord->id, 'goods_id' => $item['goods_id'], 'sku_id' => $item['sku_id']], $item ); diff --git a/app/Services/Business/MiaoXuan/MiaoXuan.php b/app/Services/Business/MiaoXuan/MiaoXuan.php index 0b3fb35..7abbdff 100644 --- a/app/Services/Business/MiaoXuan/MiaoXuan.php +++ b/app/Services/Business/MiaoXuan/MiaoXuan.php @@ -15,7 +15,7 @@ class MiaoXuan extends BusinessClient // TODO: Implement auth() method. } - public function downloadGoodsList() + public function downloadGoodsListAndBind() { } @@ -33,7 +33,7 @@ class MiaoXuan extends BusinessClient $this->formDataPostRequest($url, $appendParams); } - public function downloadOrders($beginTime, $endTime, $activityNo = '', $downloadType = 'default') + public function downloadOrdersAndSave($beginTime, $endTime, $page = 1, $activityNo = '', $downloadType = 'default') { } diff --git a/config/app.php b/config/app.php index e370e27..7916e42 100644 --- a/config/app.php +++ b/config/app.php @@ -67,7 +67,7 @@ return [ | */ - 'timezone' => 'UTC', + 'timezone' => 'PRC', /* |-------------------------------------------------------------------------- diff --git a/config/database.php b/config/database.php index b7ba080..b186558 100644 --- a/config/database.php +++ b/config/database.php @@ -52,8 +52,8 @@ return [ 'username' => env('DB_USERNAME', ''), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8', - 'collation' => 'utf8_general_ci', + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, @@ -71,7 +71,7 @@ return [ 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', + 'charset' => 'utf8mb4', 'prefix' => '', 'prefix_indexes' => true, 'schema' => 'public', @@ -86,7 +86,7 @@ return [ 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', + 'charset' => 'utf8mb4', 'prefix' => '', 'prefix_indexes' => true, ], diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 03b4dc9..4e3b45a 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -13,6 +13,7 @@ class CreateUsersTable extends Migration */ public function up() { + Schema::defaultStringLength(191); Schema::create('users', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); @@ -23,6 +24,8 @@ class CreateUsersTable extends Migration $table->softDeletes(); $table->rememberToken(); $table->timestamps(); + // 索引 + $table->unique('name'); }); } diff --git a/database/migrations/2022_07_26_061712_create_goods_types_table.php b/database/migrations/2022_07_26_061712_create_goods_types_table.php index f4bb7d6..0ef0220 100644 --- a/database/migrations/2022_07_26_061712_create_goods_types_table.php +++ b/database/migrations/2022_07_26_061712_create_goods_types_table.php @@ -13,6 +13,7 @@ class CreateGoodsTypesTable extends Migration */ public function up() { + Schema::defaultStringLength(191); Schema::create('goods_types', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name')->nullable(false); diff --git a/database/migrations/2022_07_26_085847_create_goods_brands_table.php b/database/migrations/2022_07_26_085847_create_goods_brands_table.php index b785b7f..6e44c7c 100644 --- a/database/migrations/2022_07_26_085847_create_goods_brands_table.php +++ b/database/migrations/2022_07_26_085847_create_goods_brands_table.php @@ -13,6 +13,7 @@ class CreateGoodsBrandsTable extends Migration */ public function up() { + Schema::defaultStringLength(191); Schema::create('goods_brands', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name')->nullable(false); diff --git a/database/migrations/2022_07_26_090143_create_goods_table.php b/database/migrations/2022_07_26_090143_create_goods_table.php index 749651e..1fdf2da 100644 --- a/database/migrations/2022_07_26_090143_create_goods_table.php +++ b/database/migrations/2022_07_26_090143_create_goods_table.php @@ -13,6 +13,7 @@ class CreateGoodsTable extends Migration */ public function up() { + Schema::defaultStringLength(191); Schema::create('goods', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('title')->nullable(false); diff --git a/database/migrations/2022_07_26_090150_create_goods_skus_table.php b/database/migrations/2022_07_26_090150_create_goods_skus_table.php index 522319b..468e37b 100644 --- a/database/migrations/2022_07_26_090150_create_goods_skus_table.php +++ b/database/migrations/2022_07_26_090150_create_goods_skus_table.php @@ -13,6 +13,7 @@ class CreateGoodsSkusTable extends Migration */ public function up() { + Schema::defaultStringLength(191); Schema::create('goods_skus', function (Blueprint $table) { $table->bigIncrements('id'); $table->unsignedBigInteger('goods_id')->nullable(false)->comment('商品id'); @@ -28,6 +29,7 @@ class CreateGoodsSkusTable extends Migration $table->unsignedInteger('reserve')->default(0)->comment('预留量'); $table->timestamps(); // 索引 + $table->unique(['goods_id', 'sku_code']); }); } diff --git a/database/migrations/2022_07_28_095523_create_menus_table.php b/database/migrations/2022_07_28_095523_create_menus_table.php index 333dcfe..18bdaea 100644 --- a/database/migrations/2022_07_28_095523_create_menus_table.php +++ b/database/migrations/2022_07_28_095523_create_menus_table.php @@ -13,6 +13,7 @@ class CreateMenusTable extends Migration */ public function up() { + Schema::defaultStringLength(191); Schema::create('menus', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('code', 32)->nullable(false)->comment('菜单编码'); diff --git a/database/migrations/2022_08_02_022448_create_shops_table.php b/database/migrations/2022_08_02_022448_create_shops_table.php index 2cdeb16..5d63e2f 100644 --- a/database/migrations/2022_08_02_022448_create_shops_table.php +++ b/database/migrations/2022_08_02_022448_create_shops_table.php @@ -13,6 +13,7 @@ class CreateShopsTable extends Migration */ public function up() { + Schema::defaultStringLength(191); Schema::create('shops', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name')->unique(); diff --git a/database/migrations/2022_08_05_093629_create_business_orders_table.php b/database/migrations/2022_08_05_093629_create_business_orders_table.php index 69baab2..d82f287 100644 --- a/database/migrations/2022_08_05_093629_create_business_orders_table.php +++ b/database/migrations/2022_08_05_093629_create_business_orders_table.php @@ -16,7 +16,7 @@ class CreateBusinessOrdersTable extends Migration Schema::create('business_orders', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('shop_id'); - $table->bigInteger('activity_no')->nullable(); + $table->string('activity_no')->nullable(); $table->string('activity_title')->nullable(); $table->bigInteger('after_sales_status')->nullable(); $table->string('business_note')->nullable(); From b20abf00d663f93c4bad2f0995422ceaa2871866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Tue, 9 Aug 2022 20:05:19 +0800 Subject: [PATCH 17/33] =?UTF-8?q?feat:=20#10000=20=E8=A7=84=E6=A0=BC?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Goods.php | 8 +++++++- app/Models/GoodsSku.php | 14 +++++++++++++- resources/lang/zh-CN/permission.php | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/Models/Goods.php b/app/Models/Goods.php index f9f9ff2..7919336 100644 --- a/app/Models/Goods.php +++ b/app/Models/Goods.php @@ -15,7 +15,13 @@ class Goods extends Model 'brand_id', ]; - protected $guarded = []; + protected $fillable = [ + 'title', + 'img_url', + 'type_id', + 'brand_id', + 'goods_code', + ]; /** * 多规格 diff --git a/app/Models/GoodsSku.php b/app/Models/GoodsSku.php index 19c1770..0004a6d 100644 --- a/app/Models/GoodsSku.php +++ b/app/Models/GoodsSku.php @@ -19,7 +19,19 @@ class GoodsSku extends Model * * @var array */ - protected $guarded = []; + protected $fillable = [ + 'goods_id', + 'title', + 'sku_code', + 'status', + 'num', + 'stock', + 'cost', + 'two_days_ago_num', + 'yesterday_num', + 'reference_price', + 'reserve', + ]; protected $hidden = ['created_at']; diff --git a/resources/lang/zh-CN/permission.php b/resources/lang/zh-CN/permission.php index 7ac3875..3a59603 100644 --- a/resources/lang/zh-CN/permission.php +++ b/resources/lang/zh-CN/permission.php @@ -37,7 +37,7 @@ return [ 'name' => '规格查看', 'parent_id' => 2, ], - 'goods_skus.udpate' => [ + 'goods_skus.update' => [ 'id' => 25, 'name' => '规格更新', 'parent_id' => 2, From 5475a468af987c5d021209ea891ae5d3b59c8c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Tue, 9 Aug 2022 20:40:39 +0800 Subject: [PATCH 18/33] =?UTF-8?q?feat:=20#10000=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Goods/GoodsSkusController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index ab40a9b..701fab0 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -92,10 +92,15 @@ class GoodsSkusController extends Controller $this->addLog($id, 'update'); // 商品更新 $goods = Goods::query()->find($sku->goods_id); + $this->log = new LogModel([ + 'module' => 'goods', + 'action' => $request->getMethod(), + 'target_type' => 'goods', + ]); $this->setBeforeUpdate($goods->toArray()); $goods->update($request->goods); $this->setAfterUpdate($goods->toArray()); - $this->addLog($sku->goods_id, 'update', 'goods'); + $this->addLog($sku->goods_id, 'update'); DB::commit(); } catch (\Exception $exception) { DB::rollBack(); From 5ebe7b685cdaad9154e21fd188113a3cc7334473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Wed, 10 Aug 2022 16:39:25 +0800 Subject: [PATCH 19/33] =?UTF-8?q?feat:=20#10000=20=E5=A2=9E=E9=87=8F?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Swoole.php | 56 +++++++++++++++++++ ...ns.php => UpdateSuperAdminPermissions.php} | 2 +- app/Console/Kernel.php | 6 +- app/Http/Controllers/Shop/ShopsController.php | 2 - app/Jobs/ProcessPodcast.php | 34 +++++++++++ app/Listeners/UpdateBusinessGoodsStock.php | 16 ++++-- app/Services/Business/BusinessClient.php | 11 ++-- .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 7 ++- app/Services/Business/KuaiTuanTuan/Order.php | 6 +- app/Services/Business/MiaoXuan/Order.php | 4 ++ composer.lock | 4 +- ...03559_create_daily_stock_records_table.php | 3 +- .../2022_08_10_150657_create_jobs_table.php | 36 ++++++++++++ 13 files changed, 165 insertions(+), 22 deletions(-) create mode 100644 app/Console/Commands/Swoole.php rename app/Console/Commands/{UpdateSuperPermissions.php => UpdateSuperAdminPermissions.php} (95%) create mode 100644 app/Jobs/ProcessPodcast.php create mode 100644 database/migrations/2022_08_10_150657_create_jobs_table.php diff --git a/app/Console/Commands/Swoole.php b/app/Console/Commands/Swoole.php new file mode 100644 index 0000000..9e97435 --- /dev/null +++ b/app/Console/Commands/Swoole.php @@ -0,0 +1,56 @@ +where('plat_id', 1)->where('status', 1)->get(); + $endTime = DateTimeUtils::getMicroTime(); + $beginTime = $endTime - 1000; + foreach ($shops as $shop) { + BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 1, '', 'increment'); + } + }); + Event::wait(); + } +} diff --git a/app/Console/Commands/UpdateSuperPermissions.php b/app/Console/Commands/UpdateSuperAdminPermissions.php similarity index 95% rename from app/Console/Commands/UpdateSuperPermissions.php rename to app/Console/Commands/UpdateSuperAdminPermissions.php index c662b0b..5f8b1b0 100644 --- a/app/Console/Commands/UpdateSuperPermissions.php +++ b/app/Console/Commands/UpdateSuperAdminPermissions.php @@ -7,7 +7,7 @@ use Illuminate\Console\Command; use Spatie\Permission\Models\Permission; use Spatie\Permission\Models\Role; -class UpdateSuperPermissions extends Command +class UpdateSuperAdminPermissions extends Command { /** * The name and signature of the console command. diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a8c5158..35c09a0 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -2,6 +2,7 @@ namespace App\Console; +use App\Console\Commands\Inventory; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; @@ -24,8 +25,9 @@ class Kernel extends ConsoleKernel */ protected function schedule(Schedule $schedule) { - // $schedule->command('inspire') - // ->hourly(); + // 服务器添加cron入口 + // * * * * * cd /home/wwwroot/erp.staging.chutang66.com && php artisan schedule:run >> /dev/null 2>&1 + $schedule->command(Inventory::class)->dailyAt('07:00'); } /** diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index e6fc501..a4aee5c 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -89,11 +89,9 @@ class ShopsController extends Controller $business->setShop($shop); if ('goods' === $request->get('type')) { $business->bindGoods($request->get('data')); - event(new BindBusinessGoods($shop)); } if ('orders' === $request->get('type')) { $business->saveOrders(); - event(new UpdateBusinessGoodsStock($shop)); } } } diff --git a/app/Jobs/ProcessPodcast.php b/app/Jobs/ProcessPodcast.php new file mode 100644 index 0000000..6d4df9c --- /dev/null +++ b/app/Jobs/ProcessPodcast.php @@ -0,0 +1,34 @@ +shop = $shop; + $this->shopId = $shopId; + $this->updateOrders = $updateOrders; } /** * Handle the event. * - * @param Registered $event + * @param Registered $event * @return void */ public function handle(Registered $event) { - // + if (empty($this->updateOrders)) { + return; + } } } diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index fa9af39..12dc06c 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -88,18 +88,21 @@ abstract class BusinessClient $res = (new Client())->request('POST', $url, $headers); $size = $res->getBody()->getSize(); $res = json_decode($res->getBody()->getContents(), true); - $log = new Log(); + if ('pdd.ktt.increment.order.query' === $params['type']) { + $log = Log::query()->where('user_id', $this->shop->id)->where('target_field', $params['type'])->first(); + } else { + $log = new Log(); + } $log->module = 'plat'; $log->action = 'POST'; $log->target_type = $this->shop->plat_id; - $log->target_id = $this->skuId; + $log->target_id = $this->getSkuId(); $log->target_field = $params['type']; - $log->user_id = 1; + $log->user_id = $this->shop->id; if ($size < 64000) { $log->message = json_encode($res, 256); } $log->save(); - if (isset($res['error_response'])) { throw new \Exception($res['error_response']['error_msg'], $res['error_response']['error_code']); } diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index c8aae35..b299df8 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -80,13 +80,14 @@ class KuaiTuanTuan extends BusinessClient { if ('increment' === $downloadType) { [$type, $appendParams] = Order::downloadIncrementOrders($beginTime, $endTime, $page); + $responseName = 'ktt_increment_order_query_response'; } else { [$type, $appendParams] = Order::downloadOrders($beginTime, $endTime, $page); + $responseName = 'ktt_order_list_response'; } $res = $this->doRequest($type, $appendParams); - $this->saveOrders($res['ktt_order_list_response']['order_list']); - exit(); - $pageNum = ceil($res['ktt_order_list_response']['total_count'] / $appendParams['size']); + $this->saveOrders($res[$responseName]['order_list']); + $pageNum = ceil($res[$responseName]['total_count'] / $appendParams['page_size']); if ($pageNum > $page && 10 >= $page) { $this->downloadOrdersAndSave($beginTime, $endTime, $page + 1); } diff --git a/app/Services/Business/KuaiTuanTuan/Order.php b/app/Services/Business/KuaiTuanTuan/Order.php index 06ddf58..d9d74f9 100644 --- a/app/Services/Business/KuaiTuanTuan/Order.php +++ b/app/Services/Business/KuaiTuanTuan/Order.php @@ -2,6 +2,7 @@ namespace App\Services\Business\KuaiTuanTuan; +use App\Listeners\UpdateBusinessGoodsStock; use App\Models\BusinessOrder; use App\Models\BusinessOrderItem; @@ -17,7 +18,7 @@ class Order 'confirm_at_begin' => $beginTime, // 成交启始时间, 必填,毫秒时间戳 'confirm_at_end' => $endTime, // 成交结束时间,必填, 毫秒时间戳,成交结束时间 - 成交启始时间 <= 24h 'page_number' => $page, // 页码, 必填 - 'page_size' => 1, // 数量, 必填, 1~100 + 'page_size' => 100, // 数量, 必填, 1~100 // 非必填 // 'activity_no' => $activityNo, // 团号 'after_sales_status' => 0, // 售后状态, 可选 0-未发起售后 1-退款中 2-退款成功 3-待处理 4-拒绝退款 6-待(顾客)退货 7-待(团长)确认退货 8-(顾客)撤销 9-(系统)关闭 @@ -54,12 +55,14 @@ class Order // 下载订单事件之后去统计 然后更新库存 public static function saveOrders(array $orders, $shopId) { + $updateOrders = []; foreach ($orders as $order) { unset($order['custom_item_list'], $order['logistics_list'], $order['gift_order_list']); $orderRecord = BusinessOrder::updateOrCreate( ['shop_id' => $shopId, 'order_sn' => $order['order_sn']], $order ); + $updateOrders[] = $order['order_sn']; foreach ($order['sub_order_list'] as $item) { BusinessOrderItem::updateOrCreate( ['shop_id' => $shopId, 'business_order_id' => $orderRecord->id, 'goods_id' => $item['goods_id'], 'sku_id' => $item['sku_id']], @@ -67,6 +70,7 @@ class Order ); } } + event(new UpdateBusinessGoodsStock($shopId, $updateOrders)); } } diff --git a/app/Services/Business/MiaoXuan/Order.php b/app/Services/Business/MiaoXuan/Order.php index 07278fa..89c6e73 100644 --- a/app/Services/Business/MiaoXuan/Order.php +++ b/app/Services/Business/MiaoXuan/Order.php @@ -2,6 +2,7 @@ namespace App\Services\Business\MiaoXuan; +use App\Listeners\UpdateBusinessGoodsStock; use App\Models\BusinessOrder; class Order @@ -9,11 +10,13 @@ class Order // 下载订单事件之后去统计 然后更新库存 public static function saveOrders(array $orders, $shopId) { + $updateOrders = []; foreach ($orders as $order) { $orderRecord = BusinessOrder::updateOrCreate( ['shop_id' => $shopId, 'order_sn' => $order['order_sn']], $order ); + $updateOrders[] = $order['order_sn']; foreach ($order['sub_order_list'] as $item) { $orderRecord = BusinessOrder::updateOrCreate( ['shop_id' => $shopId, 'business_order_id' => $orderRecord->id, 'goods_id' => $item['goods_id'], 'sku_id' => $item['sku_id']], @@ -21,6 +24,7 @@ class Order ); } } + event(new UpdateBusinessGoodsStock($shopId, $updateOrders)); } } diff --git a/composer.lock b/composer.lock index 1e34c06..4c69252 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "5a01163bdf570af5226c567ad02f45d7", + "content-hash": "037b06c1b26399725a1d9c0687402942", "packages": [ { "name": "aliyuncs/oss-sdk-php", @@ -9110,7 +9110,7 @@ "prefer-lowest": false, "platform": { "php": "^7.2.5|^8.0", - "ext-json": "^1.7" + "ext-json": "*" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git a/database/migrations/2022_07_26_103559_create_daily_stock_records_table.php b/database/migrations/2022_07_26_103559_create_daily_stock_records_table.php index 894332f..3b1c792 100644 --- a/database/migrations/2022_07_26_103559_create_daily_stock_records_table.php +++ b/database/migrations/2022_07_26_103559_create_daily_stock_records_table.php @@ -20,8 +20,9 @@ class CreateDailyStockRecordsTable extends Migration $table->unsignedInteger('arrived_today_num')->default(0)->comment('今日到货'); $table->unsignedInteger('loss_num')->default(0)->comment('损耗'); $table->unsignedInteger('inventory')->default(0)->comment('库存盘点'); - $table->unique(['sku_id', 'day']); $table->timestamps(); + // 索引 + $table->unique(['sku_id', 'day']); }); } diff --git a/database/migrations/2022_08_10_150657_create_jobs_table.php b/database/migrations/2022_08_10_150657_create_jobs_table.php new file mode 100644 index 0000000..1be9e8a --- /dev/null +++ b/database/migrations/2022_08_10_150657_create_jobs_table.php @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('jobs'); + } +} From a47fbb2622302026cacaca03bee2edf66bf55ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Wed, 10 Aug 2022 23:45:03 +0800 Subject: [PATCH 20/33] =?UTF-8?q?feat:=20#10000=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Log/LogsController.php | 1 + app/Http/Controllers/Role/RolesController.php | 2 +- app/Http/Controllers/Shop/ShopsController.php | 3 +++ app/Models/BusinessOrder.php | 5 ++++ app/Models/BusinessOrderItem.php | 26 ++++++++++++++++++- .../2022_08_02_022448_create_shops_table.php | 2 +- database/seeds/MenusTableSeeder.php | 2 +- resources/lang/zh-CN/permission.php | 20 +++++++------- 8 files changed, 47 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/Log/LogsController.php b/app/Http/Controllers/Log/LogsController.php index f0441f6..cd74e76 100644 --- a/app/Http/Controllers/Log/LogsController.php +++ b/app/Http/Controllers/Log/LogsController.php @@ -12,6 +12,7 @@ class LogsController extends Controller public function index(Request $request) { $res = Log::query() + ->orderBy('id', 'desc') ->with(['user:id,name']) ->filter() ->paginate(); diff --git a/app/Http/Controllers/Role/RolesController.php b/app/Http/Controllers/Role/RolesController.php index 1e592c7..6338fd8 100644 --- a/app/Http/Controllers/Role/RolesController.php +++ b/app/Http/Controllers/Role/RolesController.php @@ -24,7 +24,7 @@ class RolesController extends Controller public function index() { - $roles = Role::query()->with('permissions')->get()->toArray(); + $roles = Role::query()->with('permissions')->where('id', '<>', 1)->get()->toArray(); $routes = include(resource_path('lang/zh-CN/permission.php')); foreach ($roles as &$role) { $permissions = []; diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index a4aee5c..ee8c0bf 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -48,6 +48,9 @@ class ShopsController extends Controller $shop = new Shop(); $shop->name = $request->name; $shop->plat_id = $request->plat_id; + if (0 === $request->plat_id) { + $shop->status = 2; + } $shop->save(); return response($this->res, $this->res['httpCode']); diff --git a/app/Models/BusinessOrder.php b/app/Models/BusinessOrder.php index 42d4f73..913a45a 100644 --- a/app/Models/BusinessOrder.php +++ b/app/Models/BusinessOrder.php @@ -45,4 +45,9 @@ class BusinessOrder extends Model 'nick_name', 'order_sn', ]; + + public function items() + { + return $this->hasMany(BusinessOrderItem::class, 'business_order_id'); + } } diff --git a/app/Models/BusinessOrderItem.php b/app/Models/BusinessOrderItem.php index daa3675..19015e3 100644 --- a/app/Models/BusinessOrderItem.php +++ b/app/Models/BusinessOrderItem.php @@ -9,7 +9,31 @@ class BusinessOrderItem extends Model * * @var array */ - protected $guarded = []; + protected $fillable = [ + 'shop_id', + 'business_order_id', + 'already_cancel_number', + 'cancel_status', + 'category_name', + 'external_sku_id', + 'goods_amount', + 'goods_cost_price', + 'goods_id', + 'goods_name', + 'goods_number', + 'goods_price', + 'goods_purchase_price', + 'goods_specification', + 'help_sell_amount', + 'is_supplier', + 'need_verification_number', + 'shipping_status', + 'sku_id', + 'sub_order_sn', + 'theoretically_refund_amount', + 'thumb_url', + 'verification_number', + ]; public function order() { diff --git a/database/migrations/2022_08_02_022448_create_shops_table.php b/database/migrations/2022_08_02_022448_create_shops_table.php index 5d63e2f..8364f24 100644 --- a/database/migrations/2022_08_02_022448_create_shops_table.php +++ b/database/migrations/2022_08_02_022448_create_shops_table.php @@ -28,7 +28,7 @@ class CreateShopsTable extends Migration $table->unsignedInteger('refresh_token_expires_in')->nullable()->comment('refresh_token过期时间段,10表示10秒后过期'); $table->text('scope')->nullable()->comment('接口列表'); $table->text('pop_auth_token_create_response')->nullable()->comment('授权认证信息'); - $table->string('status')->default(0)->comment('状态'); + $table->unsignedTinyInteger('status')->default(0)->comment('状态'); $table->softDeletes(); $table->timestamps(); }); diff --git a/database/seeds/MenusTableSeeder.php b/database/seeds/MenusTableSeeder.php index d968742..c260c8e 100644 --- a/database/seeds/MenusTableSeeder.php +++ b/database/seeds/MenusTableSeeder.php @@ -27,7 +27,7 @@ class MenusTableSeeder extends Seeder $id = DB::table('menus')->insertGetId(['parent_id' => 0,'code' => 'SYSTEM_MANAGE', 'name' => '系统管理', 'seq' => 3]); DB::table('menus')->insert([ ['parent_id' => $id,'code' => 'ROLE_MANAGE', 'name' => '角色管理', 'seq' => 0], - ['parent_id' => $id,'code' => 'PERMISSION_MANAGE', 'name' => '权限管理', 'seq' => 1], +// ['parent_id' => $id,'code' => 'PERMISSION_MANAGE', 'name' => '权限管理', 'seq' => 1], ]); // 系统日志 DB::table('menus')->insertGetId(['parent_id' => 0,'code' => 'SYSTEM_LOG', 'name' => '系统日志', 'seq' => 4]); diff --git a/resources/lang/zh-CN/permission.php b/resources/lang/zh-CN/permission.php index 3a59603..6d487bb 100644 --- a/resources/lang/zh-CN/permission.php +++ b/resources/lang/zh-CN/permission.php @@ -210,16 +210,16 @@ return [ 'name' => '设置权限', 'parent_id' => 8, ], - 'PERMISSION_MANAGE' => [ - 'id' => 9, - 'name' => '权限管理', - 'parent_id' => 7, - ], - 'permissions.index' => [ - 'id' => 90, - 'name' => '列表', - 'parent_id' => 9, - ], +// 'PERMISSION_MANAGE' => [ +// 'id' => 9, +// 'name' => '权限管理', +// 'parent_id' => 7, +// ], +// 'permissions.index' => [ +// 'id' => 90, +// 'name' => '列表', +// 'parent_id' => 9, +// ], // 系统日志 'SYSTEM_LOG' => [ 'id' => 10, From 4819f823e4fe93174091f1c535cbb12d669aca5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 02:13:19 +0800 Subject: [PATCH 21/33] =?UTF-8?q?feat:=20#10000=20=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=90=8C=E6=AD=A5=E5=BA=93=E5=AD=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Swoole.php | 2 +- app/Console/Commands/Test.php | 6 +- app/Http/Controllers/Shop/ShopsController.php | 2 +- app/Listeners/UpdateBusinessGoodsStock.php | 39 ++++++++-- app/Services/Business/BusinessClient.php | 73 ++++++++++++++++--- .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 34 +++------ app/Services/Business/KuaiTuanTuan/Order.php | 33 +-------- app/Services/Business/MiaoXuan/MiaoXuan.php | 13 +--- app/Services/Business/MiaoXuan/Order.php | 22 ------ 9 files changed, 117 insertions(+), 107 deletions(-) diff --git a/app/Console/Commands/Swoole.php b/app/Console/Commands/Swoole.php index 9e97435..ecc9494 100644 --- a/app/Console/Commands/Swoole.php +++ b/app/Console/Commands/Swoole.php @@ -48,7 +48,7 @@ class Swoole extends Command $endTime = DateTimeUtils::getMicroTime(); $beginTime = $endTime - 1000; foreach ($shops as $shop) { - BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 1, '', 'increment'); + BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 'increment', 1); } }); Event::wait(); diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index dde17fa..619eb6b 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -53,9 +53,9 @@ class Test extends Command // $business->incrQuantity(1); // 订单下载 - $beginTime = DateTimeUtils::getMicroTime('2022-08-08'); - $endTime = DateTimeUtils::getMicroTime('2022-08-09'); - $business->downloadOrdersAndSave($beginTime, $endTime); +// $beginTime = DateTimeUtils::getMicroTime('2022-08-08'); +// $endTime = DateTimeUtils::getMicroTime('2022-08-09'); +// $business->downloadOrdersAndSave($beginTime, $endTime); $this->info('执行测试成功'); } diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index ee8c0bf..872a4d9 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -94,7 +94,7 @@ class ShopsController extends Controller $business->bindGoods($request->get('data')); } if ('orders' === $request->get('type')) { - $business->saveOrders(); + $business->saveOrders($request->get('data')); } } } diff --git a/app/Listeners/UpdateBusinessGoodsStock.php b/app/Listeners/UpdateBusinessGoodsStock.php index 2d6bfaa..8f99cbf 100644 --- a/app/Listeners/UpdateBusinessGoodsStock.php +++ b/app/Listeners/UpdateBusinessGoodsStock.php @@ -2,25 +2,29 @@ namespace App\Listeners; +use App\Models\GoodsSku; +use App\Models\Log; use App\Models\Shop; +use App\Services\Business\BusinessFactory; use Illuminate\Auth\Events\Registered; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; +use App\Models\BusinessOrderItem; class UpdateBusinessGoodsStock implements ShouldQueue { - protected $shopId; - protected $updateOrders; + protected $num; + protected $businessOrderItem; /** * Create the event listener. * * @return void */ - public function __construct($shopId, $updateOrders) + public function __construct(BusinessOrderItem $item, $num) { - $this->shopId = $shopId; - $this->updateOrders = $updateOrders; + $this->businessOrderItem = $item; + $this->num = $num; } /** @@ -31,8 +35,29 @@ class UpdateBusinessGoodsStock implements ShouldQueue */ public function handle(Registered $event) { - if (empty($this->updateOrders)) { - return; + $shops = Shop::query()->where('id', '<>', $this->businessOrderItem->shop_id)->where('status', 1)->get(['id', 'plat_id']); + [$goodsCode, $skuCode] = explode('_', $this->businessOrderItem->external_sku_id); + $goodsSku = GoodsSku::query()->where('sku_code', $skuCode) + ->with(['goods' => function ($query) use ($goodsCode) { + $query->where('goods_code', $goodsCode); + }]) + ->first(); + if ($goodsSku) { + $goodsSku->stock += $this->num; + $goodsSku->save(); + foreach ($shops as $shop) { + BusinessFactory::init()->make($shop['plat_id'])->setShopId($shop['id'])->incrQuantity($this->businessOrderItem, $this->num, true, $goodsSku); + } + } else { + $log = new Log(); + $log->module = 'goods'; + $log->action = 'PATCH'; + $log->target_type = 'goods_sku'; + $log->target_id = $goodsSku->id; + $log->target_field = 'stock'; + $log->user_id = $this->businessOrderItem->shop_id; + $log->message = ($this->businessOrderItem->external_sku_id ?: '商品') . '未找到'; + $log->save(); } } } diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index 12dc06c..be66a2a 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -2,6 +2,10 @@ namespace App\Services\Business; +use App\Listeners\UpdateBusinessGoodsStock; +use App\Models\BusinessGoodsSku; +use App\Models\BusinessOrder; +use App\Models\GoodsSku; use App\Models\Log; use App\Models\Shop; use GuzzleHttp\Client; @@ -21,11 +25,60 @@ abstract class BusinessClient abstract public function bindGoods($goods); - abstract public function incrQuantity($skuId); + abstract public function incrQuantity(BusinessGoodsSku $businessGoodsSku, $num, $incremental, GoodsSku $goodsSku); - abstract public function downloadOrdersAndSave($beginTime, $endTime, $page = 1, $activityNo = '', $downloadType = 'default'); + abstract public function downloadOrdersAndSave($beginTime, $endTime, $downloadType = 'default', $page = 1); - abstract public function saveOrders($orders); + public function saveOrders($orders) + { + $shopId = $this->getShop()->id; + foreach ($orders as $order) { + unset($order['custom_item_list'], $order['logistics_list'], $order['gift_order_list']); + $order['shop_id'] = $shopId; + $orderRecord = BusinessOrder::query()->where('shop_id', $shopId)->where('order_sn', $order['order_sn'])->first(); + if (empty($orderRecord)) { + $orderRecord->create($order); + } else { + $orderRecord->update($order); + } + foreach ($order['sub_order_list'] as $item) { + $item['shop_id'] = $shopId; + $orderItem = BusinessOrder::query()->where('shop_id', $shopId) + ->where('business_order_id', $orderRecord->id) + ->where('goods_id', $item['goods_id']) + ->where('sku_id', $item['sku_id']) + ->first(); + $num = 0; + if (empty($orderItem)) { + if ($item['cancel_status']) { + if ($num = $item['goods_number'] - $item['already_cancel_number']) { + // 扣库存 $reduceNum + $num = 0 - $num; + } + } else { + // 扣库存 + $num = 0 - $item['goods_number']; + } + $orderItem->create($item); + } else { + if ($item['cancel_status'] !== $orderItem->cancel_status) { + if ($item['cancel_status']) { + // 加库存 + $num = $item['already_cancel_number']; + } else { + // 扣库存 + $num = 0 - $item['goods_number']; + } + } + $orderItem->update($item); + } + // 增量更新库存 + if ($num) { + event(new UpdateBusinessGoodsStock($orderItem, $num)); + } + } + } + } public function authCallback($code, $shopId) { @@ -81,31 +134,29 @@ abstract class BusinessClient public function formDataPostRequest($url, $params) { + $method = 'POST'; $headers = [ 'headers' => ['Content-type' => 'application/x-www-form-urlencoded;charset=UTF-8'], 'form_params' => $params ]; - $res = (new Client())->request('POST', $url, $headers); + $res = (new Client())->request($method, $url, $headers); $size = $res->getBody()->getSize(); $res = json_decode($res->getBody()->getContents(), true); if ('pdd.ktt.increment.order.query' === $params['type']) { - $log = Log::query()->where('user_id', $this->shop->id)->where('target_field', $params['type'])->first(); + $log = Log::query()->where('user_id', $this->getShop()->id)->where('target_field', $params['type'])->first(); } else { $log = new Log(); } $log->module = 'plat'; - $log->action = 'POST'; - $log->target_type = $this->shop->plat_id; + $log->action = $method; + $log->target_type = $this->getShop()->plat_id; $log->target_id = $this->getSkuId(); $log->target_field = $params['type']; - $log->user_id = $this->shop->id; + $log->user_id = $this->getShop()->id; if ($size < 64000) { $log->message = json_encode($res, 256); } $log->save(); - if (isset($res['error_response'])) { - throw new \Exception($res['error_response']['error_msg'], $res['error_response']['error_code']); - } return $res; } diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index b299df8..7f2bcf1 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -55,14 +55,9 @@ class KuaiTuanTuan extends BusinessClient Goods::bindGoods($goods, $this->shop->id); } - public function incrQuantity($skuId) + public function incrQuantity($businessGoodsSku, $num, $incremental, GoodsSku $goodsSku) { - $goodsSku = GoodsSku::query() - ->with(['goods:id,goods_code']) - ->find($skuId); - $code = $goodsSku->goods->goods_code . '_' . $goodsSku->sku_code; - $business = BusinessGoodsSku::query()->where('shop_id', $this->shop->id)->where('external_sku_id', $code)->first(['goods_id', 'sku_id']); - [$type, $appendParams] = Goods::incrQuantity($business->goods_id, $goodsSku->stock, $business->sku_id); + [$type, $appendParams] = Goods::incrQuantity($businessGoodsSku->goods_id, $num, $businessGoodsSku->sku_id, $incremental ? 1 : 2); $this->doRequest($type, $appendParams); } @@ -72,11 +67,10 @@ class KuaiTuanTuan extends BusinessClient * @param $beginTime * @param $endTime * @param int $page - * @param string $activityNo * @param string $downloadType - * @return mixed + * @return void */ - public function downloadOrdersAndSave($beginTime, $endTime, $page = 1, $activityNo = '', $downloadType = 'default') + public function downloadOrdersAndSave($beginTime, $endTime, $downloadType = 'default', $page = 1) { if ('increment' === $downloadType) { [$type, $appendParams] = Order::downloadIncrementOrders($beginTime, $endTime, $page); @@ -93,11 +87,6 @@ class KuaiTuanTuan extends BusinessClient } } - public function saveOrders($orders) - { - Order::saveOrders($orders, $this->shop->id); - } - protected function getAccessTokenWithCode() { $type = 'pdd.pop.auth.token.create'; @@ -134,14 +123,6 @@ class KuaiTuanTuan extends BusinessClient return $this->formDataPostRequest($url, $publicParams); } - - public function getAuthUrl($shopId, $platId) - { - $state = $shopId . '_' . $platId; - - return "https://oauth.pinduoduo.com/authorize/ktt?client_id={$this->clientId}&redirect_uri={$this->redirectUri}&state={$state}"; - } - public function downloadGoods($skuId) { $goodsSku = GoodsSku::query() @@ -154,4 +135,11 @@ class KuaiTuanTuan extends BusinessClient $goods = $res['response']['result']; $this->bindGoods([$goods]); } + + public function getAuthUrl($shopId, $platId) + { + $state = $shopId . '_' . $platId; + + return "https://oauth.pinduoduo.com/authorize/ktt?client_id={$this->clientId}&redirect_uri={$this->redirectUri}&state={$state}"; + } } diff --git a/app/Services/Business/KuaiTuanTuan/Order.php b/app/Services/Business/KuaiTuanTuan/Order.php index d9d74f9..6fcdbc5 100644 --- a/app/Services/Business/KuaiTuanTuan/Order.php +++ b/app/Services/Business/KuaiTuanTuan/Order.php @@ -2,10 +2,6 @@ namespace App\Services\Business\KuaiTuanTuan; -use App\Listeners\UpdateBusinessGoodsStock; -use App\Models\BusinessOrder; -use App\Models\BusinessOrderItem; - class Order { /** @@ -21,8 +17,8 @@ class Order 'page_size' => 100, // 数量, 必填, 1~100 // 非必填 // 'activity_no' => $activityNo, // 团号 - 'after_sales_status' => 0, // 售后状态, 可选 0-未发起售后 1-退款中 2-退款成功 3-待处理 4-拒绝退款 6-待(顾客)退货 7-待(团长)确认退货 8-(顾客)撤销 9-(系统)关闭 - 'cancel_status' => 0, // 取消状态, 可选 0-未取消 1-已取消 +// 'after_sales_status' => 0, // 售后状态, 可选 0-未发起售后 1-退款中 2-退款成功 3-待处理 4-拒绝退款 6-待(顾客)退货 7-待(团长)确认退货 8-(顾客)撤销 9-(系统)关闭 +// 'cancel_status' => 0, // 取消状态, 可选 0-未取消 1-已取消 // 'shipping_status' => '', // 发货状态 0-未发货 1-已发货 2-部分发货 3-已收货 // 'verification_status' => '', // 核销状态, 可选 0-未核销 1-已核销 2-部分核销 ]; @@ -43,34 +39,13 @@ class Order 'page_size' => 100, // 数量 // 非必填 // 'activity_no' => $activityNo, // 团号 - 'after_sales_status' => 0, // 售后状态, 可选 0-未发起售后 1-退款中 2-退款成功 3-待处理 4-拒绝退款 6-待(顾客)退货 7-待(团长)确认退货 8-(顾客)撤销 9-(系统)关闭 - 'cancel_status' => 0, // 取消状态, 可选 0-未取消 1-已取消 +// 'after_sales_status' => 0, // 售后状态, 可选 0-未发起售后 1-退款中 2-退款成功 3-待处理 4-拒绝退款 6-待(顾客)退货 7-待(团长)确认退货 8-(顾客)撤销 9-(系统)关闭 +// 'cancel_status' => 0, // 取消状态, 可选 0-未取消 1-已取消 // 'shipping_status' => '', // 发货状态 0-未发货 1-已发货 2-部分发货 3-已收货 // 'verification_status' => '', // 核销状态, 可选 0-未核销 1-已核销 2-部分核销 ]; return [$type, $appendParams]; } - - // 下载订单事件之后去统计 然后更新库存 - public static function saveOrders(array $orders, $shopId) - { - $updateOrders = []; - foreach ($orders as $order) { - unset($order['custom_item_list'], $order['logistics_list'], $order['gift_order_list']); - $orderRecord = BusinessOrder::updateOrCreate( - ['shop_id' => $shopId, 'order_sn' => $order['order_sn']], - $order - ); - $updateOrders[] = $order['order_sn']; - foreach ($order['sub_order_list'] as $item) { - BusinessOrderItem::updateOrCreate( - ['shop_id' => $shopId, 'business_order_id' => $orderRecord->id, 'goods_id' => $item['goods_id'], 'sku_id' => $item['sku_id']], - $item - ); - } - } - event(new UpdateBusinessGoodsStock($shopId, $updateOrders)); - } } diff --git a/app/Services/Business/MiaoXuan/MiaoXuan.php b/app/Services/Business/MiaoXuan/MiaoXuan.php index 7abbdff..7840e27 100644 --- a/app/Services/Business/MiaoXuan/MiaoXuan.php +++ b/app/Services/Business/MiaoXuan/MiaoXuan.php @@ -24,24 +24,17 @@ class MiaoXuan extends BusinessClient Goods::bindGoods($goods, $this->shop->id); } - public function incrQuantity($skuId) + public function incrQuantity($businessGoodsSku, $num, $incremental, GoodsSku $goodsSku) { - $goodsSku = GoodsSku::query()->find($skuId); - $business = BusinessGoodsSku::query()->where('shop_id', $this->shop->id)->where('self_sku_id', $skuId)->first(['goods_id', 'sku_id', 'external_sku_id'])->toArray(); - $appendParams = Goods::incrQuantity($this->shop->id, $goodsSku->stock, $business); + $appendParams = Goods::incrQuantity($this->shop->id, $goodsSku->stock, $businessGoodsSku); $url = 'http://shop.chutang66.com/miaoxuan/stock'; $this->formDataPostRequest($url, $appendParams); } - public function downloadOrdersAndSave($beginTime, $endTime, $page = 1, $activityNo = '', $downloadType = 'default') + public function downloadOrdersAndSave($beginTime, $endTime, $downloadType = 'default', $page = 1) { } - public function saveOrders($orders) - { - Order::saveOrders($orders, $this->shop->id); - } - public function downloadGoods($skuId) { // TODO: Implement downloadGoods() method. diff --git a/app/Services/Business/MiaoXuan/Order.php b/app/Services/Business/MiaoXuan/Order.php index 89c6e73..43c0e9e 100644 --- a/app/Services/Business/MiaoXuan/Order.php +++ b/app/Services/Business/MiaoXuan/Order.php @@ -2,29 +2,7 @@ namespace App\Services\Business\MiaoXuan; -use App\Listeners\UpdateBusinessGoodsStock; -use App\Models\BusinessOrder; - class Order { - // 下载订单事件之后去统计 然后更新库存 - public static function saveOrders(array $orders, $shopId) - { - $updateOrders = []; - foreach ($orders as $order) { - $orderRecord = BusinessOrder::updateOrCreate( - ['shop_id' => $shopId, 'order_sn' => $order['order_sn']], - $order - ); - $updateOrders[] = $order['order_sn']; - foreach ($order['sub_order_list'] as $item) { - $orderRecord = BusinessOrder::updateOrCreate( - ['shop_id' => $shopId, 'business_order_id' => $orderRecord->id, 'goods_id' => $item['goods_id'], 'sku_id' => $item['sku_id']], - $item - ); - } - } - event(new UpdateBusinessGoodsStock($shopId, $updateOrders)); - } } From a7842b850df81288b84fd4fd4033e7a6f3df7e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 04:06:38 +0800 Subject: [PATCH 22/33] =?UTF-8?q?feat:=20#1000=20=E5=A6=99=E9=80=89?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Shop/ShopsController.php | 4 +++- app/Services/Business/BusinessFactory.php | 2 ++ app/Services/Business/MiaoXuan/MiaoXuan.php | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index 872a4d9..674ec89 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -48,7 +48,7 @@ class ShopsController extends Controller $shop = new Shop(); $shop->name = $request->name; $shop->plat_id = $request->plat_id; - if (0 === $request->plat_id) { + if (0 == $request->plat_id) { $shop->status = 2; } $shop->save(); @@ -96,5 +96,7 @@ class ShopsController extends Controller if ('orders' === $request->get('type')) { $business->saveOrders($request->get('data')); } + + return response(['Code' => 10000, 'Message' => 'SUCCESS']); } } diff --git a/app/Services/Business/BusinessFactory.php b/app/Services/Business/BusinessFactory.php index b34277c..c160d3a 100644 --- a/app/Services/Business/BusinessFactory.php +++ b/app/Services/Business/BusinessFactory.php @@ -3,6 +3,7 @@ namespace App\Services\Business; use App\Services\Business\KuaiTuanTuan\KuaiTuanTuan; +use App\Services\Business\MiaoXuan\MiaoXuan; class BusinessFactory { @@ -11,6 +12,7 @@ class BusinessFactory public function __construct() { $this->platList['快团团'] = KuaiTuanTuan::class; + $this->platList['妙选'] = MiaoXuan::class; } public function make($platName) diff --git a/app/Services/Business/MiaoXuan/MiaoXuan.php b/app/Services/Business/MiaoXuan/MiaoXuan.php index 7840e27..f2e64ae 100644 --- a/app/Services/Business/MiaoXuan/MiaoXuan.php +++ b/app/Services/Business/MiaoXuan/MiaoXuan.php @@ -2,9 +2,7 @@ namespace App\Services\Business\MiaoXuan; -use App\Models\BusinessGoodsSku; use App\Models\GoodsSku; -use App\Models\Log; use App\Services\Business\BusinessClient; class MiaoXuan extends BusinessClient From 804162083bef07b73684412ee15a9d9c6a354fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 05:11:14 +0800 Subject: [PATCH 23/33] =?UTF-8?q?feat:=20#10000=20=E5=A6=99=E9=80=89?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=8E=A8=E9=80=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Listeners/UpdateBusinessGoodsStock.php | 3 +++ app/Services/Business/BusinessClient.php | 17 +++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Listeners/UpdateBusinessGoodsStock.php b/app/Listeners/UpdateBusinessGoodsStock.php index 8f99cbf..9c54e2b 100644 --- a/app/Listeners/UpdateBusinessGoodsStock.php +++ b/app/Listeners/UpdateBusinessGoodsStock.php @@ -36,6 +36,9 @@ class UpdateBusinessGoodsStock implements ShouldQueue public function handle(Registered $event) { $shops = Shop::query()->where('id', '<>', $this->businessOrderItem->shop_id)->where('status', 1)->get(['id', 'plat_id']); + if (empty($shops)) { + return; + } [$goodsCode, $skuCode] = explode('_', $this->businessOrderItem->external_sku_id); $goodsSku = GoodsSku::query()->where('sku_code', $skuCode) ->with(['goods' => function ($query) use ($goodsCode) { diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index be66a2a..d1392ed 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -5,6 +5,7 @@ namespace App\Services\Business; use App\Listeners\UpdateBusinessGoodsStock; use App\Models\BusinessGoodsSku; use App\Models\BusinessOrder; +use App\Models\BusinessOrderItem; use App\Models\GoodsSku; use App\Models\Log; use App\Models\Shop; @@ -35,21 +36,17 @@ abstract class BusinessClient foreach ($orders as $order) { unset($order['custom_item_list'], $order['logistics_list'], $order['gift_order_list']); $order['shop_id'] = $shopId; - $orderRecord = BusinessOrder::query()->where('shop_id', $shopId)->where('order_sn', $order['order_sn'])->first(); - if (empty($orderRecord)) { - $orderRecord->create($order); + $orderRecord = BusinessOrder::firstOrNew(['shop_id' => $shopId, 'order_sn' => $order['order_sn']], $order); + if (empty($orderRecord->id)) { + $orderRecord->save(); } else { $orderRecord->update($order); } foreach ($order['sub_order_list'] as $item) { $item['shop_id'] = $shopId; - $orderItem = BusinessOrder::query()->where('shop_id', $shopId) - ->where('business_order_id', $orderRecord->id) - ->where('goods_id', $item['goods_id']) - ->where('sku_id', $item['sku_id']) - ->first(); + $orderItem = BusinessOrderItem::firstOrNew(['shop_id' => $shopId, 'business_order_id' => $orderRecord->id, 'goods_id' => $item['goods_id'], 'sku_id' => $item['sku_id']], $item); $num = 0; - if (empty($orderItem)) { + if (empty($orderItem->id)) { if ($item['cancel_status']) { if ($num = $item['goods_number'] - $item['already_cancel_number']) { // 扣库存 $reduceNum @@ -59,7 +56,7 @@ abstract class BusinessClient // 扣库存 $num = 0 - $item['goods_number']; } - $orderItem->create($item); + $orderItem->save(); } else { if ($item['cancel_status'] !== $orderItem->cancel_status) { if ($item['cancel_status']) { From 1a22edfd0590755756028b265e366a9491768d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 11:18:21 +0800 Subject: [PATCH 24/33] =?UTF-8?q?feat:=20#10000=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=A2=9E=E5=8A=A0=E4=BA=8B=E4=BB=B6=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E5=92=8C=E4=BB=BB=E5=8A=A1=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Events/BusinessOrdersUpdate.php | 58 + app/Http/Controllers/Shop/ShopsController.php | 2 - app/Jobs/BusinessGoodsSkuIncrQuantity.php | 45 + app/Jobs/ProcessPodcast.php | 34 - app/Listeners/SendDatabaseNotification.php | 14 +- app/Listeners/UpdateBusinessGoodsStock.php | 50 +- app/Providers/EventServiceProvider.php | 11 +- app/Services/Business/BusinessClient.php | 4 +- composer.lock | 1106 +++++++---------- 9 files changed, 557 insertions(+), 767 deletions(-) create mode 100644 app/Events/BusinessOrdersUpdate.php create mode 100644 app/Jobs/BusinessGoodsSkuIncrQuantity.php delete mode 100644 app/Jobs/ProcessPodcast.php diff --git a/app/Events/BusinessOrdersUpdate.php b/app/Events/BusinessOrdersUpdate.php new file mode 100644 index 0000000..480653b --- /dev/null +++ b/app/Events/BusinessOrdersUpdate.php @@ -0,0 +1,58 @@ +businessOrderItem = $item; + $this->num = $num; + $this->updateStock(); + } + + private function updateStock() + { + [$goodsCode, $skuCode] = explode('_', $this->businessOrderItem->external_sku_id); + $this->goodsSku = GoodsSku::query()->where('sku_code', $skuCode) + ->with(['goods' => function ($query) use ($goodsCode) { + $query->where('goods_code', $goodsCode); + }]) + ->first(); + if ($this->goodsSku) { + $this->goodsSku->stock += $this->num; + $this->goodsSku->save(); + } + } + + /** + * Get the channels the event should broadcast on. + * + * @return \Illuminate\Broadcasting\Channel|array + */ + public function broadcastOn() + { + return new PrivateChannel('channel-name'); + } +} diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index 674ec89..3f79c8e 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -3,8 +3,6 @@ namespace App\Http\Controllers\Shop; use App\Http\Controllers\Controller; -use App\Listeners\BindBusinessGoods; -use App\Listeners\UpdateBusinessGoodsStock; use App\Models\Shop; use App\Http\Resources\ShopsResource; use Illuminate\Http\Request; diff --git a/app/Jobs/BusinessGoodsSkuIncrQuantity.php b/app/Jobs/BusinessGoodsSkuIncrQuantity.php new file mode 100644 index 0000000..ca1da28 --- /dev/null +++ b/app/Jobs/BusinessGoodsSkuIncrQuantity.php @@ -0,0 +1,45 @@ +shop = $shop; + $this->businessOrderItem = $businessOrderItem; + $this->num = $num; + $this->goodsSku = $goodsSku; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + BusinessFactory::init()->make($this->shop['plat_id'])->setShopId($this->shop['id'])->incrQuantity($this->businessOrderItem, $this->num, true, $this->goodsSku); + } +} diff --git a/app/Jobs/ProcessPodcast.php b/app/Jobs/ProcessPodcast.php deleted file mode 100644 index 6d4df9c..0000000 --- a/app/Jobs/ProcessPodcast.php +++ /dev/null @@ -1,34 +0,0 @@ -= $event->goodsSku->stock) { + // 发送通知给管理员 + } } } diff --git a/app/Listeners/UpdateBusinessGoodsStock.php b/app/Listeners/UpdateBusinessGoodsStock.php index 9c54e2b..92c370f 100644 --- a/app/Listeners/UpdateBusinessGoodsStock.php +++ b/app/Listeners/UpdateBusinessGoodsStock.php @@ -2,65 +2,55 @@ namespace App\Listeners; -use App\Models\GoodsSku; use App\Models\Log; use App\Models\Shop; use App\Services\Business\BusinessFactory; -use Illuminate\Auth\Events\Registered; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; -use App\Models\BusinessOrderItem; +use App\Events\BusinessOrdersUpdate; +use App\Jobs\BusinessGoodsSkuIncrQuantity; class UpdateBusinessGoodsStock implements ShouldQueue { - protected $num; - protected $businessOrderItem; + use InteractsWithQueue; /** * Create the event listener. * * @return void */ - public function __construct(BusinessOrderItem $item, $num) + public function __construct() { - $this->businessOrderItem = $item; - $this->num = $num; + // } /** * Handle the event. * - * @param Registered $event + * @param BusinessOrdersUpdate $event * @return void */ - public function handle(Registered $event) + public function handle(BusinessOrdersUpdate $event) { - $shops = Shop::query()->where('id', '<>', $this->businessOrderItem->shop_id)->where('status', 1)->get(['id', 'plat_id']); - if (empty($shops)) { - return; - } - [$goodsCode, $skuCode] = explode('_', $this->businessOrderItem->external_sku_id); - $goodsSku = GoodsSku::query()->where('sku_code', $skuCode) - ->with(['goods' => function ($query) use ($goodsCode) { - $query->where('goods_code', $goodsCode); - }]) - ->first(); - if ($goodsSku) { - $goodsSku->stock += $this->num; - $goodsSku->save(); - foreach ($shops as $shop) { - BusinessFactory::init()->make($shop['plat_id'])->setShopId($shop['id'])->incrQuantity($this->businessOrderItem, $this->num, true, $goodsSku); - } - } else { + if (empty($event->goodsSku)) { $log = new Log(); $log->module = 'goods'; $log->action = 'PATCH'; $log->target_type = 'goods_sku'; - $log->target_id = $goodsSku->id; + $log->target_id = $event->goodsSku->id; $log->target_field = 'stock'; - $log->user_id = $this->businessOrderItem->shop_id; - $log->message = ($this->businessOrderItem->external_sku_id ?: '商品') . '未找到'; + $log->user_id = $event->businessOrderItem->shop_id; + $log->message = ($event->businessOrderItem->external_sku_id ?: '商品') . '未找到'; $log->save(); + return; + } + $shops = Shop::query()->where('id', '<>', $event->businessOrderItem->shop_id)->where('status', 1)->get(['id', 'plat_id']); + if (empty($shops)) { + return; + } + + foreach ($shops as $shop) { + BusinessGoodsSkuIncrQuantity::dispatch($shop, $event->businessOrderItem, $event->num, $event->goodsSku); } } } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index b975ef6..5b96a8e 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -2,12 +2,9 @@ namespace App\Providers; -use Illuminate\Auth\Events\Registered; -use Illuminate\Auth\Listeners\SendEmailVerificationNotification; +use App\Listeners\SendDatabaseNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Event; -use App\Listeners\SendDatabaseNotification; -use App\Listeners\BindBusinessGoods; use App\Listeners\UpdateBusinessGoodsStock; class EventServiceProvider extends ServiceProvider @@ -18,11 +15,9 @@ class EventServiceProvider extends ServiceProvider * @var array */ protected $listen = [ - Registered::class => [ - SendEmailVerificationNotification::class, - SendDatabaseNotification::class, - BindBusinessGoods::class, + 'App\Events\BusinessOrdersUpdate' => [ UpdateBusinessGoodsStock::class, + SendDatabaseNotification::class, ], ]; diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index d1392ed..47c9ea2 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -2,7 +2,7 @@ namespace App\Services\Business; -use App\Listeners\UpdateBusinessGoodsStock; +use App\Events\BusinessOrdersUpdate; use App\Models\BusinessGoodsSku; use App\Models\BusinessOrder; use App\Models\BusinessOrderItem; @@ -71,7 +71,7 @@ abstract class BusinessClient } // 增量更新库存 if ($num) { - event(new UpdateBusinessGoodsStock($orderItem, $num)); + event(new BusinessOrdersUpdate($orderItem, $num)); } } } diff --git a/composer.lock b/composer.lock index 4c69252..7144aa9 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "aliyuncs/oss-sdk-php", - "version": "v2.5.0", + "version": "v2.6.0", "source": { "type": "git", "url": "https://github.com/aliyun/aliyun-oss-php-sdk.git", - "reference": "f0413667d765855eb0aaa728b596801464ffdb06" + "reference": "572d0f8e099e8630ae7139ed3fdedb926c7a760f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/f0413667d765855eb0aaa728b596801464ffdb06", - "reference": "f0413667d765855eb0aaa728b596801464ffdb06", + "url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/572d0f8e099e8630ae7139ed3fdedb926c7a760f", + "reference": "572d0f8e099e8630ae7139ed3fdedb926c7a760f", "shasum": "" }, "require": { @@ -47,9 +47,9 @@ "homepage": "http://www.aliyun.com/product/oss/", "support": { "issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues", - "source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.5.0" + "source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.6.0" }, - "time": "2022-05-13T07:41:28+00:00" + "time": "2022-08-03T08:06:01+00:00" }, { "name": "beyondcode/laravel-websockets", @@ -595,25 +595,25 @@ }, { "name": "facade/ignition-contracts", - "version": "1.0.2", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/facade/ignition-contracts.git", - "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267" + "reference": "aeab1ce8b68b188a43e81758e750151ad7da796b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/3c921a1cdba35b68a7f0ccffc6dffc1995b18267", - "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/aeab1ce8b68b188a43e81758e750151ad7da796b", + "reference": "aeab1ce8b68b188a43e81758e750151ad7da796b", "shasum": "" }, "require": { - "php": "^7.3|^8.0" + "php": "^7.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^v2.15.8", - "phpunit/phpunit": "^9.3.11", - "vimeo/psalm": "^3.17.1" + "friendsofphp/php-cs-fixer": "^2.14", + "phpunit/phpunit": "^7.5|^8.0", + "vimeo/psalm": "^3.12" }, "type": "library", "autoload": { @@ -642,9 +642,9 @@ ], "support": { "issues": "https://github.com/facade/ignition-contracts/issues", - "source": "https://github.com/facade/ignition-contracts/tree/1.0.2" + "source": "https://github.com/facade/ignition-contracts/tree/1.0.1" }, - "time": "2020-10-16T08:27:54+00:00" + "time": "2020-07-14T10:10:28+00:00" }, { "name": "fideloper/proxy", @@ -1889,16 +1889,16 @@ }, { "name": "monolog/monolog", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "5579edf28aee1190a798bfa5be8bc16c563bd524" + "reference": "720488632c590286b88b80e62aa3d3d551ad4a50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5579edf28aee1190a798bfa5be8bc16c563bd524", - "reference": "5579edf28aee1190a798bfa5be8bc16c563bd524", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/720488632c590286b88b80e62aa3d3d551ad4a50", + "reference": "720488632c590286b88b80e62aa3d3d551ad4a50", "shasum": "" }, "require": { @@ -1918,11 +1918,10 @@ "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "php-console/php-console": "^3.1.3", "phpspec/prophecy": "^1.15", "phpstan/phpstan": "^0.12.91", "phpunit/phpunit": "^8.5.14", - "predis/predis": "^1.1", + "predis/predis": "^1.1 || ^2.0", "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": "^7", "swiftmailer/swiftmailer": "^5.3|^6.0", @@ -1942,7 +1941,6 @@ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, @@ -1977,7 +1975,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.7.0" + "source": "https://github.com/Seldaek/monolog/tree/2.8.0" }, "funding": [ { @@ -1989,30 +1987,30 @@ "type": "tidelift" } ], - "time": "2022-06-09T08:59:12+00:00" + "time": "2022-07-24T11:55:47+00:00" }, { "name": "myclabs/php-enum", - "version": "1.8.3", + "version": "1.7.7", "source": { "type": "git", "url": "https://github.com/myclabs/php-enum.git", - "reference": "b942d263c641ddb5190929ff840c68f78713e937" + "reference": "d178027d1e679832db9f38248fcc7200647dc2b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/php-enum/zipball/b942d263c641ddb5190929ff840c68f78713e937", - "reference": "b942d263c641ddb5190929ff840c68f78713e937", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/d178027d1e679832db9f38248fcc7200647dc2b7", + "reference": "d178027d1e679832db9f38248fcc7200647dc2b7", "shasum": "" }, "require": { "ext-json": "*", - "php": "^7.3 || ^8.0" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^7", "squizlabs/php_codesniffer": "1.*", - "vimeo/psalm": "^4.6.2" + "vimeo/psalm": "^3.8" }, "type": "library", "autoload": { @@ -2037,7 +2035,7 @@ ], "support": { "issues": "https://github.com/myclabs/php-enum/issues", - "source": "https://github.com/myclabs/php-enum/tree/1.8.3" + "source": "https://github.com/myclabs/php-enum/tree/1.7.7" }, "funding": [ { @@ -2049,20 +2047,20 @@ "type": "tidelift" } ], - "time": "2021-07-05T08:18:36+00:00" + "time": "2020-11-14T18:14:52+00:00" }, { "name": "nesbot/carbon", - "version": "2.59.1", + "version": "2.61.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5" + "reference": "bdf4f4fe3a3eac4de84dbec0738082a862c68ba6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/a9000603ea337c8df16cc41f8b6be95a65f4d0f5", - "reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bdf4f4fe3a3eac4de84dbec0738082a862c68ba6", + "reference": "bdf4f4fe3a3eac4de84dbec0738082a862c68ba6", "shasum": "" }, "require": { @@ -2151,7 +2149,7 @@ "type": "tidelift" } ], - "time": "2022-06-29T21:43:55+00:00" + "time": "2022-08-06T12:41:24+00:00" }, { "name": "nikic/php-parser", @@ -2412,16 +2410,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "1.24.1", + "version": "1.19.0", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "69991111e05fca3ff7398e1e7fca9ebed33efec6" + "reference": "a9ab55bfae02eecffb3df669a2e19ba0e2f04bbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/69991111e05fca3ff7398e1e7fca9ebed33efec6", - "reference": "69991111e05fca3ff7398e1e7fca9ebed33efec6", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/a9ab55bfae02eecffb3df669a2e19ba0e2f04bbf", + "reference": "a9ab55bfae02eecffb3df669a2e19ba0e2f04bbf", "shasum": "" }, "require": { @@ -2442,23 +2440,23 @@ "maennchen/zipstream-php": "^2.1", "markbaker/complex": "^3.0", "markbaker/matrix": "^3.0", - "php": "^7.3 || ^8.0", + "php": "^7.2 || ^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/simple-cache": "^1.0 || ^2.0" + "psr/simple-cache": "^1.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "dev-master", - "dompdf/dompdf": "^1.0 || ^2.0", - "friendsofphp/php-cs-fixer": "^3.2", + "dompdf/dompdf": "^1.0", + "friendsofphp/php-cs-fixer": "^2.18", "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "8.1.1", + "mpdf/mpdf": "^8.0", "phpcompatibility/php-compatibility": "^9.3", - "phpstan/phpstan": "^1.1", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^8.5 || ^9.0", - "squizlabs/php_codesniffer": "^3.7", - "tecnickcom/tcpdf": "^6.4" + "phpstan/phpstan": "^0.12.82", + "phpstan/phpstan-phpunit": "^0.12.18", + "phpunit/phpunit": "^8.5", + "squizlabs/php_codesniffer": "^3.5", + "tecnickcom/tcpdf": "^6.3" }, "suggest": { "dompdf/dompdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)", @@ -2510,35 +2508,39 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.24.1" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.19.0" }, - "time": "2022-07-18T19:50:48+00:00" + "time": "2021-10-31T15:09:20+00:00" }, { "name": "phpoption/phpoption", - "version": "1.8.1", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" + "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", + "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", "shasum": "" }, "require": { - "php": "^7.0 || ^8.0" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + "bamarni/composer-bin-plugin": "^1.8", + "phpunit/phpunit": "^8.5.28 || ^9.5.21" }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2571,7 +2573,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.0" }, "funding": [ { @@ -2583,7 +2585,7 @@ "type": "tidelift" } ], - "time": "2021-12-04T23:24:31+00:00" + "time": "2022-07-30T15:51:26+00:00" }, { "name": "psr/container", @@ -2896,16 +2898,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.7", + "version": "v0.11.8", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "77fc7270031fbc28f9a7bea31385da5c4855cb7a" + "reference": "f455acf3645262ae389b10e9beba0c358aa6994e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/77fc7270031fbc28f9a7bea31385da5c4855cb7a", - "reference": "77fc7270031fbc28f9a7bea31385da5c4855cb7a", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/f455acf3645262ae389b10e9beba0c358aa6994e", + "reference": "f455acf3645262ae389b10e9beba0c358aa6994e", "shasum": "" }, "require": { @@ -2966,35 +2968,34 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.7" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.8" }, - "time": "2022-07-07T13:49:11+00:00" + "time": "2022-07-28T14:25:11+00:00" }, { "name": "pusher/pusher-php-server", - "version": "7.0.2", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/pusher/pusher-http-php.git", - "reference": "af3eeaefc0c7959f5b3852f0a4dd5547245d33df" + "reference": "8673f60458ceedb9531fad7a5747eb49de619a8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pusher/pusher-http-php/zipball/af3eeaefc0c7959f5b3852f0a4dd5547245d33df", - "reference": "af3eeaefc0c7959f5b3852f0a4dd5547245d33df", + "url": "https://api.github.com/repos/pusher/pusher-http-php/zipball/8673f60458ceedb9531fad7a5747eb49de619a8a", + "reference": "8673f60458ceedb9531fad7a5747eb49de619a8a", "shasum": "" }, "require": { "ext-curl": "*", - "ext-json": "*", "guzzlehttp/guzzle": "^7.2", "paragonie/sodium_compat": "^1.6", - "php": "^7.3|^8.0", - "psr/log": "^1.0|^2.0|^3.0" + "php": "^7.2.5|^8.0", + "psr/log": "^1.0" }, "require-dev": { "overtrue/phplint": "^2.3", - "phpunit/phpunit": "^8.5|^9.3" + "phpunit/phpunit": "^7.2|^8.5|^9.3" }, "type": "library", "extra": { @@ -3027,9 +3028,9 @@ ], "support": { "issues": "https://github.com/pusher/pusher-http-php/issues", - "source": "https://github.com/pusher/pusher-http-php/tree/7.0.2" + "source": "https://github.com/pusher/pusher-http-php/tree/6.1.0" }, - "time": "2021-12-07T13:09:00+00:00" + "time": "2021-03-24T08:23:36+00:00" }, { "name": "ralouphie/getallheaders", @@ -4198,16 +4199,16 @@ }, { "name": "symfony/console", - "version": "v4.4.43", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8a2628d2d5639f35113dc1b833ecd91e1ed1cf46" + "reference": "c35fafd7f12ebd6f9e29c95a370df7f1fb171a40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8a2628d2d5639f35113dc1b833ecd91e1ed1cf46", - "reference": "8a2628d2d5639f35113dc1b833ecd91e1ed1cf46", + "url": "https://api.github.com/repos/symfony/console/zipball/c35fafd7f12ebd6f9e29c95a370df7f1fb171a40", + "reference": "c35fafd7f12ebd6f9e29c95a370df7f1fb171a40", "shasum": "" }, "require": { @@ -4268,7 +4269,7 @@ "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/console/tree/v4.4.43" + "source": "https://github.com/symfony/console/tree/v4.4.44" }, "funding": [ { @@ -4284,20 +4285,20 @@ "type": "tidelift" } ], - "time": "2022-06-23T12:22:25+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "symfony/css-selector", - "version": "v5.4.3", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e" + "reference": "c1681789f059ab756001052164726ae88512ae3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b0a190285cd95cb019237851205b8140ef6e368e", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/c1681789f059ab756001052164726ae88512ae3d", + "reference": "c1681789f059ab756001052164726ae88512ae3d", "shasum": "" }, "require": { @@ -4334,7 +4335,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.4.3" + "source": "https://github.com/symfony/css-selector/tree/v5.4.11" }, "funding": [ { @@ -4350,20 +4351,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-06-27T16:58:25+00:00" }, { "name": "symfony/debug", - "version": "v4.4.41", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "6637e62480b60817b9a6984154a533e8e64c6bd5" + "reference": "1a692492190773c5310bc7877cb590c04c2f05be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/6637e62480b60817b9a6984154a533e8e64c6bd5", - "reference": "6637e62480b60817b9a6984154a533e8e64c6bd5", + "url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be", + "reference": "1a692492190773c5310bc7877cb590c04c2f05be", "shasum": "" }, "require": { @@ -4402,7 +4403,7 @@ "description": "Provides tools to ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/debug/tree/v4.4.41" + "source": "https://github.com/symfony/debug/tree/v4.4.44" }, "funding": [ { @@ -4419,7 +4420,7 @@ } ], "abandoned": "symfony/error-handler", - "time": "2022-04-12T15:19:55+00:00" + "time": "2022-07-28T16:29:46+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4490,16 +4491,16 @@ }, { "name": "symfony/error-handler", - "version": "v4.4.41", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "529feb0e03133dbd5fd3707200147cc4903206da" + "reference": "be731658121ef2d8be88f3a1ec938148a9237291" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/529feb0e03133dbd5fd3707200147cc4903206da", - "reference": "529feb0e03133dbd5fd3707200147cc4903206da", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/be731658121ef2d8be88f3a1ec938148a9237291", + "reference": "be731658121ef2d8be88f3a1ec938148a9237291", "shasum": "" }, "require": { @@ -4538,7 +4539,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v4.4.41" + "source": "https://github.com/symfony/error-handler/tree/v4.4.44" }, "funding": [ { @@ -4554,20 +4555,20 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:19:55+00:00" + "time": "2022-07-28T16:29:46+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.42", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "708e761740c16b02c86e3f0c932018a06b895d40" + "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/708e761740c16b02c86e3f0c932018a06b895d40", - "reference": "708e761740c16b02c86e3f0c932018a06b895d40", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1e866e9e5c1b22168e0ce5f0b467f19bba61266a", + "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a", "shasum": "" }, "require": { @@ -4622,7 +4623,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.42" + "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.44" }, "funding": [ { @@ -4638,7 +4639,7 @@ "type": "tidelift" } ], - "time": "2022-05-05T15:33:49+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -4721,16 +4722,16 @@ }, { "name": "symfony/finder", - "version": "v4.4.41", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "40790bdf293b462798882ef6da72bb49a4a6633a" + "reference": "66bd787edb5e42ff59d3523f623895af05043e4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/40790bdf293b462798882ef6da72bb49a4a6633a", - "reference": "40790bdf293b462798882ef6da72bb49a4a6633a", + "url": "https://api.github.com/repos/symfony/finder/zipball/66bd787edb5e42ff59d3523f623895af05043e4f", + "reference": "66bd787edb5e42ff59d3523f623895af05043e4f", "shasum": "" }, "require": { @@ -4763,7 +4764,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v4.4.41" + "source": "https://github.com/symfony/finder/tree/v4.4.44" }, "funding": [ { @@ -4779,7 +4780,7 @@ "type": "tidelift" } ], - "time": "2022-04-14T15:36:10+00:00" + "time": "2022-07-29T07:35:46+00:00" }, { "name": "symfony/http-client-contracts", @@ -4861,16 +4862,16 @@ }, { "name": "symfony/http-foundation", - "version": "v4.4.43", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "4441dada27f9208e03f449d73cb9253c639e53c5" + "reference": "9bc83c2f78949fc64503134a3139a7b055890d06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/4441dada27f9208e03f449d73cb9253c639e53c5", - "reference": "4441dada27f9208e03f449d73cb9253c639e53c5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9bc83c2f78949fc64503134a3139a7b055890d06", + "reference": "9bc83c2f78949fc64503134a3139a7b055890d06", "shasum": "" }, "require": { @@ -4909,7 +4910,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v4.4.43" + "source": "https://github.com/symfony/http-foundation/tree/v4.4.44" }, "funding": [ { @@ -4925,20 +4926,20 @@ "type": "tidelift" } ], - "time": "2022-06-19T13:07:44+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.4.43", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "c4c33fb9203e6f166ac0f318ce34e00686702522" + "reference": "9e444442334fae9637ef3209bc2abddfef49e714" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/c4c33fb9203e6f166ac0f318ce34e00686702522", - "reference": "c4c33fb9203e6f166ac0f318ce34e00686702522", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/9e444442334fae9637ef3209bc2abddfef49e714", + "reference": "9e444442334fae9637ef3209bc2abddfef49e714", "shasum": "" }, "require": { @@ -5013,7 +5014,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v4.4.43" + "source": "https://github.com/symfony/http-kernel/tree/v4.4.44" }, "funding": [ { @@ -5029,20 +5030,20 @@ "type": "tidelift" } ], - "time": "2022-06-26T16:51:30+00:00" + "time": "2022-07-29T12:23:38+00:00" }, { "name": "symfony/mime", - "version": "v5.4.10", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "02265e1e5111c3cd7480387af25e82378b7ab9cc" + "reference": "3cd175cdcdb6db2e589e837dd46aff41027d9830" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/02265e1e5111c3cd7480387af25e82378b7ab9cc", - "reference": "02265e1e5111c3cd7480387af25e82378b7ab9cc", + "url": "https://api.github.com/repos/symfony/mime/zipball/3cd175cdcdb6db2e589e837dd46aff41027d9830", + "reference": "3cd175cdcdb6db2e589e837dd46aff41027d9830", "shasum": "" }, "require": { @@ -5096,7 +5097,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.4.10" + "source": "https://github.com/symfony/mime/tree/v5.4.11" }, "funding": [ { @@ -5112,7 +5113,7 @@ "type": "tidelift" } ], - "time": "2022-06-09T12:22:40+00:00" + "time": "2022-07-20T11:34:24+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5773,16 +5774,16 @@ }, { "name": "symfony/process", - "version": "v4.4.41", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "9eedd60225506d56e42210a70c21bb80ca8456ce" + "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/9eedd60225506d56e42210a70c21bb80ca8456ce", - "reference": "9eedd60225506d56e42210a70c21bb80ca8456ce", + "url": "https://api.github.com/repos/symfony/process/zipball/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", + "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", "shasum": "" }, "require": { @@ -5815,7 +5816,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v4.4.41" + "source": "https://github.com/symfony/process/tree/v4.4.44" }, "funding": [ { @@ -5831,7 +5832,7 @@ "type": "tidelift" } ], - "time": "2022-04-04T10:19:07+00:00" + "time": "2022-06-27T13:16:42+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -5923,16 +5924,16 @@ }, { "name": "symfony/routing", - "version": "v4.4.41", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "c25e38d403c00d5ddcfc514f016f1b534abdf052" + "reference": "f7751fd8b60a07f3f349947a309b5bdfce22d6ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/c25e38d403c00d5ddcfc514f016f1b534abdf052", - "reference": "c25e38d403c00d5ddcfc514f016f1b534abdf052", + "url": "https://api.github.com/repos/symfony/routing/zipball/f7751fd8b60a07f3f349947a309b5bdfce22d6ae", + "reference": "f7751fd8b60a07f3f349947a309b5bdfce22d6ae", "shasum": "" }, "require": { @@ -5992,7 +5993,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v4.4.41" + "source": "https://github.com/symfony/routing/tree/v4.4.44" }, "funding": [ { @@ -6008,7 +6009,7 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:19:55+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "symfony/service-contracts", @@ -6095,16 +6096,16 @@ }, { "name": "symfony/translation", - "version": "v4.4.41", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "dcb67eae126e74507e0b4f0b9ac6ef35b37c3331" + "reference": "af947fefc306cec6ea5a1f6160c7e305a71f2493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/dcb67eae126e74507e0b4f0b9ac6ef35b37c3331", - "reference": "dcb67eae126e74507e0b4f0b9ac6ef35b37c3331", + "url": "https://api.github.com/repos/symfony/translation/zipball/af947fefc306cec6ea5a1f6160c7e305a71f2493", + "reference": "af947fefc306cec6ea5a1f6160c7e305a71f2493", "shasum": "" }, "require": { @@ -6164,7 +6165,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v4.4.41" + "source": "https://github.com/symfony/translation/tree/v4.4.44" }, "funding": [ { @@ -6180,7 +6181,7 @@ "type": "tidelift" } ], - "time": "2022-04-21T07:22:34+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "symfony/translation-contracts", @@ -6262,16 +6263,16 @@ }, { "name": "symfony/var-dumper", - "version": "v4.4.42", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "742aab50ad097bcb62d91fccb613f66b8047d2ca" + "reference": "f19951007dae942cc79b979c1fe26bfdfbeb54ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/742aab50ad097bcb62d91fccb613f66b8047d2ca", - "reference": "742aab50ad097bcb62d91fccb613f66b8047d2ca", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f19951007dae942cc79b979c1fe26bfdfbeb54ed", + "reference": "f19951007dae942cc79b979c1fe26bfdfbeb54ed", "shasum": "" }, "require": { @@ -6331,7 +6332,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v4.4.42" + "source": "https://github.com/symfony/var-dumper/tree/v4.4.44" }, "funding": [ { @@ -6347,7 +6348,7 @@ "type": "tidelift" } ], - "time": "2022-05-21T10:00:54+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -6553,16 +6554,16 @@ }, { "name": "facade/flare-client-php", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/facade/flare-client-php.git", - "reference": "b2adf1512755637d0cef4f7d1b54301325ac78ed" + "reference": "213fa2c69e120bca4c51ba3e82ed1834ef3f41b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/flare-client-php/zipball/b2adf1512755637d0cef4f7d1b54301325ac78ed", - "reference": "b2adf1512755637d0cef4f7d1b54301325ac78ed", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/213fa2c69e120bca4c51ba3e82ed1834ef3f41b8", + "reference": "213fa2c69e120bca4c51ba3e82ed1834ef3f41b8", "shasum": "" }, "require": { @@ -6575,7 +6576,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.14", - "phpunit/phpunit": "^7.5.16", + "phpunit/phpunit": "^7.5", "spatie/phpunit-snapshot-assertions": "^2.0" }, "type": "library", @@ -6606,7 +6607,7 @@ ], "support": { "issues": "https://github.com/facade/flare-client-php/issues", - "source": "https://github.com/facade/flare-client-php/tree/1.9.1" + "source": "https://github.com/facade/flare-client-php/tree/1.10.0" }, "funding": [ { @@ -6614,7 +6615,7 @@ "type": "github" } ], - "time": "2021-09-13T12:16:46+00:00" + "time": "2022-08-09T11:23:57+00:00" }, { "name": "facade/ignition", @@ -6883,33 +6884,30 @@ }, { "name": "mockery/mockery", - "version": "1.5.0", + "version": "1.3.5", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac" + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", - "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": "^7.3 || ^8.0" - }, - "conflict": { - "phpunit/phpunit": "<8.0" + "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.3" + "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -6949,9 +6947,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.5.0" + "source": "https://github.com/mockery/mockery/tree/1.3.5" }, - "time": "2022-01-20T13:18:17+00:00" + "time": "2021-09-13T15:33:03+00:00" }, { "name": "myclabs/deep-copy", @@ -7534,44 +7532,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "version": "7.0.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "reference": "819f92bba8b001d4363065928088de22f25a3a48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", + "reference": "819f92bba8b001d4363065928088de22f25a3a48", "shasum": "" }, "require": { "ext-dom": "*", - "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.2.2", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -7599,7 +7593,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" }, "funding": [ { @@ -7607,32 +7601,32 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2021-07-26T12:20:09+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -7659,7 +7653,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" }, "funding": [ { @@ -7667,97 +7661,26 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2021-12-02T12:42:26+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" + "php": ">=5.3.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, "autoload": { "classmap": [ "src/" @@ -7781,40 +7704,34 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -7840,7 +7757,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" }, "funding": [ { @@ -7848,20 +7765,80 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2020-11-30T08:20:02+00:00" }, { - "name": "phpunit/phpunit", - "version": "9.5.21", + "name": "phpunit/php-token-stream", + "version": "3.1.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2021-07-26T12:15:06+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "8.5.28", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "8f2d1c9c7b30382459c871467853da1a6e44fbd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8f2d1c9c7b30382459c871467853da1a6e44fbd4", + "reference": "8f2d1c9c7b30382459c871467853da1a6e44fbd4", "shasum": "" }, "require": { @@ -7872,34 +7849,29 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", + "myclabs/deep-copy": "^1.10.0", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", - "sebastian/version": "^3.0.2" - }, - "require-dev": { - "phpspec/prophecy-phpunit": "^2.0.1" + "php": ">=7.2", + "phpspec/prophecy": "^1.10.3", + "phpunit/php-code-coverage": "^7.0.12", + "phpunit/php-file-iterator": "^2.0.4", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.3", + "sebastian/exporter": "^3.1.2", + "sebastian/global-state": "^3.0.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", + "sebastian/version": "^2.0.1" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*" + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -7907,13 +7879,10 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "8.5-dev" } }, "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], "classmap": [ "src/" ] @@ -7938,7 +7907,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.28" }, "funding": [ { @@ -7950,7 +7919,7 @@ "type": "github" } ], - "time": "2022-06-19T12:14:25+00:00" + "time": "2022-07-29T09:20:50+00:00" }, { "name": "scrivo/highlight.php", @@ -8030,142 +7999,30 @@ ], "time": "2021-12-03T06:45:28+00:00" }, - { - "name": "sebastian/cli-parser", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:08:49+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:08:54+00:00" - }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -8187,7 +8044,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" }, "funding": [ { @@ -8195,34 +8052,34 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2020-11-30T08:15:22+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -8261,7 +8118,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" }, "funding": [ { @@ -8269,90 +8126,33 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" - }, - { - "name": "sebastian/complexity", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", - "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2020-11-30T08:04:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -8384,7 +8184,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" }, "funding": [ { @@ -8392,27 +8192,27 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2020-11-30T07:59:04+00:00" }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "4.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^7.5" }, "suggest": { "ext-posix": "*" @@ -8420,7 +8220,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -8447,7 +8247,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" }, "funding": [ { @@ -8455,34 +8255,34 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2020-11-30T07:53:42+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -8517,14 +8317,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", + "homepage": "http://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" }, "funding": [ { @@ -8532,30 +8332,30 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2021-11-11T13:51:24+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -8563,7 +8363,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -8588,7 +8388,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2" }, "funding": [ { @@ -8596,91 +8396,34 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", - "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2022-02-10T06:55:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -8702,7 +8445,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" }, "funding": [ { @@ -8710,32 +8453,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2020-11-30T07:40:27+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -8757,7 +8500,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" }, "funding": [ { @@ -8765,32 +8508,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2020-11-30T07:37:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -8820,7 +8563,7 @@ "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" }, "funding": [ { @@ -8828,32 +8571,29 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2020-11-30T07:34:24+00:00" }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", "shasum": "" }, "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -8875,7 +8615,7 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" }, "funding": [ { @@ -8883,32 +8623,32 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2020-11-30T07:30:19+00:00" }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=7.2" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -8931,7 +8671,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" }, "funding": [ { @@ -8939,29 +8679,29 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2020-11-30T07:25:11+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=5.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -8984,15 +8724,9 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/master" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "theseer/tokenizer", From a47657619d652958ada440fee6213f0ecb03bac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 15:01:35 +0800 Subject: [PATCH 25/33] =?UTF-8?q?feat:=20#10000=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E7=B1=BB=E5=9E=8B=E5=A2=9E=E5=8A=A0goods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Log.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Models/Log.php b/app/Models/Log.php index 06bc265..3ad09b9 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -70,6 +70,7 @@ class Log extends Model 'upload' => '上传', 'kuaituantuan' => '快团团', 'miaoxuan' => '妙选', + 'goods' => '商品', ]; return $map[$value]; From ee6e1fa09fef999571dab27c24da6d48110326e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 15:22:50 +0800 Subject: [PATCH 26/33] =?UTF-8?q?feat:=20#10000=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E7=B1=BB=E5=9E=8B=E5=A2=9E=E5=8A=A0goods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Log.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Models/Log.php b/app/Models/Log.php index 3ad09b9..43cd08b 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -42,7 +42,7 @@ class Log extends Model 'file' => '文件', ]; - return $map[$value]; + return $map[$value] ?? $value; } public function getActionAttribute($value) @@ -54,7 +54,7 @@ class Log extends Model 'DELETE' => '删除', ]; - return $map[$value]; + return $map[$value] ?? $value; } public function getTargetTypeAttribute($value) @@ -73,7 +73,7 @@ class Log extends Model 'goods' => '商品', ]; - return $map[$value]; + return $map[$value] ?? $value; } public function getTargetFieldAttribute($value) @@ -91,7 +91,7 @@ class Log extends Model 'inventory' => '库存盘点', ]; - return $map[$value]; + return $map[$value] ?? $value; } public function setUserIdAttribute($value) From 360cf5cf179c319196930b9353b74940b646a562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 18:09:15 +0800 Subject: [PATCH 27/33] =?UTF-8?q?feat:=20#10000=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Swoole.php | 2 +- app/Models/Log.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/Swoole.php b/app/Console/Commands/Swoole.php index ecc9494..1967e06 100644 --- a/app/Console/Commands/Swoole.php +++ b/app/Console/Commands/Swoole.php @@ -46,7 +46,7 @@ class Swoole extends Command Timer::tick(1000, function () { $shops = Shop::query()->where('plat_id', 1)->where('status', 1)->get(); $endTime = DateTimeUtils::getMicroTime(); - $beginTime = $endTime - 1000; + $beginTime = $endTime - 10000; foreach ($shops as $shop) { BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 'increment', 1); } diff --git a/app/Models/Log.php b/app/Models/Log.php index 43cd08b..be323d7 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -17,7 +17,8 @@ class Log extends Model 'target_id', 'target_field', 'user_id', - 'created_at', + 'start_time', + 'end_time', ]; public $fillable = [ From cf910fa6ae54917704a51a269e7954123aa5bc1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 18:34:16 +0800 Subject: [PATCH 28/33] =?UTF-8?q?feat:=20#10000=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E9=98=9F=E5=88=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Jobs/BusinessGoodsSkuIncrQuantity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/BusinessGoodsSkuIncrQuantity.php b/app/Jobs/BusinessGoodsSkuIncrQuantity.php index ca1da28..6dcc2d3 100644 --- a/app/Jobs/BusinessGoodsSkuIncrQuantity.php +++ b/app/Jobs/BusinessGoodsSkuIncrQuantity.php @@ -40,6 +40,6 @@ class BusinessGoodsSkuIncrQuantity implements ShouldQueue */ public function handle() { - BusinessFactory::init()->make($this->shop['plat_id'])->setShopId($this->shop['id'])->incrQuantity($this->businessOrderItem, $this->num, true, $this->goodsSku); + BusinessFactory::init()->make($this->shop['plat_id'])->setShopWithId($this->shop['id'])->incrQuantity($this->businessOrderItem, $this->num, true, $this->goodsSku); } } From a2eb9e27ddee582b420fe4a13dadf1283b21db55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 11 Aug 2022 18:47:35 +0800 Subject: [PATCH 29/33] =?UTF-8?q?feat:=20#10000=20=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Shop.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Models/Shop.php b/app/Models/Shop.php index f45960b..5140a13 100644 --- a/app/Models/Shop.php +++ b/app/Models/Shop.php @@ -8,7 +8,6 @@ class Shop extends Model { protected $hidden = [ 'access_token', - 'expires_at', 'expires_in', 'refresh_token', 'refresh_token_expires_at', @@ -28,6 +27,9 @@ class Shop extends Model 2 => '无需授权', 3 => '停用', ]; + if (1 === (int)$value && ($this->attributes['expires_at'] - time()) / 3600 <= 72) { + return '重新授权'; + } return $map[$value]; } From 46c59fe993f221ab59885fa5d9cd477f81140961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Fri, 12 Aug 2022 13:30:32 +0800 Subject: [PATCH 30/33] =?UTF-8?q?feat:=20#10000=20=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9,=E5=A2=9E=E5=8A=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Shop/ShopsController.php | 13 +++++++++++++ app/Models/BusinessOrderItem.php | 5 +++++ resources/lang/zh-CN/permission.php | 10 +++++----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index 3f79c8e..63df107 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -9,6 +9,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; use App\Services\Business\BusinessFactory; use Illuminate\Validation\Rule; +use App\Models\BusinessOrderItem; class ShopsController extends Controller { @@ -97,4 +98,16 @@ class ShopsController extends Controller return response(['Code' => 10000, 'Message' => 'SUCCESS']); } + + public function countOrdersNumWithSkuCode(Request $request) + { + Validator::make($request->all(), [ + 'sku_code' => ['required', 'array'], + ])->validate(); + return BusinessOrderItem::query() + ->whereIn('external_sku_id', $request->get('sku_code')) + ->groupBy(['shop_id']) + ->with(['shop:id,name']) + ->count('shop_id'); + } } diff --git a/app/Models/BusinessOrderItem.php b/app/Models/BusinessOrderItem.php index 19015e3..a656040 100644 --- a/app/Models/BusinessOrderItem.php +++ b/app/Models/BusinessOrderItem.php @@ -39,4 +39,9 @@ class BusinessOrderItem extends Model { return $this->hasOne(BusinessOrder::class, 'id', 'business_order_id'); } + + public function shop() + { + return $this->hasOne(Shop::class, 'id', 'shop_id'); + } } diff --git a/resources/lang/zh-CN/permission.php b/resources/lang/zh-CN/permission.php index 6d487bb..d000062 100644 --- a/resources/lang/zh-CN/permission.php +++ b/resources/lang/zh-CN/permission.php @@ -215,11 +215,11 @@ return [ // 'name' => '权限管理', // 'parent_id' => 7, // ], -// 'permissions.index' => [ -// 'id' => 90, -// 'name' => '列表', -// 'parent_id' => 9, -// ], + 'permissions.index' => [ + 'id' => 90, + 'name' => '列表', + 'parent_id' => 9, + ], // 系统日志 'SYSTEM_LOG' => [ 'id' => 10, From f497b36199a213e46ffc282f6b999cd61975fd6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Fri, 12 Aug 2022 16:20:40 +0800 Subject: [PATCH 31/33] =?UTF-8?q?feat:=20#10000=20=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=80=BB=E9=87=8F=E9=80=BB=E8=BE=91=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加订单占用接口 --- app/Console/Commands/Test.php | 2 +- .../Controllers/Goods/GoodsController.php | 1 + .../Controllers/Goods/GoodsSkusController.php | 44 ++++++++++--------- app/Http/Controllers/Shop/ShopsController.php | 31 ++++++++++--- app/Http/Requests/GoodsSkuRequest.php | 2 +- resources/lang/zh-CN/permission.php | 5 +++ routes/api.php | 1 + 7 files changed, 59 insertions(+), 27 deletions(-) diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 619eb6b..d8d0c01 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -44,7 +44,7 @@ class Test extends Command $business = BusinessFactory::init()->make($shop->plat_id); $business->setShop($shop); // 下载商品列表 -// $business->downloadGoodsList(); +// $business->downloadGoodsListAndBind(); // 下载单个商品 // $business->downloadGoods(1); diff --git a/app/Http/Controllers/Goods/GoodsController.php b/app/Http/Controllers/Goods/GoodsController.php index 0dedbb7..fbb7fef 100644 --- a/app/Http/Controllers/Goods/GoodsController.php +++ b/app/Http/Controllers/Goods/GoodsController.php @@ -59,6 +59,7 @@ class GoodsController extends Controller $goodsSkus = []; foreach ($request->skus as $item) { $item['goods_id'] = $goods->id; + $item['stock'] = $item['num']; $item['reference_price'] = $item['cost'] * 1.5; $goodsSkus[] = $item; } diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index 701fab0..b70843d 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -58,6 +58,7 @@ class GoodsSkusController extends Controller ->with(['daily' => function ($query) use ($day) { $query->where('day', $day); }]) + ->orderBy('updated_at', 'desc') ->paginate(); return GoodsSkuResource::collection($goodsSkus); @@ -197,7 +198,6 @@ class GoodsSkusController extends Controller 'target_id' => $sku['id'], 'user_id' => $request->user()->id ]; - // 今日到货 $record = DailyStockRecord::query()->where('sku_id', $sku['id'])->where('day', DateTimeUtils::getToday())->first(['id', 'inventory']); $inventoryLog['target_field'] = 'inventory'; $inventoryLog['before_update'] = $record->inventory; @@ -227,7 +227,7 @@ class GoodsSkusController extends Controller $update = reset($skus); DB::beginTransaction(); try { - $sku = GoodsSku::query()->where('id', $update['id'])->first(['id', 'two_days_ago_num', 'yesterday_num', 'num', 'stock']); + $sku = GoodsSku::query()->where('id', $update['id'])->first(['id', 'two_days_ago_num', 'yesterday_num', 'num', 'stock', 'reserve']); $record = DailyStockRecord::query() ->where('sku_id', $sku->id) ->where('day', DateTimeUtils::getToday()) @@ -235,12 +235,15 @@ class GoodsSkusController extends Controller $this->setBeforeUpdate([ 'two_days_ago_num' => $sku->two_days_ago_num, 'yesterday_num' => $sku->yesterday_num, - 'num' => $sku->num, 'arrived_today_num' => $record->arrived_today_num, + 'num' => $sku->num, + 'stock' => $sku->stock, ]); $sku->two_days_ago_num = $update['two_days_ago_num']; $sku->yesterday_num = $update['yesterday_num']; - $sku->num = $update['two_days_ago_num'] + $update['yesterday_num'] + $sku->stock; + $stock = $update['two_days_ago_num'] + $update['yesterday_num'] + $update['arrived_today_num'] - $sku->reserve - $record->loss_num; + $sku->stock = $stock; + $sku->num = $stock + $sku->reserve + $record->loss_num; $sku->save(); $record->arrived_today_num = $update['arrived_today_num']; $record->save(); @@ -248,6 +251,8 @@ class GoodsSkusController extends Controller 'two_days_ago_num' => $sku->two_days_ago_num, 'yesterday_num' => $sku->yesterday_num, 'arrived_today_num' => $record->arrived_today_num, + 'num' => $sku->num, + 'stock' => $sku->stock, ]); $this->addLog($sku->id, 'stock'); DB::commit(); @@ -301,28 +306,27 @@ class GoodsSkusController extends Controller return response($this->res, $this->res['httpCode']); } $updateField = \request('updateField'); + $sku = GoodsSku::query()->find($id); if ('loss_num' === $updateField) { - $model = DailyStockRecord::query() + $record = DailyStockRecord::query() ->where('sku_id', $id) ->where('day', DateTimeUtils::getToday()) ->first(['id', 'loss_num']); $this->log->message = $request->get('reason'); - $this->setBeforeUpdate($model->loss_num); - $model->loss_num += $request->loss_num; - } else { - $model = GoodsSku::query()->find($id); - $this->setBeforeUpdate($model->$updateField); - if ('reserve' === $updateField) { - $changeNum = $model->reserve - $request->reserve; - $model->stock += $changeNum; - $model->reserve = $request->reserve; - $model->num += $changeNum; - } else { - $model->$updateField = $request->$updateField; - } + $this->setBeforeUpdate($record->loss_num); + $record->loss_num += $request->loss_num; + $record->save(); + $this->setAfterUpdate($record->loss_num); + $sku->stock -= $request->loss_num; } - $model->save(); - $this->setAfterUpdate($model->$updateField); + $this->setBeforeUpdate($sku->$updateField); + if ('reserve' === $updateField) { + $changeNum = $sku->reserve - $request->reserve; + $sku->stock += $changeNum; + } + $sku->$updateField = $request->$updateField; + $sku->save(); + $this->setAfterUpdate($sku->$updateField); $this->addLog($id, $updateField); return response($this->res, $this->res['httpCode']); diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index 63df107..e6f3245 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -6,6 +6,7 @@ use App\Http\Controllers\Controller; use App\Models\Shop; use App\Http\Resources\ShopsResource; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Validator; use App\Services\Business\BusinessFactory; use Illuminate\Validation\Rule; @@ -101,13 +102,33 @@ class ShopsController extends Controller public function countOrdersNumWithSkuCode(Request $request) { - Validator::make($request->all(), [ + $validator = Validator::make($request->all(), [ 'sku_code' => ['required', 'array'], - ])->validate(); - return BusinessOrderItem::query() + ]); + if ($validator->fails()) { + $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); + + return response($this->res, $this->res['httpCode']); + } + $fields = implode(',', [ + 'shop_id', + 'external_sku_id', + 'count(id) as count', + ]); + $res = BusinessOrderItem::query() + ->select(DB::raw($fields)) ->whereIn('external_sku_id', $request->get('sku_code')) - ->groupBy(['shop_id']) + ->groupBy(['shop_id', 'external_sku_id']) ->with(['shop:id,name']) - ->count('shop_id'); + ->get(); + $data = []; + foreach ($res as $item) { + $data[$item->external_sku_id][] = [ + 'shop_name' => $item->shop->name, + 'count' => $item->count, + ]; + } + + return $data; } } diff --git a/app/Http/Requests/GoodsSkuRequest.php b/app/Http/Requests/GoodsSkuRequest.php index 2af032a..a9b2592 100644 --- a/app/Http/Requests/GoodsSkuRequest.php +++ b/app/Http/Requests/GoodsSkuRequest.php @@ -31,7 +31,7 @@ class GoodsSkuRequest extends FormRequest 'sku_code' => ['sometimes', 'required', 'distinct', 'alpha_dash', 'max:32'], 'status' => ['sometimes', 'required', 'integer', Rule::in([0, 1, 2])], 'num' => ['sometimes', 'required', 'integer'], - 'cost' => ['sometimes', 'required', 'numeric'], + 'cost' => ['sometimes', 'required', 'numeric', 'gt:0'], 'reference_price' => [ 'sometimes', 'numeric', diff --git a/resources/lang/zh-CN/permission.php b/resources/lang/zh-CN/permission.php index d000062..44c75aa 100644 --- a/resources/lang/zh-CN/permission.php +++ b/resources/lang/zh-CN/permission.php @@ -52,6 +52,11 @@ return [ 'name' => '字段更新', 'parent_id' => 2, ], + 'goods_sku.orders_num' => [ + 'id' => 28, + 'name' => '店铺订单', + 'parent_id' => 2, + ], 'GOODS_TYPE' => [ 'id' => 3, 'name' => '商品种类', diff --git a/routes/api.php b/routes/api.php index b322c4f..19fbfe3 100644 --- a/routes/api.php +++ b/routes/api.php @@ -33,6 +33,7 @@ Route::middleware(['auth:api', 'check.permissions'])->group(function () { Route::patch('single/goods_skus/{id}', [GoodsSkusController::class, 'updateField'])->name('goods_sku.single_update'); // 店铺 Route::resource('shops', 'Shop\ShopsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]); + Route::get('count/orders/num', [ShopsController::class, 'countOrdersNumWithSkuCode'])->name('goods_sku.orders_num'); // 角色 Route::resource('roles', 'Role\RolesController', ['only' => ['index', 'store', 'show', 'update']]); Route::post('roles/{id}/permissions', [RolesController::class, 'addPermissions'])->name('roles.permission'); From 0d7a59217cf7c139ae1e078d45e78e07c206ec12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Fri, 12 Aug 2022 17:45:33 +0800 Subject: [PATCH 32/33] =?UTF-8?q?feat:=20#10000=20=E9=A2=84=E7=95=99?= =?UTF-8?q?=E9=87=8F=E4=BF=AE=E6=94=B9=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Goods/GoodsSkusController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index b70843d..30fb032 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -302,8 +302,7 @@ class GoodsSkusController extends Controller $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { $this->setValidatorFailResponse($validator->getMessageBag()->getMessages()); - - return response($this->res, $this->res['httpCode']); + goto end; } $updateField = \request('updateField'); $sku = GoodsSku::query()->find($id); @@ -322,12 +321,17 @@ class GoodsSkusController extends Controller $this->setBeforeUpdate($sku->$updateField); if ('reserve' === $updateField) { $changeNum = $sku->reserve - $request->reserve; + if (0 > $changeNum + $sku->stock) { + $this->setValidatorFailResponse('预留量超过库存数量'); + goto end; + } $sku->stock += $changeNum; } $sku->$updateField = $request->$updateField; $sku->save(); $this->setAfterUpdate($sku->$updateField); $this->addLog($id, $updateField); + end: return response($this->res, $this->res['httpCode']); } From c3bb6f0054a5a94a50e244357eded593af622334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Fri, 12 Aug 2022 17:52:28 +0800 Subject: [PATCH 33/33] =?UTF-8?q?feat:=20#10000=20=E6=8D=9F=E8=80=97?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Goods/GoodsSkusController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index 30fb032..b165a28 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -317,6 +317,8 @@ class GoodsSkusController extends Controller $record->save(); $this->setAfterUpdate($record->loss_num); $sku->stock -= $request->loss_num; + } else { + $sku->$updateField = $request->$updateField; } $this->setBeforeUpdate($sku->$updateField); if ('reserve' === $updateField) { @@ -327,7 +329,6 @@ class GoodsSkusController extends Controller } $sku->stock += $changeNum; } - $sku->$updateField = $request->$updateField; $sku->save(); $this->setAfterUpdate($sku->$updateField); $this->addLog($id, $updateField);