From 61328ce2b6c70ae1c9b9f42bf3de0b18f17f0f14 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Thu, 17 Jul 2025 20:46:20 +0800 Subject: [PATCH] no message --- app/Services/TG/Hook/Mod/DOG.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/Services/TG/Hook/Mod/DOG.php b/app/Services/TG/Hook/Mod/DOG.php index 218d795..0d3554d 100644 --- a/app/Services/TG/Hook/Mod/DOG.php +++ b/app/Services/TG/Hook/Mod/DOG.php @@ -384,7 +384,34 @@ class DOG extends Base { return $this->set($aParam); } - public function setJson($aParam) + public function jsonAdd($aParam) + { + if (($aParam["aArg"][1] ?? false) == "?") { + return "#jsonAdd {json}"; + } + + $aJson = $aParam["aArg"] ?? false; + $sJson = implode(" ", $aJson); + + if (!$sJson) { + return "需要json"; + } + + $aJson = json_decode($sJson, true); + + foreach ($aJson as $k => $v) { + $this->oModelSelf->$k = $v; + } + + $this->oModelSelf->save(); + + $aParam = []; + $aParam["aArg"][1] = $this->oModelSelf->{$this->sPrimaryKey}; + + return $this->find($aParam); + } + + public function jsonSet($aParam) { $sWhereValue = $aParam["aOption"][1] ?? false; $aJson = $aParam["aArg"] ?? false;