diff --git a/.gitignore b/.gitignore index 9fb83666..5ecd681f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ laravel/.env -vuepress/docs/.vuepress/dist/* +vuepress/docs/ +vuepress/docs/.vuepress/ +vuepress/docs/.vuepress/dist/ vuepress/node_modules/ +vuepress/build.log \ No newline at end of file diff --git a/laravel/app/Http/Controllers/Api/ArticleController.php b/laravel/app/Http/Controllers/Api/ArticleController.php index 640e9596..178a6454 100755 --- a/laravel/app/Http/Controllers/Api/ArticleController.php +++ b/laravel/app/Http/Controllers/Api/ArticleController.php @@ -39,7 +39,9 @@ class ArticleController $this->sKey = $aArg["key"] ?? ''; $this->aConfig = $aArg["config"] ?? ''; - if ($this->sCmd == "new") { + if ($this->sCmd == "del") { + $this->cmd_del(); + } else if ($this->sCmd == "new") { $this->cmd_new(); } else { $sMsg = "未找到cmd的对应处理:".$this->sCmd; @@ -65,6 +67,31 @@ class ArticleController } + private function cmd_del() + { + $aCategory = $this->aConfig["category"] ?? ["⚠️ 未得到category"]; + + foreach ($aCategory as $sCategoryRow) { + $sFileDir = "../../vuepress/docs/{$sCategoryRow}/"; + $sFileName = $this->sArticleCode.".md"; + $sFilePath = $sFileDir.$sFileName; + + if (is_file($sFilePath) && file_exists($sFilePath)) { + if (unlink($sFilePath)) { + $this->aNewPath[] = $this->sArticleCode."删除成功"; + } else { + $sMsg = '删除失败(可能是权限或被占用)'; + throw new \Exception($sMsg); + } + } else { + $sMsg = '文件不存在或不是普通文件'; + throw new \Exception($sMsg); + } + + } + + } + private function _npmBuild() { $sVuePathNode = $_ENV['vue_path_node']; diff --git a/vuepress/docs/markdown.md b/vuepress/docs/markdown.md index 81f7adbd..e43cdc8f 100644 --- a/vuepress/docs/markdown.md +++ b/vuepress/docs/markdown.md @@ -3,7 +3,7 @@ title: Markdown tags: - markdown createTime: 2025/10/19 17:47:57 -permalink: /blog/9mgaypxo/ +permalink: /jccp/markdown/ --- ## 标题H2