no message
This commit is contained in:
parent
edf92e855a
commit
e3238be467
@ -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";
|
||||
|
||||
12
app/Models/BoxGithubTag.php
Executable file
12
app/Models/BoxGithubTag.php
Executable file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BoxGithubTag extends Model
|
||||
{
|
||||
protected $table = 'box_github_tag';
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
127
app/Services/TG/Hook/Mod/Box.php
Normal file
127
app/Services/TG/Hook/Mod/Box.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\TG\Hook\Mod;
|
||||
|
||||
//use App\Models\Box as ModelShip;
|
||||
//use App\Services\TomTool\Http;
|
||||
use App\Models\BoxGithubTag as GithubTag;
|
||||
|
||||
class Box extends Base {
|
||||
|
||||
public function github_tag_rand($aParam)
|
||||
{
|
||||
$sType = $aParam["aOption"][1] ?? false;
|
||||
$iLimit = $aParam["aArg"][1] ?? false;
|
||||
|
||||
if (!$sType) {
|
||||
return "要有option[1],a带中文,b不带中文。";
|
||||
}
|
||||
|
||||
if (!$iLimit) {
|
||||
return "要有arg[1], 生成几个。";
|
||||
}
|
||||
|
||||
$aGithubTag = GithubTag::all()->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;
|
||||
}
|
||||
|
||||
}
|
||||
76
app/Services/TG/Hook/Mod/Tool.php
Normal file
76
app/Services/TG/Hook/Mod/Tool.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\TG\Hook\Mod;
|
||||
|
||||
//use App\Models\Box as ModelShip;
|
||||
//use App\Services\TomTool\Http;
|
||||
//use App\Models\BoxGithubTag as GithubTag;
|
||||
|
||||
class Tool extends Base {
|
||||
|
||||
public function Ref($aParam)
|
||||
{
|
||||
$sClassName = $aParam["aArg"][1] ?? false;
|
||||
$sLike = $aParam["aArg"][2] ?? false;
|
||||
|
||||
if (!$sClassName) {
|
||||
return "需要arg[1],类名。";
|
||||
}
|
||||
|
||||
$sClassName = ucfirst($sClassName);
|
||||
|
||||
$sClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sClassName;
|
||||
|
||||
$oRef = new \ReflectionClass($sClassPath);
|
||||
$oMetHods = $oRef->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 .= "<br>";
|
||||
$str .= $oMetHodsRow->name;
|
||||
}
|
||||
|
||||
} else {
|
||||
$str .= "<br>";
|
||||
$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);
|
||||
// }
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user