diff --git a/app/common/taglib/Ape.php b/app/common/taglib/Ape.php index f59407b..08288ac 100644 --- a/app/common/taglib/Ape.php +++ b/app/common/taglib/Ape.php @@ -143,7 +143,7 @@ class Ape extends TagLib $display = $display == 1 ? 1 : 0; $parse = 'render();'; + $parse .= '$__LIST__ = $__FUN__["lists"];$pager = $__FUN__["model"]->render();'; $parse .= ' ?>'; $parse .= '{volist name="__LIST__" id="' . $void . '" key="i"}'; $parse .= $content; diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index d1b539a..0f94987 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -308,4 +308,41 @@ class Article extends Base } return $this->fetch(); } + + /** + * 用户首页 + * @return string + * @throws Exception + * @author 李玉坤 + * @date 2022-01-24 1:23 + */ + public function user() + { + $author = input('author'); + if (!trim($author)) { + $this->error('请输入搜索关键词'); + } + if (!mb_check_encoding($author, 'utf-8')) { + $kw = iconv('gbk', 'utf-8', $author); + } + $apeField['id'] = '0'; + $apeField['title'] = $author; + $apeField['meta_title'] = $author; + $apeField['keywords'] = web_config('keywords'); + $apeField['description'] = web_config('description'); + $apeField['position'] = '首页 > ' . $author . ''; + $this->assign('apeField', $apeField); + $this->assign('author', $author); + + //清除可能存在的栏目分类树id + cache(Data::CURR_CATEGORY_PATENT_ID, false); + //模板兼容性标签 + $this->assign('id', false); + $this->assign('cid', false); + $templateFile = config('view.view_path') . 'article/user.html'; + if (!is_file($templateFile)) { + $this->error('模板文件不存在!'); + } + return $this->fetch(); + } } \ No newline at end of file diff --git a/app/index/controller/Base.php b/app/index/controller/Base.php index 2bd7250..48d3574 100644 --- a/app/index/controller/Base.php +++ b/app/index/controller/Base.php @@ -49,6 +49,11 @@ class Base extends BaseController $pvLogModel = new PvLog(); $pvLogModel->set_view(); } + cache(Data::CURR_CATEGORY_PATENT_ID, false); + //模板兼容性标签 + $this->assign('id', false); + $this->assign('cid', false); + //获取根域名 //判断是否开启了伪静态 // if (web_config('web_rewrite')=='0') { diff --git a/app/index/controller/User.php b/app/index/controller/User.php index ae1bba2..c7b1232 100644 --- a/app/index/controller/User.php +++ b/app/index/controller/User.php @@ -7,7 +7,6 @@ namespace app\index\controller; use app\admin\extend\Util; -use app\common\constant\Data; use app\common\model\User as userModel; use Exception; use think\db\exception\DataNotFoundException; @@ -27,11 +26,6 @@ class User extends Base if (!web_config('is_register')){ $this->error('登录未启用,请联系管理员!'); } - //清除可能存在的栏目分类树id - cache(Data::CURR_CATEGORY_PATENT_ID, false); - //模板兼容性标签 - $this->assign('id', false); - $this->assign('cid', false); return $this->fetch(); } @@ -66,11 +60,6 @@ class User extends Base if (!web_config('is_register')){ $this->error('注册未启用,请联系管理员!'); } - //清除可能存在的栏目分类树id - cache(Data::CURR_CATEGORY_PATENT_ID, false); - //模板兼容性标签 - $this->assign('id', false); - $this->assign('cid', false); return $this->fetch(); } @@ -128,11 +117,6 @@ class User extends Base */ public function profile() { - //清除可能存在的栏目分类树id - cache(Data::CURR_CATEGORY_PATENT_ID, false); - //模板兼容性标签 - $this->assign('id', false); - $this->assign('cid', false); return $this->fetch(); } diff --git a/composer.json b/composer.json index f273d3d..1df0704 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "topthink/think-captcha": "^3.0", "phpmailer/phpmailer": "^6.5", "spatie/macroable": "^1.0", - "topthink/think-view": "^1.0" + "topthink/think-view": "^1.0", + "ext-iconv": "*" }, "require-dev": { "symfony/var-dumper": "^4.2" diff --git a/public/template/default/pc/article/article.html b/public/template/default/pc/article/article.html index bf85eb1..1e66900 100644 --- a/public/template/default/pc/article/article.html +++ b/public/template/default/pc/article/article.html @@ -40,7 +40,7 @@
{$apeField['author']} + href="{:url('article/user')}?author={$apeField['author']}">{$apeField['author']}