diff --git a/app/common/taglib/Ape.php b/app/common/taglib/Ape.php index 6afad3d..196b973 100644 --- a/app/common/taglib/Ape.php +++ b/app/common/taglib/Ape.php @@ -132,7 +132,7 @@ class Ape extends TagLib */ public function tagList($tag, $content) { - $orderBy = isset($tag['orderBy']) ? $tag['orderBy'] : 'sort asc,create_time desc'; + $orderBy = isset($tag['orderBy']) ? $tag['orderBy'] : 'sort desc,create_time desc'; $pageSize = isset($tag['pageSize']) ? $tag['pageSize'] : 15; $type = isset($tag['type']) ? $tag['type'] : 'find'; $typeId = isset($tag['typeId']) ? $tag['typeId'] : '$cid'; diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 5d5fe05..a62f007 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -40,7 +40,6 @@ class Article extends Base $id = input('id/d'); //栏目分类标识 $name = input('name'); - if ($id) { //获取分类信息 $dc = get_document_category($id); @@ -55,8 +54,7 @@ class Article extends Base $id = $dc['id']; $documentCategoryModel = new DocumentCategory(); //栏目存在 增加访问量 - $documentCategoryModel->where('id', $id)->inc('view')->update(); - + $documentCategoryModel->where('id|alias', $id)->inc('view')->update(); //判断后台统计配置是否开启 1 开启 if (web_config("web_statistics") == 1) { //统计url @@ -120,7 +118,11 @@ class Article extends Base } //获取该文章 $documentModel = new Document(); - $article = $documentModel->where('status', 1)->where('id|alias', $id)->find(); + if (is_int($id)){ + $article = $documentModel->where('status', 1)->where('id', $id)->find(); + }else{ + $article = $documentModel->where('status', 1)->where('alias', $id)->find(); + } if (!$article) { $this->error('文章不存在或已删除!'); } @@ -133,7 +135,7 @@ class Article extends Base //获取该文章内容 //根据文章类型,加载不同的内容。 $articleType = $article['type'] ? $article['type'] : 'article'; - $articleExt = $documentModel::name('document_' . $articleType)->where('id', $id)->find(); + $articleExt = $documentModel::name('document_' . $articleType)->where('id', $article['id'])->find(); if (!$articleExt) { $this->error('文章不存在或已删除!'); } diff --git a/public/install/ape_blog.sql b/public/install/ape_blog.sql index d244e4f..aca0542 100644 --- a/public/install/ape_blog.sql +++ b/public/install/ape_blog.sql @@ -335,7 +335,7 @@ DROP TABLE IF EXISTS `ape_document_category`; CREATE TABLE `ape_document_category` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标题', - `en_title` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标志', + `alias` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标志', `icon` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类图标', `type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '分类类别:0列表,1单篇,2链接', `pid` int(10) NOT NULL DEFAULT 0 COMMENT '上级分类ID', diff --git a/public/template/default/pc/index/index.html b/public/template/default/pc/index/index.html index e29a172..ed8b712 100644 --- a/public/template/default/pc/index/index.html +++ b/public/template/default/pc/index/index.html @@ -76,26 +76,26 @@
最新文章
- + + + + + + + + + + + + + + + + + + + +