diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 13e0e2e5..46393073 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -99,6 +99,21 @@ class Article extends Common $share_config = $this->getSysConfig($this->lang_id, ['article_share']); View::assign('share_config', $share_config['article_share']); + // 获取文章评论数据 + $comments = ArticleLeaveMessageModel::field([ + 'id', + 'name', + 'email', + 'content', + 'created_at' + ]) + ->article($id) + ->audited(true) + ->order(['id' => 'desc']) + ->limit(5) + ->select(); + View::assign('comments', $comments); + // 获取倒序或发布时间倒序3篇文章做为推荐文章 $recommends = ArticleModel::field([ 'id', diff --git a/app/index/model/ArticleLeaveMessageModel.php b/app/index/model/ArticleLeaveMessageModel.php index 77e40652..793f1c95 100644 --- a/app/index/model/ArticleLeaveMessageModel.php +++ b/app/index/model/ArticleLeaveMessageModel.php @@ -16,4 +16,16 @@ class ArticleLeaveMessageModel extends ArticleLeaveMessageBaseModel use SoftDelete; // 软删除字段 protected $deleteTime = 'deleted_at'; + + // 文章文章范围查询 + public function scopeArticle($query, $article_id) + { + $query->where('article_id', '=', $article_id); + } + + // 审核状态范围查询 + public function scopeAudited($query, bool $is_audited = true) + { + $query->where('is_audited', '=', (int)$is_audited); + } } diff --git a/app/index/view/pc/article/detail.html b/app/index/view/pc/article/detail.html index 7001c60c..abc0b324 100644 --- a/app/index/view/pc/article/detail.html +++ b/app/index/view/pc/article/detail.html @@ -3,170 +3,161 @@ {notempty name="detail.seo_title"}
{$detail.release_time}
-12sdfksdljfksdljdksf是看大家分厘卡聖誕節分厘卡聖誕節付款了
-12sdfksdljfksdljdksf是看大家分厘卡聖誕節分厘卡聖誕節付款了
-12sdfksdljfksdljdksf是看大家分厘卡聖誕節分厘卡聖誕節付款了
-{:lang_i18n('你可能还喜欢')}
-![]()
{$vo.title}
- -{$detail.release_time}
+{$cm.content}
+{:lang_i18n('你可能还喜欢')}
+![]()
{$vo.title}
+ +