oDog = new Dog(new ModelArticleCache()); $this->oDog->_setDogName("articleCache"); $this->oDog->_setJsonField(["content"]); // $this->oDog->_setStrField(["content"]); $this->aUpdate = $aUpdate; } public function __call($sName, $aArg) { return $this->oDog->$sName($aArg[0]); } public function save($aParam) { $r = ServiceArticleCacheTg::start()->saveToSchema(); return $r->getResult(); } public function reCron() { $o = ModelArticleCacheTime::first(); $o->time = time() - 6000; $o->save(); $o = ModelArticleCache::orderBy("id", "desc")->first(); $r = ModelArticleCache::where("code", $o->code)->update(["status" => 1]); return $r; } public function show($aParam) { $xCode = $aParam["aArg"][1] ?? ":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["id:".$aCacheRow['id']] = $aContent; } return $this->toJson($a); } public function echo($aParam) { $iId = $aParam["aArg"][1] ?? ""; if ($iId === "?") { return "#show__[id],show()获取id"; } if (!$iId) { return "id必须"; } $oCache = ModelArticleCache::where("id", $iId)->first(); if (!$oCache) { return "没找到"; } return $oCache->content; } }