From 9e2c371d77940dd23cb03c589d7f07a56504b755 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Mon, 14 Apr 2025 21:07:29 +0800 Subject: [PATCH] no message --- app/Services/TG/Hook/Mod/Article.php | 29 ++++++++++++++++++++++++++++ app/Services/TG/Hook/Mod/Cmd.php | 4 ++-- app/Services/TG/Hook/Mod/Git.php | 29 ---------------------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/app/Services/TG/Hook/Mod/Article.php b/app/Services/TG/Hook/Mod/Article.php index 57c500c..cb23556 100644 --- a/app/Services/TG/Hook/Mod/Article.php +++ b/app/Services/TG/Hook/Mod/Article.php @@ -36,6 +36,35 @@ class Article extends Base { } + public function Clone($aParam) + { + $iId = $aParam['aArg'][1]; + + // 查找文章 + $aArticle = ModelArticle::find($iId); + + if ($aArticle) { + // 复制文章 + $newArticle = $aArticle->replicate(); + + // 如果需要,可以修改新文章的某些字段,例如标题或状态 +// $newArticle->title = $newArticle->title . ' - Copy'; // 修改标题 + // $newArticle->status = 'draft'; // 例如,将状态设置为草稿 + + // 保存新文章 + $newArticle->save(); + + // 发送新文章的 ID 到 Telegram + $sMsg = "新文章已创建,ID: " . $newArticle->id; + $this->oTGHttp->sendToTG($sMsg); + + // 返回 HTTP 响应 + $this->oHttp::response(200, 'ok'); + } else { + throw new \Exception("没有这个id"); + } + } + public function Add($aParams) { diff --git a/app/Services/TG/Hook/Mod/Cmd.php b/app/Services/TG/Hook/Mod/Cmd.php index d441f1f..94598bc 100644 --- a/app/Services/TG/Hook/Mod/Cmd.php +++ b/app/Services/TG/Hook/Mod/Cmd.php @@ -18,8 +18,8 @@ class Cmd extends Base { '文章del' => 'Article#Del__id', '文章set' => 'Article#Set__id__fild set', // '添加github的sshhost' => "System#AddSshHostGithub", - '文章clone - 没有' => "article#clone id", - '手动pullR - 没有' => "article#clone id", + '文章clone' => "article#clone id", + '手动pullR' => "article#clone id", ]; $this->oTGHttp->sendToTG(json_encode($aCmdList, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); diff --git a/app/Services/TG/Hook/Mod/Git.php b/app/Services/TG/Hook/Mod/Git.php index 8452ad4..ea3ae1b 100644 --- a/app/Services/TG/Hook/Mod/Git.php +++ b/app/Services/TG/Hook/Mod/Git.php @@ -37,35 +37,6 @@ class Git extends Base { } - public function Clone($aParam) - { - $iId = $aParam['aArg'][1]; - - // 查找文章 - $aArticle = ModelArticle::find($iId); - - if ($aArticle) { - // 复制文章 - $newArticle = $aArticle->replicate(); - - // 如果需要,可以修改新文章的某些字段,例如标题或状态 -// $newArticle->title = $newArticle->title . ' - Copy'; // 修改标题 - // $newArticle->status = 'draft'; // 例如,将状态设置为草稿 - - // 保存新文章 - $newArticle->save(); - - // 发送新文章的 ID 到 Telegram - $sMsg = "新文章已创建,ID: " . $newArticle->id; - $this->oTGHttp->sendToTG($sMsg); - - // 返回 HTTP 响应 - $this->oHttp::response(200, 'ok'); - } else { - throw new \Exception("没有这个id"); - } - } - // /Git#PullR 3 public function PullR($aParam) {