后台内容模块功能完善
This commit is contained in:
32
app/http/validate/Ad.php
Normal file
32
app/http/validate/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;
|
||||
|
||||
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 = [
|
||||
'adminadd' => ['title', 'name'],
|
||||
'adminedit' => ['title', 'name'],
|
||||
];
|
||||
}
|
||||
47
app/http/validate/Content.php
Normal file
47
app/http/validate/Content.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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;
|
||||
|
||||
use think\Validate;
|
||||
use think\facade\Request;
|
||||
use app\model\Attribute;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Content extends Validate{
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$param = Request::param();
|
||||
$map = [];
|
||||
|
||||
$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 = [
|
||||
'adminadd' => $field,
|
||||
'adminedit' => $field,
|
||||
'useradd' => $field,
|
||||
'useredit' => $field,
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/http/validate/Link.php
Normal file
32
app/http/validate/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;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 菜单验证
|
||||
*/
|
||||
class Link extends Validate{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'url' => 'require|url'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '连接标题必须',
|
||||
'url.require' => '连接地址必须',
|
||||
'url.url' => '连接格式错误',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminadd' => ['title', 'url'],
|
||||
'adminedit' => ['title', 'url'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user