kphcdr il y a 1 an
Parent
commit
20928b2023
4 fichiers modifiés avec 313 ajouts et 1 suppressions
  1. 9 0
      app/Console/Commands/ExportCommand.php
  2. 11 0
      app/Exceptions/Handler.php
  3. 1 0
      composer.json
  4. 292 1
      composer.lock

+ 9 - 0
app/Console/Commands/ExportCommand.php

@@ -5,6 +5,9 @@ namespace App\Console\Commands;
 use App\Exceptions\ClientException;
 use App\Import\CategoryImport;
 use App\Models\Goods\Category;
+use EasyWeChat\Kernel\Exceptions\ServiceNotFoundException;
+use Guanguans\Notify\Factory;
+use http\Exception\RuntimeException;
 use Illuminate\Console\Command;
 use Illuminate\Support\Facades\DB;
 use Maatwebsite\Excel\Facades\Excel;
@@ -71,4 +74,10 @@ class ExportCommand extends Command
         });
 
     }
+
+    public function robot()
+    {
+        throw new ServiceNotFoundException("找不到");
+//        dump(1/0);
+    }
 }

+ 11 - 0
app/Exceptions/Handler.php

@@ -2,6 +2,7 @@
 
 namespace App\Exceptions;
 
+use Guanguans\Notify\Factory;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Illuminate\Support\Arr;
 use Illuminate\Validation\ValidationException;
@@ -47,6 +48,16 @@ class Handler extends ExceptionHandler
             logger()->warning($e->getMessage(), array_merge(request()->all(), request()->headers->all()));
             return false;
         });
