From c7a28d953089b1b2dad39c0bc2f60fef9a8daf0b Mon Sep 17 00:00:00 2001 From: tensent Date: Sat, 28 Mar 2020 12:18:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E7=BD=AErouter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app/controller/admin/Base.php | 2 +- app/http/middleware/Validate.php | 2 +- app/http/validate/Category.php | 6 +++--- app/http/validate/Channel.php | 6 +++--- app/http/validate/Config.php | 6 +++--- app/http/validate/Menu.php | 6 +++--- route/app.php | 21 +++++++++++---------- 8 files changed, 26 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index b1b611f6..50c9523a 100755 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ > 最好是使用云主机进行安装,虚拟主机有很多局限性 ``` -git clone -b 4.0 https://gitee.com/sentcms/sentcms.git sentcms +git clone -b 4.x https://gitee.com/sentcms/sentcms.git sentcms cd sentcms ``` > 如果是直接下载压缩包则直接进入解压文件夹,然后执行下面的代码 diff --git a/app/controller/admin/Base.php b/app/controller/admin/Base.php index 14b2f15c..1bc7392d 100644 --- a/app/controller/admin/Base.php +++ b/app/controller/admin/Base.php @@ -11,7 +11,7 @@ namespace app\controller\admin; use app\model\Menu; use think\facade\View; use \app\model\Form; -use \app\Base as BaseC; +use \app\controller\Base as BaseC; class Base extends BaseC { diff --git a/app/http/middleware/Validate.php b/app/http/middleware/Validate.php index 253d3154..06ed0cc6 100755 --- a/app/http/middleware/Validate.php +++ b/app/http/middleware/Validate.php @@ -24,7 +24,7 @@ class Validate { $controller = explode(".", $request->controller()); //获取操作名,用于验证场景scene - $scene = $controller[0] . ucfirst($request->action()); + $scene = $controller[0] . $request->action(); $validate = "app\\http\\validate\\" . strtolower($controller[1]); //仅当验证器存在时 进行校验 if (class_exists($validate) && $request->isPost()) { diff --git a/app/http/validate/Category.php b/app/http/validate/Category.php index 3a3aa1c2..e4a9ac1f 100644 --- a/app/http/validate/Category.php +++ b/app/http/validate/Category.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate\admin; +namespace app\http\validate; use think\Validate; @@ -23,7 +23,7 @@ class Category extends Validate{ ]; protected $scene = [ - 'add' => ['title'], - 'edit' => ['title'], + 'adminadd' => ['title'], + 'adminedit' => ['title'], ]; } \ No newline at end of file diff --git a/app/http/validate/Channel.php b/app/http/validate/Channel.php index 43014197..8663f9a6 100644 --- a/app/http/validate/Channel.php +++ b/app/http/validate/Channel.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate\admin; +namespace app\http\validate; use think\Validate; @@ -23,7 +23,7 @@ class Channel extends Validate{ ]; protected $scene = [ - 'add' => ['title'], - 'edit' => ['title'], + 'adminadd' => ['title'], + 'adminedit' => ['title'], ]; } \ No newline at end of file diff --git a/app/http/validate/Config.php b/app/http/validate/Config.php index 8de14b64..8509b3ac 100644 --- a/app/http/validate/Config.php +++ b/app/http/validate/Config.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate\admin; +namespace app\http\validate; use think\Validate; @@ -26,11 +26,11 @@ class Config extends Validate{ ]; protected $scene = [ - 'add' => ['title', 'name'], + 'adminadd' => ['title', 'name'], ]; // edit 验证场景定义 - public function sceneEdit() { + public function sceneAdminedit() { return $this->only([['title', 'name']]) ->remove('name', 'unique'); } diff --git a/app/http/validate/Menu.php b/app/http/validate/Menu.php index 7d555623..443d42d8 100644 --- a/app/http/validate/Menu.php +++ b/app/http/validate/Menu.php @@ -6,7 +6,7 @@ // +---------------------------------------------------------------------- // | Author: molong // +---------------------------------------------------------------------- -namespace app\http\validate\admin; +namespace app\http\validate; use think\Validate; @@ -23,7 +23,7 @@ class Menu extends Validate{ ]; protected $scene = [ - 'add' => ['title'], - 'edit' => ['title'], + 'adminadd' => ['title'], + 'adminedit' => ['title'], ]; } \ No newline at end of file diff --git a/route/app.php b/route/app.php index 974a2cda..5a4de694 100755 --- a/route/app.php +++ b/route/app.php @@ -10,28 +10,29 @@ // +---------------------------------------------------------------------- use think\facade\Route; -Route::rule('/', 'Front/index'); -Route::rule('search', 'Front/search'); -Route::rule('lists', 'Front/lists'); -Route::rule('detail-:id', 'Front/detail'); -Route::rule('category', 'Front/category'); -Route::rule('topic-:id', 'Front/topic'); -Route::rule('form/:id/:name', 'Front/form'); -Route::rule('front/:function', 'Front/:function'); -Route::rule('upload/:function', 'Upload/:function'); +Route::rule('/', 'Front.Index/index'); +Route::rule('search', 'Front.Content/search'); +Route::rule('lists', 'Front.Content/lists'); +Route::rule('detail-:id', 'Front.Content/detail'); +Route::rule('category', 'Front.Content/category'); +Route::rule('topic-:id', 'Front.Content/topic'); +Route::rule('form/:id/:name', 'Front.Form/index'); +Route::rule('front/:controller/:function', 'Front.:controller/:function'); Route::group('admin', function () { Route::rule('/', 'admin.Index/index'); Route::rule('login', 'admin.Index/login'); Route::rule('logout', 'admin.Index/logout'); + Route::rule('upload/:function', 'Upload/:function'); Route::rule(':controller/:function', 'admin.:controller/:function'); }); Route::group('user', function () { - Route::rule('/', 'admin.Index/index'); + Route::rule('/', 'user.Index/index'); Route::rule('login', 'user.Index/login'); Route::rule('logout', 'user.Index/logout'); Route::rule('register', 'user.Index/register'); + Route::rule('upload/:function', 'Upload/:function'); Route::rule(':controller/:function', 'user.:controller/:function'); });