|
@@ -18,6 +18,9 @@ use app\common\model\Category as CategoryModel;
|
|
use app\common\model\Article as ArticleModel;
|
|
use app\common\model\Article as ArticleModel;
|
|
use app\common\model\ArticleTags as ArticleTagsModel;
|
|
use app\common\model\ArticleTags as ArticleTagsModel;
|
|
use app\common\model\ArticleDolikeLog;
|
|
use app\common\model\ArticleDolikeLog;
|
|
|
|
+use app\common\model\Tag;
|
|
|
|
+use app\common\model\TagArticle;
|
|
|
|
+use app\common\utils\ParsedownUtils;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 文章管理
|
|
* 文章管理
|
|
@@ -77,7 +80,7 @@ class Article extends Base
|
|
$prev_next = ArticleModel::getNextPrev($id, $data->cid);
|
|
$prev_next = ArticleModel::getNextPrev($id, $data->cid);
|
|
|
|
|
|
if ($data->content_type == 1) {
|
|
if ($data->content_type == 1) {
|
|
- $parsedownExtension = new \ParsedownExtension();
|
|
|
|
|
|
+ $parsedownExtension = new ParsedownUtils();
|
|
// $parsedownExtension->setTocEnabled(true);
|
|
// $parsedownExtension->setTocEnabled(true);
|
|
$res = $parsedownExtension->text($data->content);
|
|
$res = $parsedownExtension->text($data->content);
|
|
// $data->toc = $res['toc'];
|
|
// $data->toc = $res['toc'];
|
|
@@ -131,39 +134,26 @@ class Article extends Base
|
|
/**
|
|
/**
|
|
* 标签列表
|
|
* 标签列表
|
|
*/
|
|
*/
|
|
- public function tags($name = null)
|
|
|
|
|
|
+ public function tag($name = null)
|
|
{
|
|
{
|
|
if (!$name) {
|
|
if (!$name) {
|
|
throw new HttpException(404, '标签不可为空');
|
|
throw new HttpException(404, '标签不可为空');
|
|
}
|
|
}
|
|
|
|
|
|
- $list = ArticleTagsModel::tagsList($name);
|
|
|
|
-
|
|
|
|
- View::assign([
|
|
|
|
- 'list' => $list,
|
|
|
|
- 'tag' => $name
|
|
|
|
- ]);
|
|
|
|
-
|
|
|
|
- return View::fetch();
|
|
|
|
- }
|
|
|
|
|
|
+ $tag = Tag::where('tagname', $name)->find();
|
|
|
|
|
|
- /**
|
|
|
|
- * 标签列表
|
|
|
|
- */
|
|
|
|
- public function tag($name = null)
|
|
|
|
- {
|
|
|
|
- if (!$name) {
|
|
|
|
- throw new HttpException(404, '标签不可为空');
|
|
|
|
|
|
+ if (!$tag) {
|
|
|
|
+ throw new HttpException(404, '标签不存在');
|
|
}
|
|
}
|
|
|
|
|
|
- // $list = ArticleTagsModel::tagsList($name);
|
|
|
|
|
|
+ $list = TagArticle::queryList($tag->tagid);
|
|
|
|
|
|
View::assign([
|
|
View::assign([
|
|
- 'list' => [],
|
|
|
|
|
|
+ 'list' => $list,
|
|
'tag' => $name
|
|
'tag' => $name
|
|
]);
|
|
]);
|
|
|
|
|
|
- return View::fetch('tags');
|
|
|
|
|
|
+ return View::fetch();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|