diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index c754c8c..28bf73a 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -105,7 +105,7 @@ class Article extends BaseController $article = Cache::get('article_'.$id); if(!$article){ //查询文章 - $article = ArticleModel::field('id,title,content,status,cate_id,user_id,is_top,is_hot,is_reply,pv,jie,tags,create_time')->where('status',1)->with([ + $article = ArticleModel::field('id,title,content,status,cate_id,user_id,is_top,is_hot,is_reply,pv,jie,tags,title_color,create_time')->where('status',1)->with([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename'); }, @@ -183,7 +183,8 @@ class Article extends BaseController public function add() { if(Request::isAjax()){ - $data = Request::only(['cate_id','title','user_id','content','upzip','tags','captcha']); + $data = Request::only(['cate_id','title','title_color','user_id','content','upzip','tags','captcha']); + halt($data); $validate = new \app\common\validate\Article; //调用验证器 $result = $validate->scene('Artadd')->check($data); //进行数据验证 if(true !==$result){ @@ -223,7 +224,7 @@ class Article extends BaseController $article = Db::name('article')->find($id); if(Request::isAjax()){ - $data = Request::only(['id','cate_id','title','user_id','content','upzip','tags','captcha']); + $data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','tags','captcha']); $validate = new \app\common\validate\Article(); //调用验证器 $res = $validate->scene('Artadd')->check($data); //进行数据验证 diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 338b42c..66ef248 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -26,7 +26,7 @@ class Index extends BaseController //置顶文章 $artTop = Cache::get('arttop'); if(!$artTop){ - $artTop = Article::field('id,title,cate_id,user_id,create_time,is_top')->where(['is_top'=>1,'status'=>1,'delete_time'=>0])->with([ + $artTop = Article::field('id,title,title_color,cate_id,user_id,create_time,is_top')->where(['is_top'=>1,'status'=>1,'delete_time'=>0])->with([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename'); }, diff --git a/view/index/article/add.html b/view/index/article/add.html index 1498263..e98eb87 100644 --- a/view/index/article/add.html +++ b/view/index/article/add.html @@ -25,13 +25,17 @@ -