diff --git a/app/Services/Tg/Hook/Mod/Arma.php b/app/Services/Tg/Hook/Mod/Arma.php index b4ccfe90..6c1784e6 100755 --- a/app/Services/Tg/Hook/Mod/Arma.php +++ b/app/Services/Tg/Hook/Mod/Arma.php @@ -166,6 +166,39 @@ class Arma extends Base { return $sMsg; } + public function del_self_xiuren($aParam) + { + $iId = $aParam["aArg"][1] ?? false; + + if (!$iId) { + return "没有id"; + } + + if ($iId == "?") { + return "#del [id]"; + } + + $oArticleSchema = ModelArticleSchema::where("id", $iId)->first(); + + $aSchema = json_decode($oArticleSchema->schema, true); + + $i = 0; + foreach ($aSchema["data"] as $aSchemaDataRow) { + if ($aSchemaDataRow["type"] == "photo") { + foreach ($aSchemaDataRow["photo"] as $aSchemaDataRowPhoto) { + $sImgA = $this->imgPathByUrl($aSchemaDataRowPhoto["file_path"]); + $i += $this->imgDelByPath($sImgA); + } + } + } + + $oArticleSchema->delete(); + + $sMsg = "ok,同时删除了{$i}张图片。"; + + return $sMsg; + } + private function imgPathByUrl($sImgUrl) { list(, $sImgPath) = explode("upload", $sImgUrl, 2);