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
+56
View File
@@ -0,0 +1,56 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\docs\controller;
use addon\docs\model\DocsDoc;
use addon\docs\model\DocsProject;
use addon\docs\model\DocsVersion;
/**
* 文档中心首页:项目卡片墙
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Index extends DocsFrontend
{
/**
* 首页
*/
public function index()
{
$projects = DocsProject::enabledList()->toArray();
foreach ($projects as &$project) {
$projectId = (int) $project['id'];
$project['doc_count'] = DocsDoc::where('project_id', $projectId)
->where('status', 1)->where('is_dir', 0)->count();
$version = DocsVersion::resolve($projectId, (string) ($project['default_version'] ?? ''));
$project['version_name'] = $version ? $version->name : '';
// 取该项目最近更新的几篇,作为卡片上的快捷入口
$project['recent'] = DocsDoc::field('id,name,title,update_at')
->where('project_id', $projectId)
->where('status', 1)
->where('is_dir', 0)
->order('update_at', 'desc')
->limit(4)
->select()
->toArray();
}
unset($project);
$this->assign('projects', $projects);
$this->assign('totalDocs', DocsDoc::where('status', 1)->where('is_dir', 0)->count());
return $this->fetch('index/index');
}
}