更新目录结构
This commit is contained in:
32
app/http/validate/admin/Ad.php
Normal file
32
app/http/validate/admin/Ad.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Ad extends Validate{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'name' => 'require|unique:AdPlace',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '广告位标题必须',
|
||||
'name.require' => '广告位标识必须',
|
||||
'name.unique' => '广告位标识已存在',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'name'],
|
||||
'edit' => ['title', 'name'],
|
||||
];
|
||||
}
|
||||
31
app/http/validate/admin/Category.php
Normal file
31
app/http/validate/admin/Category.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Category extends Validate{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'model_id' => 'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '栏目名称必须',
|
||||
'model_id.require' => '绑定模型必须',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'model_id'],
|
||||
'edit' => ['title', 'model_id'],
|
||||
];
|
||||
}
|
||||
29
app/http/validate/admin/Channel.php
Normal file
29
app/http/validate/admin/Channel.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Channel extends Validate{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '导航名称必须',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['title'],
|
||||
];
|
||||
}
|
||||
38
app/http/validate/admin/Config.php
Normal file
38
app/http/validate/admin/Config.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Config extends Validate{
|
||||
protected $rule = [
|
||||
'name' => 'require|unique:config|alphaDash',
|
||||
'title' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '配置标识必须',
|
||||
'name.unique' => '配置标识已存在',
|
||||
'name.alphaDash' => '配置标识格式错误',
|
||||
'title.require' => '配置标题必须',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'name'],
|
||||
];
|
||||
|
||||
// edit 验证场景定义
|
||||
public function sceneEdit() {
|
||||
return $this->only([['title', 'name']])
|
||||
->remove('name', 'unique');
|
||||
}
|
||||
}
|
||||
59
app/http/validate/admin/Content.php
Normal file
59
app/http/validate/admin/Content.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
use think\facade\Request;
|
||||
use app\model\Attribute;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Content extends Validate{
|
||||
protected $rule = [];
|
||||
|
||||
protected $message = [];
|
||||
|
||||
protected $scene = [];
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$param = Request::param();
|
||||
$map = [];
|
||||
|
||||
$map[] = ['model_id', '=', $param['model_id']];
|
||||
if ($param['function'] == 'add') {
|
||||
$map[] = ['is_show', 'IN', [1, 2]];
|
||||
}else if ($param['function'] == 'edit') {
|
||||
$map[] = ['is_show', 'IN', [1, 3]];
|
||||
}
|
||||
|
||||
$attr = Attribute::where($map)->select();
|
||||
$rule = [];
|
||||
$message = [];
|
||||
$field = [];
|
||||
foreach ($attr as $value) {
|
||||
if ($value['is_must']) {
|
||||
$rule[$value['name']] = 'require';
|
||||
$message[$value['name'].'.require'] = $value['title'] . '不能为空!';
|
||||
$field[] = $value['name'];
|
||||
}
|
||||
}
|
||||
$this->rule = $rule;
|
||||
|
||||
$this->message = $message;
|
||||
|
||||
$this->scene = [
|
||||
'add' => $field,
|
||||
'edit' => $field,
|
||||
'useradd' => $field,
|
||||
'useredit' => $field,
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/http/validate/admin/Link.php
Normal file
32
app/http/validate/admin/Link.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Link extends Validate{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'url' => 'require|url'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '连接标题必须',
|
||||
'url.require' => '连接地址必须',
|
||||
'url.url' => '连接格式错误',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'url'],
|
||||
'edit' => ['title', 'url'],
|
||||
];
|
||||
}
|
||||
29
app/http/validate/admin/Menu.php
Normal file
29
app/http/validate/admin/Menu.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Menu extends Validate{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '菜单名称必须',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['title'],
|
||||
];
|
||||
}
|
||||
33
app/http/validate/admin/Model.php
Normal file
33
app/http/validate/admin/Model.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Model extends Validate{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'name' => 'require|unique:Model|alpha',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '模型名称必须',
|
||||
'name.require' => '模型标识必须',
|
||||
'name.unique' => '模型标识已存在',
|
||||
'name.alpha' => '模型标识必须为字母',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'name'],
|
||||
'edit' => ['title'],
|
||||
];
|
||||
}
|
||||
57
app/http/validate/admin/User.php
Normal file
57
app/http/validate/admin/User.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\http\validate\admin;
|
||||
|
||||
use think\Validate;
|
||||
use app\model\Member;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class User extends Validate{
|
||||
protected $rule = [
|
||||
'uid' => 'require',
|
||||
'oldpassword' => 'require|checkOldpaswd',
|
||||
'username' => 'require|unique:member|alphaDash',
|
||||
'email' => 'email|unique:member',
|
||||
'password' => 'require|min:8',
|
||||
'repassword' =>'require|confirm:password'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'uid.require' => '用户UID必须',
|
||||
'oldpassword.require' => '旧密码必须',
|
||||
'oldpassword.checkOldpaswd' => '旧密码错误',
|
||||
'username.require' => '用户名称必须',
|
||||
'username.unique' => '该用户名已存在',
|
||||
'username.alphaDash' => '用户名只能使用字母、数字、_、-',
|
||||
'password.min' => '密码不能小于8位',
|
||||
'repassword.require' => '确认密码不能为空',
|
||||
'repassword.confirm' => '确认密码和密码必须相同',
|
||||
'email.email' => '邮箱格式错误',
|
||||
'email.unique' => '邮箱已存在',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['username', 'email', 'password', 'repassword'],
|
||||
'edit' => ['username', 'email'],
|
||||
'editpwd' => ['uid', 'password', 'repassword', 'oldpassword']
|
||||
];
|
||||
|
||||
protected function checkOldpaswd($value, $rule, $data){
|
||||
if(!$data['uid']){
|
||||
return false;
|
||||
}
|
||||
$user = Member::find($data['uid']);
|
||||
if (md5($value . $user['salt']) === $user['password']) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user