diff --git a/app/Services/Tg/Hook/Mod/ArticleCache.php b/app/Services/Tg/Hook/Mod/ArticleCache.php index 9246d68e..5a50e18f 100755 --- a/app/Services/Tg/Hook/Mod/ArticleCache.php +++ b/app/Services/Tg/Hook/Mod/ArticleCache.php @@ -46,4 +46,28 @@ class ArticleCache extends Base { return $r; } + + public function show($aParam) + { + $xCode = $aParam["aArg"][0] ?? ":last"; + $sCode = $xCode; + + if ($xCode == "?") { + return "#show__[code:last]"; + } + + if ($xCode === ":last") { + $sCode = ModelArticleCache::orderBy("id", "desc")->first()?->code; + } + + $aCache = ModelArticleCache::where("code", $sCode)->get()->toArray(); + + $a = []; + foreach ($aCache as $aCacheRow) { + $aContent = json_decode($aCacheRow['content'], true); + $a[] = $aContent; + } + + return $this->toJson($a); + } }