后台内容模块功能完善

This commit is contained in:
2020-03-31 16:17:45 +08:00
parent de73484cca
commit 85d33da0d4
24 changed files with 386 additions and 251 deletions

32
app/http/validate/Ad.php Normal file
View 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'],
];
}

View 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,
];
}
}

View 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'],
];
}