+        $this->reportable(function (\Throwable $e) {
+            if (!\App::isLocal()) {
+                Factory::weWork()
+                    ->setToken('c7264726-9a21-4e5c-b0e8-9020a9b4ca62')
+                    ->setMessage((new \Guanguans\Notify\Messages\WeWork\TextMessage([
+                        'content' => $e->getMessage() . "\n" . $e->getTraceAsString(),
+                    ])))->send();
+            }
+            return false;
+        });
         $this->renderable(function (ClientException $e) {
             return response()->json([
                 'code' => 400,

+ 1 - 0
composer.json

@@ -7,6 +7,7 @@
     "require": {
         "php": "^8.0.2",
         "elfsundae/laravel-hashid": "^1.7",
+        "guanguans/notify": "^1.25",
         "guzzlehttp/guzzle": "^7.2",
         "laravel/framework": "^9.19",
         "laravel/tinker": "^2.7",

+ 292 - 1
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": "e26e92d469452b9f76d8d37af4139f7b",
+    "content-hash": "6f00ae709213049914d3197fa78e8632",
     "packages": [
         {
             "name": "brick/math",
@@ -959,6 +959,160 @@
             "time": "2022-07-30T15:56:11+00:00"
         },
         {
+            "name": "guanguans/notify",
+            "version": "v1.25.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/guanguans/notify.git",
+                "reference": "1795da37fd850cd8923a142f4b39f412180195cb"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/guanguans/notify/zipball/1795da37fd850cd8923a142f4b39f412180195cb",
+                "reference": "1795da37fd850cd8923a142f4b39f412180195cb",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-json": "*",
+                "overtrue/http": "^1.2",
+                "php": ">=7.2.5",
+                "psr/log": "^1.1 || ^2.0 || ^3.0",
+                "symfony/options-resolver": "^5.4 || ^6.0"
+            },
+            "require-dev": {
+                "brainmaestro/composer-git-hooks": "^2.8 || ^3.0",
+                "dms/phpunit-arraysubset-asserts": "^0.4.0",
+                "friendsofphp/php-cs-fixer": "^3.4",
+                "jetbrains/phpstorm-attributes": "^1.0",
+                "johnkary/phpunit-speedtrap": "^4.0",
+                "mockery/mockery": "^1.3",
+                "nyholm/nsa": "^1.3",
+                "php-mock/php-mock-phpunit": "^2.6",
+                "phpbench/phpbench": "^1.1",
+                "phpstan/extension-installer": "^1.2",
+                "phpstan/phpstan": "^1.9",
+                "phpstan/phpstan-deprecation-rules": "^1.1",
+                "phpstan/phpstan-phpunit": "^1.3",
+                "phpunit/phpunit": "^8.5 || ^9.5",
+                "rector/rector": "^0.15.7",
+                "roave/security-advisories": "dev-latest",
+                "spatie/phpunit-snapshot-assertions": "^3.0 || ^4.2",
+                "symfony/mailer": "^5.4 || ^6.0",
+                "symfony/var-dumper": "^5.4 || ^6.0",
+                "textalk/websocket": "^1.5",
+                "vimeo/psalm": "^4.30 || ^5.4"
+            },
+            "suggest": {
+                "symfony/mailer": "Required to use the email.",
+                "textalk/websocket": "Required to use the QQ channel bot."
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-main": "1.x-dev"
+                },
+                "hooks": {
+                    "post-merge": [
+                        "composer checks"
+                    ],
+                    "pre-commit": [
+                        "composer checks"
+                    ]
+                }
+            },
+            "autoload": {
+                "files": [
+                    "src/Support/helpers.php"
+                ],
+                "psr-4": {
+                    "Guanguans\\Notify\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "guanguans",
+                    "email": "ityaozm@gmail.com",
+                    "homepage": "https://www.guanguans.cn",
+                    "role": "developer"
+                }
+            ],
+            "description": "推送通知 sdk(Bark、Chanify、钉钉群机器人、Discord、邮件、飞书群机器人、Gitter、Google Chat、iGot、Logger、Mattermost、Microsoft Teams、Now Push、Ntfy、PushBack、Push、PushDeer、PushPlus、QQ 频道机器人、Rocket Chat、Server 酱、Showdoc Push、Slack、Telegram、Webhook、企业微信群机器人、息知、一封传话、Zulip)。",
+            "homepage": "https://github.com/guanguans/notify",
+            "keywords": [
+                "Bark",
+                "Feishu",
+                "Mattermost",
+                "Ntfy",
+                "PushDeer",
+                "QQ Bot",
+                "QQ 机器人",
+                "QQ 频道",
+                "QQ 频道机器人",
+                "Server酱",
+                "chanify",
+                "dingtalk",
+                "discord",
+                "email",
+                "gitter",
+                "googleChat",
+                "iGot",
+                "logger",
+                "microsoft teams",
+                "notification",
+                "notifier",
+                "notify",
+                "now push",
+                "push",
+                "pushBack",
+                "pushPlus",
+                "pushover",
+                "qq",
+                "rocketchat",
+                "sdk",
+                "serverChan",
+                "showdoc push",
+                "slack",
+                "telegram",
+                "webhook",
+                "wework",
+                "xiZhi",
+                "zulip",
+                "一封传话",
+                "企业微信",
+                "企业微信群机器人",
+                "微信",
+                "息知",
+                "机器人",
+                "邮件",
+                "钉钉",
+                "钉钉群",
+                "钉钉群机器人",
+                "飞书",
+                "飞书群机器人"
+            ],
+            "support": {
+                "issues": "https://github.com/guanguans/notify/issues",
+                "source": "https://github.com/guanguans/notify"
+            },
+            "funding": [
+                {
+                    "url": "https://www.guanguans.cn/images/wechat.jpeg",
+                    "type": "wechat"
+                }
+            ],
+            "time": "2023-01-19T03:13:50+00:00"
+        },
+        {
             "name": "guzzlehttp/guzzle",
             "version": "7.5.1",
             "source": {
@@ -3252,6 +3406,70 @@
             "time": "2021-05-12T11:11:27+00:00"
         },
         {
+            "name": "overtrue/http",
+            "version": "1.2.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/overtrue/http.git",
+                "reference": "e6e4c2ff274b1050d681288495878ee8fd3f1209"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/overtrue/http/zipball/e6e4c2ff274b1050d681288495878ee8fd3f1209",
+                "reference": "e6e4c2ff274b1050d681288495878ee8fd3f1209",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-curl": "*",
+                "ext-json": "*",
+                "ext-libxml": "*",
+                "ext-simplexml": "*",
+                "guzzlehttp/guzzle": "^6.3 || ^7.0",
+                "php": ">=7.0"
+            },
+            "require-dev": {
+                "brainmaestro/composer-git-hooks": "^2.7",
+                "friendsofphp/php-cs-fixer": "^2.15 || ^3.0",
+                "mockery/mockery": "^1.0",
+                "overtrue/phplint": "^1.1 || ^2.0 || ^3.0",
+                "phpunit/phpunit": "^6.5 || ^8.5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Overtrue\\Http\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "overtrue",
+                    "email": "anzhengchao@gmail.com"
+                }
+            ],
+            "description": "A simple http client wrapper.",
+            "support": {
+                "issues": "https://github.com/overtrue/http/issues",
+                "source": "https://github.com/overtrue/http/tree/1.2.3"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/overtrue",
+                    "type": "github"
+                }
+            ],
+            "time": "2022-03-14T06:24:13+00:00"
+        },
+        {
             "name": "overtrue/socialite",
             "version": "4.8.0",
             "source": {
@@ -5840,6 +6058,79 @@
             "time": "2023-01-11T11:50:03+00:00"
         },
         {
+            "name": "symfony/options-resolver",
+            "version": "v6.0.19",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/options-resolver.git",
+                "reference": "6a180d1c45e0d9797470ca9eb46215692de00fa3"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/options-resolver/zipball/6a180d1c45e0d9797470ca9eb46215692de00fa3",
+                "reference": "6a180d1c45e0d9797470ca9eb46215692de00fa3",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=8.0.2",
+                "symfony/deprecation-contracts": "^2.1|^3"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\OptionsResolver\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Provides an improved replacement for the array_replace PHP function",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "config",
+                "configuration",
+                "options"
+            ],
+            "support": {
+                "source": "https://github.com/symfony/options-resolver/tree/v6.0.19"
+            },
+            "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": "2023-01-01T08:36:10+00:00"
+        },
+        {
             "name": "symfony/polyfill-ctype",
             "version": "v1.27.0",
             "source": {