diff --git a/app/Services/Tg/Hook/Dog.php b/app/Services/Tg/Hook/Dog.php index 9b0b3d5e..f81edef6 100755 --- a/app/Services/Tg/Hook/Dog.php +++ b/app/Services/Tg/Hook/Dog.php @@ -452,6 +452,45 @@ class Dog extends Mod\Base { 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; diff --git a/app/Services/Tg/Hook/Mod/FreenodePool.php b/app/Services/Tg/Hook/Mod/FreenodePool.php index 50640aa2..9a39fee5 100755 --- a/app/Services/Tg/Hook/Mod/FreenodePool.php +++ b/app/Services/Tg/Hook/Mod/FreenodePool.php @@ -25,6 +25,31 @@ class FreenodePool extends Base { return $this->oDog->$sName($aArg[0]); } +// public function findRaw($aParam) +// { +// $xId = $aParam["aArg"][1] ?? false; +// +// if (!$xId) { +// return "需要id"; +// } +// +// if ($xId == "?") { +// return "#findRaw [id]"; +// } +// +// $oDog = $this->oDog->oModelSelf->where("id", $xId)->first(); +// +// if (!$oDog) { +// return "没有这个id数据"; +// } +// +// $aDog = $oDog->toArray(); +// +// $aDog["content"] = json_decode($aDog["content"], true); +// +// return $this->toJson($aDog); +// } + public function testF() { $a = [