1、后台的一些bug修复
2、内核更新 3、后台的扩展模型做了一点更新一点,还不够完善
This commit is contained in:
38
application/common/validate/Attribute.php
Normal file
38
application/common/validate/Attribute.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\common\validate;
|
||||
|
||||
/**
|
||||
* 设置模型
|
||||
*/
|
||||
class Attribute extends Base{
|
||||
|
||||
protected $rule = array(
|
||||
'name' => 'require|/^[a-zA-Z]\w{0,39}$/',
|
||||
'title' => 'require',
|
||||
'type' => 'require',
|
||||
'length' => 'requireIn:type,textarea,editor|integer',
|
||||
'remark' => 'require',
|
||||
);
|
||||
|
||||
protected $message = array(
|
||||
'length.requireIn' => '字段长度必须!',
|
||||
'length.integer' => '字段必须为整形',
|
||||
'name.require' => '字段名不能为空!',
|
||||
'title.require' => '字段标题不能为空!',
|
||||
'type.require' => '类型不能为空!',
|
||||
'remark.require' => '描述不能为空!',
|
||||
);
|
||||
|
||||
protected $scene = array(
|
||||
'add' => 'name,title,type,remark,length',
|
||||
'edit' => 'name,title,type,remark,length'
|
||||
);
|
||||
}
|
||||
32
application/common/validate/Base.php
Normal file
32
application/common/validate/Base.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\common\validate;
|
||||
|
||||
/**
|
||||
* 设置模型
|
||||
*/
|
||||
class Base extends \think\Validate{
|
||||
|
||||
|
||||
protected function requireIn($value, $rule, $data){
|
||||
if (is_string($rule)) {
|
||||
$rule = explode(',', $rule);
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
$field = array_shift($rule);
|
||||
$val = $this->getDataValue($data, $field);
|
||||
if (!in_array($val, $rule) && $value == '') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace app\common\validate;
|
||||
/**
|
||||
* 设置模型
|
||||
*/
|
||||
class Config extends \think\Validate{
|
||||
class Config extends Base{
|
||||
|
||||
protected $rule = array(
|
||||
'name' => 'require|unique',
|
||||
|
||||
29
application/common/validate/Document.php
Normal file
29
application/common/validate/Document.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\common\validate;
|
||||
|
||||
/**
|
||||
* 设置模型
|
||||
*/
|
||||
class Document extends Base{
|
||||
|
||||
protected $rule = array(
|
||||
'title' => 'require',
|
||||
);
|
||||
|
||||
protected $message = array(
|
||||
'title.require' => '字段标题不能为空!',
|
||||
);
|
||||
|
||||
protected $scene = array(
|
||||
'add' => 'title',
|
||||
'edit' => 'title'
|
||||
);
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace app\common\validate;
|
||||
/**
|
||||
* 设置模型
|
||||
*/
|
||||
class Member extends \think\Validate{
|
||||
class Member extends Base{
|
||||
|
||||
protected $rule = array(
|
||||
'username' => 'require|unique:member|/^[a-zA-Z]\w{0,39}$/',
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace app\common\validate;
|
||||
/**
|
||||
* 设置模型
|
||||
*/
|
||||
class Model extends \think\Validate{
|
||||
class Model extends Base{
|
||||
|
||||
protected $rule = array(
|
||||
'name' => 'require|unique:model|/^[a-zA-Z]\w{0,39}$/',
|
||||
|
||||
Reference in New Issue
Block a user