You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB
PHTML

2 years ago
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
namespace Admin\Logic;
/**
* 文档模型子模型 - 文章模型
*/
class ArticleLogic extends BaseLogic{
/* 自动验证规则 */
protected $_validate = array(
array('content', 'getContent', '内容不能为空!', self::MUST_VALIDATE , 'callback', self::MODEL_BOTH),
);
/**
* 获取文章的详细内容
* @return boolean
* @author huajie <banhuajie@163.com>
*/
protected function getContent(){
$type = I('post.type');
$content = I('post.content');
if($type > 1){//主题和段落必须有内容
if(empty($content)){
return false;
}
}else{ //目录没内容则生成空字符串
if(empty($content)){
$_POST['content'] = ' ';
}
}
return true;
}
}