修复bug,设置router

This commit is contained in:
2020-03-28 12:18:58 +08:00
parent 671f66a0f0
commit c7a28d9530
8 changed files with 26 additions and 25 deletions

View File

@@ -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()) {

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
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'],
];
}

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
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'],
];
}

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
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');
}

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
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'],
];
}