chore: 重写初始提交(清空历史,整理后全量提交)

This commit is contained in:
ywxapp
2026-08-16 16:54:14 +08:00
commit 6c1a106bc1
1808 changed files with 238144 additions and 0 deletions
@@ -0,0 +1,50 @@
<?php
/*
* @Author: YwxApp <ywx@ywxapp.cn>
* @Date: 2026-08-10 15:30:57
* @LastEditors: YwxApp <ywx@ywxapp.cn>
* @LastEditTime: 2026-08-13 17:38:27
* @Description:
* @FilePath: \ywxapp_dev\addon\articles\controller\ArticlesFrontend.php
* @CustomString: Copyright (c) 2026 YwxApp
*/
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | 文章CMS前台基类:统一注入侧边栏/分类/标签等共享数据
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\articles\controller;
use ywxapp\controller\FrontendBase;
use addon\articles\model\Article;
use addon\articles\model\ArticleCategory;
use addon\articles\model\ArticleTag;
use addon\articles\library\ArticleSchema;
class ArticlesFrontend extends FrontendBase
{
protected $noNeedLogin = ['*'];
protected $noNeedVerify = ['*'];
protected function initialize()
{
parent::initialize();
// articles 前台页面自带完整 <!DOCTYPE html> 结构,清空 layout_name
// 避免被 common/layout 包裹导致双层 <html>、标签外露、排版错乱。
//$this->view->config(['layout_name' => '']);
ArticleSchema::ensure();
$isLogin = $this->auth && $this->auth->isLogin;
$loginUser = $isLogin ? $this->auth->info : null;
$this->view->assign([
'categories' => ArticleCategory::allEnable(),
'tags' => ArticleTag::where('delete_at', 0)->order('id', 'desc')->limit(20)->select(),
'hot' => Article::hot(10),
'is_login' => $isLogin,
'member' => $loginUser,
'nav_active' => '',
]);
}
}