diff --git a/README.md b/README.md index 9b55000..735ad4a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ ## CatchAdmin -- 该项目采用前后端分离,所以 PHP 作为 API 开发,vue 作为后台开发,两个项目是分开的,单独部署。 +- 该项目采用`前后端分离`,所以 PHP 作为 API 开发,vue 作为后台开发 +- 两个项目是分开的,单独部署。 ## 这是 vue 分支 开发中 - [vue 项目地址](https://github.com/yanwenwu/catch-admin-vue) @@ -37,6 +38,14 @@ 请大家不要随意添加数据,因为没有意义,只看 `catchadmin` 的文档就可以了。 如果有太多脏数据的话,我会关闭该账号。 +### 系列文章 +如果是刚开始使用 thinkphp6, 以下文章可能会对你有些许帮助,文章基于 RC3 版本。整体架构是不变的。 +- [启动分析](https://www.kancloud.cn/akasishikelu/thinkphp6/1129385) +- [Request 解析](https://www.kancloud.cn/akasishikelu/thinkphp6/1134496) +- [应用初始化](https://www.kancloud.cn/akasishikelu/thinkphp6/1130427) +- [中间件分析](https://www.kancloud.cn/akasishikelu/thinkphp6/1136616) +- [请求流程](https://www.kancloud.cn/akasishikelu/thinkphp6/1136608) + ### Talking - [论坛讨论](http://bbs.catchadmin.com) - 可以提 ISSUE,请按照 issue 模板提问 diff --git a/app/service.php b/app/service.php index 8cf768c..2fb4f9c 100644 --- a/app/service.php +++ b/app/service.php @@ -1,4 +1,4 @@ get('login', '\catchAdmin\login\controller\Index@index'); # 登入 $router->post('login', '\catchAdmin\login\controller\Index@login'); -# 登出 -$router->post('logout', '\catchAdmin\login\controller\Index@logout'); -# 验证码 -$router->get('catch/captcha/[:config]','\catchAdmin\login\controller\Index@captcha'); diff --git a/composer.json b/composer.json index b4a4c32..79a4a86 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ "topthink/think-migration": "^3.0", "thans/tp-jwt-auth": "^1.0", "workerman/workerman": "^3.5", - "jaguarjack/think-filesystem-cloud": "dev-master" + "jaguarjack/think-filesystem-cloud": "dev-master", + "overtrue/wechat": "^4.2" }, "require-dev": { "symfony/var-dumper": "^4.2", diff --git a/composer.lock b/composer.lock index b5d0a6a..187c6d7 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b823383f18570fde6f461ccede883667", + "content-hash": "eea5a366fe207bb79ee9fc0ad91f7b10", "packages": [ { "name": "aliyuncs/oss-sdk-php", @@ -53,6 +53,56 @@ "homepage": "http://www.aliyun.com/product/oss/", "time": "2019-11-15T11:05:42+00:00" }, + { + "name": "easywechat-composer/easywechat-composer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/mingyoung/easywechat-composer.git", + "reference": "bebd2fee768c5e47449d0317067f43bab10fe1eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mingyoung/easywechat-composer/zipball/bebd2fee768c5e47449d0317067f43bab10fe1eb", + "reference": "bebd2fee768c5e47449d0317067f43bab10fe1eb", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "composer-plugin-api": "^1.0", + "php": ">=7.0" + }, + "require-dev": { + "composer/composer": "^1.0", + "phpunit/phpunit": "^6.5 || ^7.0" + }, + "type": "composer-plugin", + "extra": { + "class": "EasyWeChatComposer\\Plugin" + }, + "autoload": { + "psr-4": { + "EasyWeChatComposer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "张铭阳", + "email": "mingyoungcheung@gmail.com" + } + ], + "description": "The composer plugin for EasyWeChat", + "time": "2019-09-19T13:39:05+00:00" + }, { "name": "guzzlehttp/command", "version": "1.0.0", @@ -699,6 +749,93 @@ "description": "An adapter decorator to enable meta-data caching.", "time": "2018-07-09T20:51:04+00:00" }, + { + "name": "monolog/monolog", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "c861fcba2ca29404dc9e617eedd9eff4616986b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c861fcba2ca29404dc9e617eedd9eff4616986b8", + "reference": "c861fcba2ca29404dc9e617eedd9eff4616986b8", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2", + "psr/log": "^1.0.1" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^6.0", + "graylog2/gelf-php": "^1.4.2", + "jakub-onderka/php-parallel-lint": "^0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpspec/prophecy": "^1.6.1", + "phpunit/phpunit": "^8.3", + "predis/predis": "^1.1", + "rollbar/rollbar": "^1.3", + "ruflin/elastica": ">=0.90 <3.0", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "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" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2019-12-20T14:22:59+00:00" + }, { "name": "nesbot/carbon", "version": "2.29.1", @@ -941,6 +1078,195 @@ "description": "Flysystem adapter for the Qiniu storage.", "time": "2019-08-16T03:20:56+00:00" }, + { + "name": "overtrue/socialite", + "version": "2.0.14", + "source": { + "type": "git", + "url": "https://github.com/overtrue/socialite.git", + "reference": "a18f195b0d370350752187e78d33c835a41db703" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/overtrue/socialite/zipball/a18f195b0d370350752187e78d33c835a41db703", + "reference": "a18f195b0d370350752187e78d33c835a41db703", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-json": "*", + "guzzlehttp/guzzle": "~5.0|~6.0", + "php": ">=7.0", + "symfony/http-foundation": "^2.7|^3.0|^4.0" + }, + "conflict": { + "socialiteproviders/weixin": "*" + }, + "require-dev": { + "mockery/mockery": "~1.2", + "phpunit/phpunit": "~6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Overtrue\\Socialite\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "overtrue", + "email": "anzhengchao@gmail.com" + } + ], + "description": "A collection of OAuth 2 packages that extracts from laravel/socialite.", + "keywords": [ + "login", + "oauth", + "qq", + "social", + "wechat", + "weibo" + ], + "time": "2020-02-07T05:12:10+00:00" + }, + { + "name": "overtrue/wechat", + "version": "4.2.13", + "source": { + "type": "git", + "url": "https://github.com/overtrue/wechat.git", + "reference": "26861367db892fa9980ad38453b5b6a9e750caa6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/overtrue/wechat/zipball/26861367db892fa9980ad38453b5b6a9e750caa6", + "reference": "26861367db892fa9980ad38453b5b6a9e750caa6", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "easywechat-composer/easywechat-composer": "^1.1", + "ext-fileinfo": "*", + "ext-openssl": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^6.2", + "monolog/monolog": "^1.22 || ^2.0", + "overtrue/socialite": "~2.0", + "php": ">=7.2", + "pimple/pimple": "^3.0", + "psr/simple-cache": "^1.0", + "symfony/cache": "^3.3 || ^4.3 || ^5.0", + "symfony/event-dispatcher": "^4.3 || ^5.0", + "symfony/http-foundation": "^2.7 || ^3.0 || ^4.0 || ^5.0", + "symfony/psr-http-message-bridge": "^0.3 || ^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.15", + "mikey179/vfsstream": "^1.6", + "mockery/mockery": "^1.2.3", + "phpstan/phpstan": "^0.12.0", + "phpunit/phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "EasyWeChat\\": "src/" + }, + "files": [ + "src/Kernel/Support/Helpers.php", + "src/Kernel/Helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "overtrue", + "email": "anzhengchao@gmail.com" + } + ], + "description": "微信SDK", + "keywords": [ + "easywechat", + "sdk", + "wechat", + "weixin", + "weixin-sdk" + ], + "time": "2020-02-11T21:05:23+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2018-01-21T07:42:36+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -1048,6 +1374,58 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "time": "2019-01-08T18:20:26+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -1367,6 +1745,492 @@ "description": "A polyfill for getallheaders.", "time": "2019-03-08T08:55:37+00:00" }, + { + "name": "symfony/cache", + "version": "v5.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache.git", + "reference": "4572116c640a6bc9fc0047180fe7f9362e5923fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache/zipball/4572116c640a6bc9fc0047180fe7f9362e5923fc", + "reference": "4572116c640a6bc9fc0047180fe7f9362e5923fc", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2.5", + "psr/cache": "~1.0", + "psr/log": "~1.0", + "symfony/cache-contracts": "^1.1.7|^2", + "symfony/service-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" + }, + "conflict": { + "doctrine/dbal": "<2.5", + "symfony/dependency-injection": "<4.4", + "symfony/http-kernel": "<4.4", + "symfony/var-dumper": "<4.4" + }, + "provide": { + "psr/cache-implementation": "1.0", + "psr/simple-cache-implementation": "1.0", + "symfony/cache-implementation": "1.0" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/cache": "~1.6", + "doctrine/dbal": "~2.5", + "predis/predis": "~1.1", + "psr/simple-cache": "^1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Cache\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Cache component with PSR-6, PSR-16, and tags", + "homepage": "https://symfony.com", + "keywords": [ + "caching", + "psr6" + ], + "time": "2020-01-31T09:13:47+00:00" + }, + { + "name": "symfony/cache-contracts", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache-contracts.git", + "reference": "23ed8bfc1a4115feca942cb5f1aacdf3dcdf3c16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/23ed8bfc1a4115feca942cb5f1aacdf3dcdf3c16", + "reference": "23ed8bfc1a4115feca942cb5f1aacdf3dcdf3c16", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2.5", + "psr/cache": "^1.0" + }, + "suggest": { + "symfony/cache-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Cache\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to caching", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-11-18T17:27:11+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v5.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "4a7a8cdca1120c091b4797f0e5bba69c1e783224" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4a7a8cdca1120c091b4797f0e5bba69c1e783224", + "reference": "4a7a8cdca1120c091b4797f0e5bba69c1e783224", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2.5", + "symfony/event-dispatcher-contracts": "^2" + }, + "conflict": { + "symfony/dependency-injection": "<4.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^4.4|^5.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "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": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2020-01-10T21:57:37+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "af23c2584d4577d54661c434446fb8fbed6025dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/af23c2584d4577d54661c434446fb8fbed6025dd", + "reference": "af23c2584d4577d54661c434446fb8fbed6025dd", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2.5", + "psr/event-dispatcher": "^1" + }, + "suggest": { + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-11-18T17:27:11+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v4.4.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "491a20dfa87e0b3990170593bc2de0bb34d828a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/491a20dfa87e0b3990170593bc2de0bb34d828a5", + "reference": "491a20dfa87e0b3990170593bc2de0bb34d828a5", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1.3", + "symfony/mime": "^4.3|^5.0", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/expression-language": "^3.4|^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "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": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2020-01-31T09:11:17+00:00" + }, + { + "name": "symfony/mime", + "version": "v5.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "2a3c7fee1f1a0961fa9cf360d5da553d05095e59" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/2a3c7fee1f1a0961fa9cf360d5da553d05095e59", + "reference": "2a3c7fee1f1a0961fa9cf360d5da553d05095e59", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "conflict": { + "symfony/mailer": "<4.4" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10", + "symfony/dependency-injection": "^4.4|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "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": "A library to manipulate MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "time": "2020-01-04T14:08:26+00:00" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.14.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "6842f1a39cf7d580655688069a03dd7cd83d244a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6842f1a39cf7d580655688069a03dd7cd83d244a", + "reference": "6842f1a39cf7d580655688069a03dd7cd83d244a", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.14-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "time": "2020-01-17T12:01:36+00:00" + }, { "name": "symfony/polyfill-mbstring", "version": "v1.13.1", @@ -1432,6 +2296,202 @@ ], "time": "2019-11-27T14:18:11+00:00" }, + { + "name": "symfony/polyfill-php72", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/psr-http-message-bridge", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/psr-http-message-bridge.git", + "reference": "9d3e80d54d9ae747ad573cad796e8e247df7b796" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/9d3e80d54d9ae747ad573cad796e8e247df7b796", + "reference": "9d3e80d54d9ae747ad573cad796e8e247df7b796", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1", + "psr/http-message": "^1.0", + "symfony/http-foundation": "^4.4 || ^5.0" + }, + "require-dev": { + "nyholm/psr7": "^1.1", + "symfony/phpunit-bridge": "^4.4 || ^5.0", + "zendframework/zend-diactoros": "^1.4.1 || ^2.0" + }, + "suggest": { + "nyholm/psr7": "For a super lightweight PSR-7/17 implementation" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "1.3-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" + ], + "time": "2019-11-25T19:33:50+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "144c5e51266b281231e947b51223ba14acf1a749" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-11-18T17:27:11+00:00" + }, { "name": "symfony/translation", "version": "v5.0.3", @@ -1578,6 +2638,72 @@ ], "time": "2019-11-18T17:27:11+00:00" }, + { + "name": "symfony/var-exporter", + "version": "v5.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-exporter.git", + "reference": "960f9ac0fdbd642461ed29d7717aeb2a94d428b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/960f9ac0fdbd642461ed29d7717aeb2a94d428b9", + "reference": "960f9ac0fdbd642461ed29d7717aeb2a94d428b9", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2.5" + }, + "require-dev": { + "symfony/var-dumper": "^4.4|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\VarExporter\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code", + "homepage": "https://symfony.com", + "keywords": [ + "clone", + "construct", + "export", + "hydrate", + "instantiate", + "serialize" + ], + "time": "2020-01-04T14:08:26+00:00" + }, { "name": "thans/tp-jwt-auth", "version": "v1.0.6", @@ -1909,67 +3035,6 @@ } ], "packages-dev": [ - { - "name": "symfony/polyfill-php72", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.13-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2019-11-27T13:56:44+00:00" - }, { "name": "symfony/var-dumper", "version": "v4.4.2", diff --git a/config/catch.php b/config/catch.php index d57f6e3..778ef73 100644 --- a/config/catch.php +++ b/config/catch.php @@ -1,4 +1,9 @@ [ 'image' => 'fileSize:' . 1024 * 1024 * 5 . '|fileExt:jpg,png,gif,jpeg', 'file' => 'fileSize:' . 1024 * 1024 * 10 . '|fileExt:txt,pdf,xlsx,xls,html' - ] - + ], + /** + * 路由中间件 + * + */ + 'route_middleware' => [ + \catchAdmin\user\AuthTokenMiddleware::class, + \catchAdmin\permissions\PermissionsMiddleware::class, + ], + /** + * 后台事件 + * + */ + 'events' => [ + // 登录日志 + 'loginLog' => [ + LoginLogListener::class, + ], + // 操作日志 + 'operateLog' => [ + OperateLogListener::class, + ], + // 路由加载 + 'RouteLoaded' => [ + LoadModuleRoutes::class + ], + ], ]; diff --git a/catch/CatchAdminService.php b/extend/catcher/CatchAdminService.php similarity index 75% rename from catch/CatchAdminService.php rename to extend/catcher/CatchAdminService.php index 28b5c4b..23f2700 100644 --- a/catch/CatchAdminService.php +++ b/extend/catcher/CatchAdminService.php @@ -1,13 +1,6 @@ app->middleware->import([ - 'catch_check_permission' => PermissionsMiddleware::class, - ], 'route'); + // todo } /** @@ -112,20 +101,16 @@ class CatchAdminService extends Service */ protected function registerListeners(): void { - $this->app->event->listenEvents([ - 'loginLog' => [ - LoginLogListener::class, - ], - 'operateLog' => [ - OperateLogListener::class, - ], - 'RouteLoaded' => [ - LoadModuleRoutes::class - ], - ]); + $this->app->event->listenEvents(config('catch.events')); } - protected function registerQuery() + /** + * register query + * + * @time 2020年02月20日 + * @return void + */ + protected function registerQuery(): void { $connections = $this->app->config->get('database.connections'); @@ -136,7 +121,13 @@ class CatchAdminService extends Service ], 'database'); } - protected function registerExceptionHandle() + /** + * register exception + * + * @time 2020年02月20日 + * @return void + */ + protected function registerExceptionHandle(): void { $this->app->bind(Handle::class, CatchExceptionHandle::class); } diff --git a/extend/catcher/CatchExceptionHandle.php b/extend/catcher/CatchExceptionHandle.php index c9f65d2..1feec71 100644 --- a/extend/catcher/CatchExceptionHandle.php +++ b/extend/catcher/CatchExceptionHandle.php @@ -1,61 +1,61 @@ -getMessage()); - } - - return parent::render($request, $e); - } -} \ No newline at end of file +getMessage()); + } + + return parent::render($request, $e); + } +} diff --git a/extend/catcher/CatchForm.php b/extend/catcher/CatchForm.php deleted file mode 100644 index a850ae1..0000000 --- a/extend/catcher/CatchForm.php +++ /dev/null @@ -1,433 +0,0 @@ -action = $acton; - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param $method - * @return CatchForm - */ - public function method($method): CatchForm - { - $this->method = $method; - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param $formId - * @return CatchForm - */ - public function formId($formId): CatchForm - { - $this->formId = $formId; - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param string $enctype - * @return CatchForm - */ - public function enctype($enctype ="multipart/form-data"): CatchForm - { - $this->enctype = $enctype; - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param $id - * @return CatchForm - */ - public function id($id): CatchForm - { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'id' => sprintf('id="%s"', $id), - ]); - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param string $class - * @param string $labelClass - * @param string $inlineClass - * @return CatchForm - */ - public function class($class='', $labelClass = '', $inlineClass = ''): CatchForm - { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'class' => $class, - 'labelClass' => $labelClass, - 'inlineClass' => $inlineClass, - ]); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param array $options - * @return CatchForm - */ - public function options(array $options): CatchForm - { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'options' => $options, - ]); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param $value - * @return CatchForm - */ - public function default($value): CatchForm - { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'default' => $value, - ]); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @return CatchForm - */ - public function disabled(): CatchForm - { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'disabled' => '', - - ]); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param $content - * @return CatchForm - */ - public function placeholder($content): CatchForm - { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'placeholder' => 'placeholder='.$content, - ]); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @return CatchForm - */ - public function readonly(): CatchForm - { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'readonly' => 'readonly', - ]); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @return string - */ - public function render(): string - { - $form = sprintf('
', $this->formId, $this->formId); - - foreach ($this->fields as $field) { - $form .= in_array($field['type'], ['hidden']) ? - $this->{$field['type'].'Field'}($field) - : sprintf($this->baseField(), - $field['labelClass'] ?? '', - $field['label'], - $field['inlineClass'] ?? '', - $this->{$field['type'].'Field'}($field)); - } - - return $form . $this->btn. '
'; - } - - /** - * - * @time 2019年12月10日 - * @param $append - * @return CatchForm - */ - public function append($append): CatchForm - { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'append' => $append, - ]); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param $method - * @param $arguments - * @return $this - */ - public function __call($method, $arguments) - { - // TODO: Implement __call() method. - $this->name = $arguments[0] ?? ''; - $label = $arguments[1] ?? ''; - $required = $arguments[2] ?? false; - - $this->fields[$this->name] = [ - 'name' => $this->name, - 'type' => $method, - 'label' => $required ? '* '.$label : $label, - 'inline' => false, - ]; - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @return CatchForm - */ - protected function inline(): CatchForm - { - $this->fields[] = array_merge($this->fields, [ - 'inline' => true, - ]); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @return string - */ - private function baseField(): string - { - return - '
- -
- %s -
-
'; - } - - /** - * form btn - * - * @time 2019年12月06日 - * @param $filter - * @param string $position - * @return CatchForm - */ - public function formBtn($filter, $position = 'text-right'): CatchForm - { - $this->btn = sprintf('
- - -
', $position, $filter); - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param $rule - * @param array $equalTo - * @return CatchForm - */ - public function verify($rule, $equalTo = []): CatchForm - { - if (empty($equalTo)) { - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'verify' => sprintf('lay-verType="tips" lay-verify="%s"', $rule), - ]); - } else { - [$id, $msg] = $equalTo; - - $this->fields[$this->name] = array_merge($this->fields[$this->name], [ - 'verify' => sprintf(' lay-verType="tips" lay-verify="%s" lay-equalTo="#%s" - lay-equalToText="%s" ', $rule, $id, $msg), - ]); - } - - return $this; - } - - /** - * - * @time 2019年12月10日 - * @param $field - * @return string - */ - private function textField($field) - { - return - sprintf('', - $field['name'], - $field['id'] ?? '', - $field['class'] ?? '', - $field['default'] ?? '', - $field['readonly'] ?? '', - $field['placeholder'] ?? '', - $field['disabled'] ?? '', - $field['verify'] ?? '' - ); - - } - - /** - * - * @time 2019年12月10日 - * @param $field - * @return string - */ - private function selectField($field) - { - $select = sprintf(''; - } - - /** - * - * @time 2019年12月10日 - * @param $field - * @return string - */ - private function passwordField($field) - { - return sprintf('', - $field['name'], - $field['id'] ?? '', - $field['verify'] ?? '', - $field['placeholder'] ?? '' - ); - } - - private function radioField($field) - { - $radio = ''; - foreach ($field['options'] as $option) { - $radio .= sprintf('', - $field['name'], $option['value'], $option['title'], $option['value'] == $field['default'] ? 'checked' : '' - ); - } - - return $radio; - } - - /** - * - * @time 2019年12月09日 - * @param $field - * @return string - */ - private function textareaField($field): string - { - return sprintf('', - $field['name'], - $field['placeholder'] ?? '', - $field['default'] ?? '' - ); - } - - private function domField($field) - { - return $field['name']; - } - - /** - * - * @time 2019年12月10日 - * @param $field - * @return string - */ - private function hiddenField($field): string - { - return sprintf('', - $field['name'], $field['default'] - ); - } - - private function imageField() - {} - -} diff --git a/extend/catcher/command/InstallCommand.php b/extend/catcher/command/InstallCommand.php index 6d7e473..d6bfdca 100644 --- a/extend/catcher/command/InstallCommand.php +++ b/extend/catcher/command/InstallCommand.php @@ -129,11 +129,17 @@ class InstallCommand extends Command $prefix = $this->output->ask($this->input, '👉 please input table prefix, default (null):') ? : ''; $username = $this->output->ask($this->input, '👉 please input database username default (root): ') ? : 'root'; $password = ''; + $tryTimes = 0; while (!$password) { $password = $this->output->ask($this->input, '👉 please input database password: '); if ($password) { break; } + // 尝试三次以上未填写,视为密码空 + $tryTimes++; + if (!$password && $tryTimes > 2) { + break; + } } $this->databaseLink = [$host, $database, $username, $password, $port, $charset, $prefix]; diff --git a/extend/catcher/event/LoadModuleRoutes.php b/extend/catcher/event/LoadModuleRoutes.php index 9904410..42d87b2 100644 --- a/extend/catcher/event/LoadModuleRoutes.php +++ b/extend/catcher/event/LoadModuleRoutes.php @@ -3,6 +3,7 @@ declare (strict_types = 1); namespace catcher\event; +use catchAdmin\permissions\PermissionsMiddleware; use catchAdmin\user\AuthTokenMiddleware; use catcher\CatchAdmin; use think\Route; @@ -23,18 +24,20 @@ class LoadModuleRoutes $routes = CatchAdmin::getRoutes(); + $routeMiddleware = config('catch.route_middleware'); + if ($domain) { $router->domain($domain, function () use ($router, $routes) { foreach ($routes as $route) { include $route; } - })->middleware([AuthTokenMiddleware::class]); + })->middleware($routeMiddleware); } else { $router->group(function () use ($router, $routes) { foreach ($routes as $route) { include $route; } - })->middleware([AuthTokenMiddleware::class]); + })->middleware($routeMiddleware); } // 单独加载登录 diff --git a/public/.htaccess b/public/.htaccess index 77c0db6..d1d2088 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -5,4 +5,5 @@ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,PT,L] + SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0