更新目录结构
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\middleware;
|
||||
|
||||
use app\model\MemberLog;
|
||||
use app\model\auth\MemberLog;
|
||||
use think\facade\Session;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,15 +21,11 @@ class Validate {
|
||||
//获取当前参数
|
||||
$params = $request->param();
|
||||
//获取访问控制器
|
||||
if(\strripos($request->controller(), ".")){
|
||||
$controller = explode(".", $request->controller());
|
||||
}else{
|
||||
$controller = ['', ucfirst($request->controller())];
|
||||
}
|
||||
$controller = strtr($request->controller(), '.', '\\');
|
||||
|
||||
//获取操作名,用于验证场景scene
|
||||
$scene = strtolower($controller[0]) . $request->action();
|
||||
$validate = "app\\http\\validate\\" . ucfirst($controller[1]);
|
||||
$scene = $request->action();
|
||||
$validate = "\\app\\http\\validate\\" . $controller;
|
||||
//仅当验证器存在时 进行校验
|
||||
if (class_exists($validate) && $request->isPost()) {
|
||||
$v = new $validate;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
@@ -26,7 +26,7 @@ class Ad extends Validate{
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['title', 'name'],
|
||||
'adminedit' => ['title', 'name'],
|
||||
'add' => ['title', 'name'],
|
||||
'edit' => ['title', 'name'],
|
||||
];
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
@@ -25,7 +25,7 @@ class Category extends Validate{
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['title', 'model_id'],
|
||||
'adminedit' => ['title', 'model_id'],
|
||||
'add' => ['title', 'model_id'],
|
||||
'edit' => ['title', 'model_id'],
|
||||
];
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
@@ -23,7 +23,7 @@ class Channel extends Validate{
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['title'],
|
||||
'adminedit' => ['title'],
|
||||
'add' => ['title'],
|
||||
'edit' => ['title'],
|
||||
];
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
@@ -15,22 +15,23 @@ use think\Validate;
|
||||
*/
|
||||
class Config extends Validate{
|
||||
protected $rule = [
|
||||
'name' => 'require|unique:config',
|
||||
'name' => 'require|unique:config|alphaDash',
|
||||
'title' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '配置标识必须',
|
||||
'name.unique' => '配置标识已存在',
|
||||
'name.alphaDash' => '配置标识格式错误',
|
||||
'title.require' => '配置标题必须',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['title', 'name'],
|
||||
'add' => ['title', 'name'],
|
||||
];
|
||||
|
||||
// edit 验证场景定义
|
||||
public function sceneAdminedit() {
|
||||
public function sceneEdit() {
|
||||
return $this->only([['title', 'name']])
|
||||
->remove('name', 'unique');
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
use think\facade\Request;
|
||||
@@ -50,8 +50,8 @@ class Content extends Validate{
|
||||
$this->message = $message;
|
||||
|
||||
$this->scene = [
|
||||
'adminadd' => $field,
|
||||
'adminedit' => $field,
|
||||
'add' => $field,
|
||||
'edit' => $field,
|
||||
'useradd' => $field,
|
||||
'useredit' => $field,
|
||||
];
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
@@ -26,7 +26,7 @@ class Link extends Validate{
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['title', 'url'],
|
||||
'adminedit' => ['title', 'url'],
|
||||
'add' => ['title', 'url'],
|
||||
'edit' => ['title', 'url'],
|
||||
];
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
@@ -23,7 +23,7 @@ class Menu extends Validate{
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['title'],
|
||||
'adminedit' => ['title'],
|
||||
'add' => ['title'],
|
||||
'edit' => ['title'],
|
||||
];
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
@@ -27,7 +27,7 @@ class Model extends Validate{
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['title', 'name'],
|
||||
'adminedit' => ['title'],
|
||||
'add' => ['title', 'name'],
|
||||
'edit' => ['title'],
|
||||
];
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
use app\model\Member;
|
||||
@@ -39,9 +39,9 @@ class User extends Validate{
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['username', 'email', 'password', 'repassword'],
|
||||
'adminedit' => ['username', 'email'],
|
||||
'admineditpwd' => ['uid', 'password', 'repassword', 'oldpassword']
|
||||
'add' => ['username', 'email', 'password', 'repassword'],
|
||||
'edit' => ['username', 'email'],
|
||||
'editpwd' => ['uid', 'password', 'repassword', 'oldpassword']
|
||||
];
|
||||
|
||||
protected function checkOldpaswd($value, $rule, $data){
|
||||
@@ -6,7 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate;
|
||||
namespace app\http\validate\api;
|
||||
|
||||
use think\Validate;
|
||||
use app\model\Member;
|
||||
@@ -28,6 +28,6 @@ class Login extends Validate{
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'apiindex' => ['username', 'password'],
|
||||
'index' => ['username', 'password'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user