From 13d8d1777d1dc0ae62384ca8274445ea5c8b6ff7 Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 9 Oct 2019 14:03:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E8=A6=81=E9=87=8D=E6=96=B0=E6=95=B4?= =?UTF-8?q?=E5=90=88=E6=A1=86=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ExceptionHandle.php | 1 - app/middleware/AdminLog.php | 4 +- app/middleware/PermissionRecord.php | 2 +- composer.json | 3 +- composer.lock | 113 ++++++++++++++++++++-------- config/app.php | 2 +- config/captcha.php | 39 ++++++++++ config/{template.php => view.php} | 3 +- 8 files changed, 130 insertions(+), 37 deletions(-) create mode 100644 config/captcha.php rename config/{template.php => view.php} (95%) diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php index 375e841..6cceb4c 100644 --- a/app/ExceptionHandle.php +++ b/app/ExceptionHandle.php @@ -61,7 +61,6 @@ class ExceptionHandle extends Handle public function render($request, Throwable $e): Response { // 添加自定义异常处理机制 - // 其他错误交给系统处理 return parent::render($request, $e); } diff --git a/app/middleware/AdminLog.php b/app/middleware/AdminLog.php index b0a3d1a..3518e88 100644 --- a/app/middleware/AdminLog.php +++ b/app/middleware/AdminLog.php @@ -19,13 +19,13 @@ class AdminLog } - $is_exit = $logged_admin_permission->where('app',$request->app()) + $is_exit = $logged_admin_permission->where('app',app('http')->getName()) ->where('controller',$request->controller()) ->where('action',$request->action()); if(!$is_exit->isEmpty()){ AppAdminLog::create([ - 'app'=>$request->app(), + 'app'=>app('http')->getName(), 'controller'=>$request->controller(), 'action'=>$request->action(), 'param'=>$request->param(), diff --git a/app/middleware/PermissionRecord.php b/app/middleware/PermissionRecord.php index 884b553..bb09bfd 100644 --- a/app/middleware/PermissionRecord.php +++ b/app/middleware/PermissionRecord.php @@ -11,7 +11,7 @@ class PermissionRecord { $current_access_info = [ - 'app'=>$request->app(), + 'app'=>app('http')->getName(), 'controller'=>$request->controller(), 'action'=>$request->action() ]; diff --git a/composer.json b/composer.json index 7deba8c..841dcde 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "topthink/think-view": "^1.0", "topthink/think-migration": "^3.0", "topthink/think-helper": "^3.1", - "topthink/think-captcha": "^3.0" + "topthink/think-captcha": "^3.0", + "topthink/think-multi-app": "^1.0" }, "require-dev": { "symfony/var-dumper": "^4.2" diff --git a/composer.lock b/composer.lock index 4bc4d76..c0493aa 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": "0ce3c4389679ec95fb18c7578e5a0eca", + "content-hash": "f1eea88aa96466e1b83b1303306f9a13", "packages": [ { "name": "league/flysystem", @@ -436,12 +436,12 @@ "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "3f851f5d2105ea43843363093c3c945f0bdc2e3c" + "reference": "768f12f01daa0bd96ef4ad8771d80fb6fec137c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/3f851f5d2105ea43843363093c3c945f0bdc2e3c", - "reference": "3f851f5d2105ea43843363093c3c945f0bdc2e3c", + "url": "https://api.github.com/repos/top-think/framework/zipball/768f12f01daa0bd96ef4ad8771d80fb6fec137c8", + "reference": "768f12f01daa0bd96ef4ad8771d80fb6fec137c8", "shasum": "", "mirrors": [ { @@ -496,20 +496,20 @@ "orm", "thinkphp" ], - "time": "2019-09-16T03:49:50+00:00" + "time": "2019-10-08T14:53:51+00:00" }, { "name": "topthink/think-captcha", - "version": "v3.0.1", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/top-think/think-captcha.git", - "reference": "9fc0c627d773f6a54a8dd142ebf358f746557a48" + "reference": "0b4305da19e118cefd934007875a8112f9352f01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-captcha/zipball/9fc0c627d773f6a54a8dd142ebf358f746557a48", - "reference": "9fc0c627d773f6a54a8dd142ebf358f746557a48", + "url": "https://api.github.com/repos/top-think/think-captcha/zipball/0b4305da19e118cefd934007875a8112f9352f01", + "reference": "0b4305da19e118cefd934007875a8112f9352f01", "shasum": "", "mirrors": [ { @@ -526,7 +526,10 @@ "think": { "services": [ "think\\captcha\\CaptchaService" - ] + ], + "config": { + "captcha": "src/config.php" + } } }, "autoload": { @@ -548,20 +551,20 @@ } ], "description": "captcha package for thinkphp", - "time": "2019-06-06T07:16:01+00:00" + "time": "2019-10-03T07:45:11+00:00" }, { "name": "topthink/think-helper", - "version": "v3.1.2", + "version": "v3.1.3", "source": { "type": "git", "url": "https://github.com/top-think/think-helper.git", - "reference": "a629c4271fdf3d7e7c6d89089791417cb4796a2c" + "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-helper/zipball/a629c4271fdf3d7e7c6d89089791417cb4796a2c", - "reference": "a629c4271fdf3d7e7c6d89089791417cb4796a2c", + "url": "https://api.github.com/repos/top-think/think-helper/zipball/4d85dfd3778623bbb1de3648f1dcd0c82f4439f4", + "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4", "shasum": "", "mirrors": [ { @@ -593,7 +596,7 @@ } ], "description": "The ThinkPHP6 Helper Package", - "time": "2019-07-11T04:35:03+00:00" + "time": "2019-09-30T02:36:48+00:00" }, { "name": "topthink/think-migration", @@ -651,18 +654,68 @@ ], "time": "2019-06-17T10:13:39+00:00" }, + { + "name": "topthink/think-multi-app", + "version": "v1.0.5", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-multi-app.git", + "reference": "27bb12fa049e8479a453c75087ef9ad1bda6d730" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/27bb12fa049e8479a453c75087ef9ad1bda6d730", + "reference": "27bb12fa049e8479a453c75087ef9ad1bda6d730", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0.0" + }, + "type": "library", + "extra": { + "think": { + "services": [ + "think\\app\\Service" + ] + } + }, + "autoload": { + "psr-4": { + "think\\app\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp6 multi app support", + "time": "2019-10-08T02:20:35+00:00" + }, { "name": "topthink/think-orm", "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/top-think/think-orm.git", - "reference": "759cc5848dbd3d5b9662040e135011198e882146" + "reference": "01f530a70a31b461557937ea75a7713862418b32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-orm/zipball/759cc5848dbd3d5b9662040e135011198e882146", - "reference": "759cc5848dbd3d5b9662040e135011198e882146", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/01f530a70a31b461557937ea75a7713862418b32", + "reference": "01f530a70a31b461557937ea75a7713862418b32", "shasum": "", "mirrors": [ { @@ -700,7 +753,7 @@ "database", "orm" ], - "time": "2019-09-16T01:27:31+00:00" + "time": "2019-09-27T12:49:28+00:00" }, { "name": "topthink/think-template", @@ -747,16 +800,16 @@ }, { "name": "topthink/think-view", - "version": "v1.0.11", + "version": "v1.0.13", "source": { "type": "git", "url": "https://github.com/top-think/think-view.git", - "reference": "2110794aad592e007f2a8949c07ff50928028073" + "reference": "90803b73f781db5d42619082c4597afc58b2d4c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-view/zipball/2110794aad592e007f2a8949c07ff50928028073", - "reference": "2110794aad592e007f2a8949c07ff50928028073", + "url": "https://api.github.com/repos/top-think/think-view/zipball/90803b73f781db5d42619082c4597afc58b2d4c5", + "reference": "90803b73f781db5d42619082c4597afc58b2d4c5", "shasum": "", "mirrors": [ { @@ -786,7 +839,7 @@ } ], "description": "thinkphp template driver", - "time": "2019-09-10T14:58:31+00:00" + "time": "2019-10-07T12:23:10+00:00" } ], "packages-dev": [ @@ -918,16 +971,16 @@ }, { "name": "symfony/var-dumper", - "version": "v4.3.4", + "version": "v4.3.5", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "641043e0f3e615990a0f29479f9c117e8a6698c6" + "reference": "bde8957fc415fdc6964f33916a3755737744ff05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/641043e0f3e615990a0f29479f9c117e8a6698c6", - "reference": "641043e0f3e615990a0f29479f9c117e8a6698c6", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/bde8957fc415fdc6964f33916a3755737744ff05", + "reference": "bde8957fc415fdc6964f33916a3755737744ff05", "shasum": "", "mirrors": [ { @@ -996,7 +1049,7 @@ "debug", "dump" ], - "time": "2019-08-26T08:26:39+00:00" + "time": "2019-10-04T19:48:13+00:00" } ], "aliases": [], diff --git a/config/app.php b/config/app.php index e4183c6..f780890 100644 --- a/config/app.php +++ b/config/app.php @@ -43,5 +43,5 @@ return [ // 错误显示信息,非调试模式有效 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, + 'show_error_msg' => true, ]; diff --git a/config/captcha.php b/config/captcha.php new file mode 100644 index 0000000..9bbf529 --- /dev/null +++ b/config/captcha.php @@ -0,0 +1,39 @@ + 5, + // 验证码字符集合 + 'codeSet' => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY', + // 验证码过期时间 + 'expire' => 1800, + // 是否使用中文验证码 + 'useZh' => false, + // 是否使用算术验证码 + 'math' => false, + // 是否使用背景图 + 'useImgBg' => false, + //验证码字符大小 + 'fontSize' => 25, + // 是否使用混淆曲线 + 'useCurve' => true, + //是否添加杂点 + 'useNoise' => true, + // 验证码字体 不设置则随机 + 'fontttf' => '', + //背景颜色 + 'bg' => [243, 251, 254], + // 验证码图片高度 + 'imageH' => 0, + // 验证码图片宽度 + 'imageW' => 0, + + // 添加额外的验证码设置 + // verify => [ + // 'length'=>4, + // ... + //], +]; diff --git a/config/template.php b/config/view.php similarity index 95% rename from config/template.php rename to config/view.php index 51a4211..8dbecc3 100644 --- a/config/template.php +++ b/config/view.php @@ -3,13 +3,14 @@ // | 模板设置 // +---------------------------------------------------------------------- + return [ // 模板引擎类型使用Think 'type' => 'Think', // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 'auto_rule' => 1, // 模板基础路径 - 'view_base' => '', + 'view_base' => root_path().'view/', // 模板路径 'view_path' => '', // 模板后缀