修复bug,设置router
This commit is contained in:
@@ -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
|
cd sentcms
|
||||||
```
|
```
|
||||||
> 如果是直接下载压缩包则直接进入解压文件夹,然后执行下面的代码
|
> 如果是直接下载压缩包则直接进入解压文件夹,然后执行下面的代码
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace app\controller\admin;
|
|||||||
use app\model\Menu;
|
use app\model\Menu;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use \app\model\Form;
|
use \app\model\Form;
|
||||||
use \app\Base as BaseC;
|
use \app\controller\Base as BaseC;
|
||||||
|
|
||||||
class Base extends BaseC {
|
class Base extends BaseC {
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Validate {
|
|||||||
$controller = explode(".", $request->controller());
|
$controller = explode(".", $request->controller());
|
||||||
|
|
||||||
//获取操作名,用于验证场景scene
|
//获取操作名,用于验证场景scene
|
||||||
$scene = $controller[0] . ucfirst($request->action());
|
$scene = $controller[0] . $request->action();
|
||||||
$validate = "app\\http\\validate\\" . strtolower($controller[1]);
|
$validate = "app\\http\\validate\\" . strtolower($controller[1]);
|
||||||
//仅当验证器存在时 进行校验
|
//仅当验证器存在时 进行校验
|
||||||
if (class_exists($validate) && $request->isPost()) {
|
if (class_exists($validate) && $request->isPost()) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate\admin;
|
namespace app\http\validate;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ class Category extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'add' => ['title'],
|
'adminadd' => ['title'],
|
||||||
'edit' => ['title'],
|
'adminedit' => ['title'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate\admin;
|
namespace app\http\validate;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ class Channel extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'add' => ['title'],
|
'adminadd' => ['title'],
|
||||||
'edit' => ['title'],
|
'adminedit' => ['title'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate\admin;
|
namespace app\http\validate;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -26,11 +26,11 @@ class Config extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'add' => ['title', 'name'],
|
'adminadd' => ['title', 'name'],
|
||||||
];
|
];
|
||||||
|
|
||||||
// edit 验证场景定义
|
// edit 验证场景定义
|
||||||
public function sceneEdit() {
|
public function sceneAdminedit() {
|
||||||
return $this->only([['title', 'name']])
|
return $this->only([['title', 'name']])
|
||||||
->remove('name', 'unique');
|
->remove('name', 'unique');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
namespace app\http\validate\admin;
|
namespace app\http\validate;
|
||||||
|
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ class Menu extends Validate{
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'add' => ['title'],
|
'adminadd' => ['title'],
|
||||||
'edit' => ['title'],
|
'adminedit' => ['title'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -10,28 +10,29 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
use think\facade\Route;
|
use think\facade\Route;
|
||||||
|
|
||||||
Route::rule('/', 'Front/index');
|
Route::rule('/', 'Front.Index/index');
|
||||||
Route::rule('search', 'Front/search');
|
Route::rule('search', 'Front.Content/search');
|
||||||
Route::rule('lists', 'Front/lists');
|
Route::rule('lists', 'Front.Content/lists');
|
||||||
Route::rule('detail-:id', 'Front/detail');
|
Route::rule('detail-:id', 'Front.Content/detail');
|
||||||
Route::rule('category', 'Front/category');
|
Route::rule('category', 'Front.Content/category');
|
||||||
Route::rule('topic-:id', 'Front/topic');
|
Route::rule('topic-:id', 'Front.Content/topic');
|
||||||
Route::rule('form/:id/:name', 'Front/form');
|
Route::rule('form/:id/:name', 'Front.Form/index');
|
||||||
Route::rule('front/:function', 'Front/:function');
|
Route::rule('front/:controller/:function', 'Front.:controller/:function');
|
||||||
Route::rule('upload/:function', 'Upload/:function');
|
|
||||||
|
|
||||||
Route::group('admin', function () {
|
Route::group('admin', function () {
|
||||||
Route::rule('/', 'admin.Index/index');
|
Route::rule('/', 'admin.Index/index');
|
||||||
Route::rule('login', 'admin.Index/login');
|
Route::rule('login', 'admin.Index/login');
|
||||||
Route::rule('logout', 'admin.Index/logout');
|
Route::rule('logout', 'admin.Index/logout');
|
||||||
|
Route::rule('upload/:function', 'Upload/:function');
|
||||||
Route::rule(':controller/:function', 'admin.:controller/:function');
|
Route::rule(':controller/:function', 'admin.:controller/:function');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group('user', function () {
|
Route::group('user', function () {
|
||||||
Route::rule('/', 'admin.Index/index');
|
Route::rule('/', 'user.Index/index');
|
||||||
Route::rule('login', 'user.Index/login');
|
Route::rule('login', 'user.Index/login');
|
||||||
Route::rule('logout', 'user.Index/logout');
|
Route::rule('logout', 'user.Index/logout');
|
||||||
Route::rule('register', 'user.Index/register');
|
Route::rule('register', 'user.Index/register');
|
||||||
|
Route::rule('upload/:function', 'Upload/:function');
|
||||||
Route::rule(':controller/:function', 'user.:controller/:function');
|
Route::rule(':controller/:function', 'user.:controller/:function');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user