diff --git a/app/Http/Controllers/SakaiController.php b/app/Http/Controllers/SakaiController.php index b73cc5aa..8776d11b 100755 --- a/app/Http/Controllers/SakaiController.php +++ b/app/Http/Controllers/SakaiController.php @@ -359,8 +359,12 @@ class SakaiController $s = "/ship#set__fuc__name jjjjjzz"; + $s = "/box#github_tag_create__1 10"; + $s = "/tool#ref book"; + $s = "/tool#ref book Op"; + $s = "/tool#refLike book Op"; - + $s = "/box#github_tag_rand__b 3"; // $s = "toWait 333333"; diff --git a/app/Models/BoxGithubTag.php b/app/Models/BoxGithubTag.php new file mode 100755 index 00000000..aacc2ce0 --- /dev/null +++ b/app/Models/BoxGithubTag.php @@ -0,0 +1,12 @@ +toArray(); + + shuffle($aGithubTag); + + $i = 1; + $sRandTag = ""; + foreach ($aGithubTag as $aGithubTagRow) { + if ($i == 1) { + $sPre = ""; + } else { + $sPre = ","; + } + + if ($sType == "b") { + if ($aGithubTagRow["type"] == "cn") { + continue; + } + } + + $sRandTag .= $sPre.$aGithubTagRow["tag"]; + + if ($i >= $iLimit) { + break; + } else { + $i++; + } + } + + return $sRandTag; + } + + public function github_tag_list() + { + $oGithubTag = GithubTag::all(); + + return $this->toJson($oGithubTag); + } + + public function github_tag_add($aParam) + { + $sTag = $aParam["aArg"][1] ?? false; + $sType = $aParam["aArg"][2] ?? false; + + if (!$sTag) { + return "需要arg[1],tag。"; + } + + if (!$sType) { + return "需要arg[2],cn中文,en英文。"; + } + + $oGithubTag = new GithubTag(); + $oGithubTag->tag = $sTag; + $oGithubTag->type = $sType; + $oGithubTag->save(); + + return $this->toJson($oGithubTag); + } + + public function github_tag_set($aParam) + { + $iId = $aParam["aOption"][1] ?? false; + $sField = $aParam["aOption"][2] ?? false; + $sValue = $aParam["aArg"][1] ?? false; + + if (!$iId) { + return "需要option[1],id。"; + } + + if (!$sField) { + return "需要option[2],field。"; + } + + if (!$sValue) { + return "需要arg[1],value。"; + } + + $oGithubTag = GithubTag::find($iId); + + if (!$oGithubTag) { + return "没找到"; + } + + $oGithubTag->$sField = $sValue; + $oGithubTag->save(); + + return $this->toJson($oGithubTag); + } + + public function github_tag_del($aParam) + { + $iId = $aParam["aArg"][1] ?? false; + + if (!$iId) { + return "需要arg[1],id。"; + } + + $oGithubTag = GithubTag::find($iId); + $r = $oGithubTag->delete(); + + return $r; + } + +} diff --git a/app/Services/TG/Hook/Mod/note_option.php b/app/Services/TG/Hook/Mod/Note_option.php similarity index 100% rename from app/Services/TG/Hook/Mod/note_option.php rename to app/Services/TG/Hook/Mod/Note_option.php diff --git a/app/Services/TG/Hook/Mod/Tool.php b/app/Services/TG/Hook/Mod/Tool.php new file mode 100644 index 00000000..be804724 --- /dev/null +++ b/app/Services/TG/Hook/Mod/Tool.php @@ -0,0 +1,76 @@ +getMethods(); + + $str = ""; + foreach ($oMetHods as $oMetHodsRow) { + if ($oMetHodsRow->class == $sClassPath) { + + // 有like时只提取like到的,无like时得到所有 + if ($sLike) { + $string = "Hello, world!"; + $character = "o"; + + if (stripos($oMetHodsRow->name, $sLike) !== false) { + $str .= "
"; + $str .= $oMetHodsRow->name; + } + + } else { + $str .= "
"; + $str .= $oMetHodsRow->name; + } + + } + } + + return $str; + } + + public function refLike($aParam) + { + $sClassName = $aParam["aArg"][1] ?? false; + $sLike = $aParam["aArg"][2] ?? false; + + if (!$sClassName) { + return "需要arg[1],类名。"; + } + + if (!$sLike) { + return "需要arg[2],like。"; + } + + return $this->Ref($aParam); + } + +// public function ref() +// { +// $oRef = new \ReflectionClass($this); +// $oMetHods = $oRef->getMethods(); +// +// tomd($oMetHods, 1); +// } + +}