diff --git a/app/Services/Tg/Hook/Dog.php b/app/Services/Tg/Hook/Dog.php index a0dd2e5f..f81edef6 100755 --- a/app/Services/Tg/Hook/Dog.php +++ b/app/Services/Tg/Hook/Dog.php @@ -441,6 +441,56 @@ private function _getLimit() return $iLimit; } + public function last() + { + $iLastId = $this->oModelSelf->orderBy("id", "desc")->first()?->id; + + $aParam = []; + $aParam["aOption"][1] = "id"; + $aParam["aArg"][1] = $iLastId; + + return $this->find($aParam); + } + + public function hitRaw($aParam) + { + $xId = $aParam["aArg"][1] ?? false; + $sField = $aParam["aOption"][1] ?? false; + + if (!$xId) { + return "需要id"; + } + + if (!$sField) { + return "需要field"; + } + + if ($xId == "?") { + return "#hitRaw__[field] [id]"; + } + + $sContent = $this->oModelSelf->where("id", $xId)->first()?->{$sField}; + + return $sContent; + } + + public function findRaw($aParam) + { + $xId = $aParam["aArg"][1] ?? false; + + if (!$xId) { + return "需要id"; + } + + if ($xId == "?") { + return "#findRaw [id]"; + } + + $aData = $this->oModelSelf->where("id", $xId)->first()->toArray(); + + return $this->toJson($aData); + } + public function find($aParam) { $sField = $aParam["aOption"][1] ?? $this->sPrimaryKey;