no message
This commit is contained in:
parent
dc73e678d6
commit
07ea286527
@ -68,8 +68,8 @@ final class HookController
|
||||
$sFunc = $aCmd[1];
|
||||
}
|
||||
|
||||
$sClass = ucfirst($sClass);
|
||||
$sFunc = ucfirst($sFunc);
|
||||
$sUClass = ucfirst($sClass);
|
||||
$sUFunc = ucfirst($sFunc);
|
||||
|
||||
unset($aOption[0]);
|
||||
unset($aArg[0]);
|
||||
@ -78,29 +78,58 @@ final class HookController
|
||||
$aParams['aArg'] = $aArg;
|
||||
|
||||
$sClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sClass;
|
||||
|
||||
$sUClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sUClass;
|
||||
|
||||
// 兼容大小写,自己挖的坑
|
||||
if (method_exists($sClassPath, $sFunc)) {
|
||||
$oInstans = new $sClassPath();
|
||||
$r = $oInstans->$sFunc($aParams, $aUpdate);
|
||||
|
||||
// 可以不返回,里面直接send
|
||||
if (isset($r)) {
|
||||
// if (empty($r)) { $r = 'hook的mod返回空'; }
|
||||
// 返回可以是数组
|
||||
if (is_array($r)) {
|
||||
foreach ($r as $row) {
|
||||
$oTGHttp->sendToTG($row);
|
||||
}
|
||||
} else {
|
||||
$oTGHttp->sendToTG($r);
|
||||
}
|
||||
|
||||
Http::response(200, 'ok');
|
||||
}
|
||||
|
||||
} else if (method_exists($sUClassPath, $sUFunc)) {
|
||||
$oInstans = new $sUClassPath();
|
||||
$r = $oInstans->$sUFunc($aParams, $aUpdate);
|
||||
} else {
|
||||
throw new \Exception("没有这个方法:".$sClass.'#'.$sFunc);
|
||||
}
|
||||
|
||||
if (isset($r)) {
|
||||
// 返回可以是数组
|
||||
if (is_array($r)) {
|
||||
foreach ($r as $row) {
|
||||
$oTGHttp->sendToTG($row);
|
||||
}
|
||||
} else {
|
||||
$oTGHttp->sendToTG($r);
|
||||
}
|
||||
|
||||
Http::response(200, 'ok');
|
||||
} else {
|
||||
throw new \Exception("?!?!?!?!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (method_exists($sClassPath, $sFunc)) {
|
||||
// $oInstans = new $sClassPath();
|
||||
// $r = $oInstans->$sFunc($aParams, $aUpdate);
|
||||
//
|
||||
// // 可以不返回,里面直接send
|
||||
// if (isset($r)) {
|
||||
//// if (empty($r)) { $r = 'hook的mod返回空'; }
|
||||
// // 返回可以是数组
|
||||
// if (is_array($r)) {
|
||||
// foreach ($r as $row) {
|
||||
// $oTGHttp->sendToTG($row);
|
||||
// }
|
||||
// } else {
|
||||
// $oTGHttp->sendToTG($r);
|
||||
// }
|
||||
//
|
||||
// Http::response(200, 'ok');
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// throw new \Exception("没有这个方法:".$sClass.'#'.$sFunc);
|
||||
// }
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
$sMessage = "错误(line:".$e->getLine()."): " . $e->getMessage();
|
||||
|
||||
@ -11,6 +11,11 @@ use App\Services\TomTool\Http;
|
||||
|
||||
class SakaiController
|
||||
{
|
||||
// public function hook()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
public function test1()
|
||||
{
|
||||
// tomd(123, 1);
|
||||
@ -63,6 +68,7 @@ class SakaiController
|
||||
// $s = "/note#memo__1 股您吗的";
|
||||
// $s = "/note#icon";
|
||||
$s = "/note#add__now 脱裤子 112";
|
||||
$s = "/note_option#add__ttt zzz";
|
||||
|
||||
$oHttp = new Http();
|
||||
$oHttp->sMethod = "post";
|
||||
|
||||
11
app/Models/NoteOption.php
Executable file
11
app/Models/NoteOption.php
Executable file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class NoteOption extends Model
|
||||
{
|
||||
protected $table = 'note_option';
|
||||
public $timestamps = false;
|
||||
}
|
||||
23
app/Services/TG/Hook/Mod/note_option.php
Normal file
23
app/Services/TG/Hook/Mod/note_option.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\TG\Hook\Mod;
|
||||
|
||||
use App\Models\Note as ModelNote;
|
||||
use App\Models\NoteOption as ModelNoteOption;
|
||||
|
||||
class Note_option extends Base {
|
||||
|
||||
public function add($aParam)
|
||||
{
|
||||
$sKey = $aParam["aOption"][1];
|
||||
$sValue = $aParam["aArg"][1];
|
||||
|
||||
$oModelNoteOption = new ModelNoteOption();
|
||||
$oModelNoteOption->key = $sKey;
|
||||
$oModelNoteOption->value = $sValue;
|
||||
$r = $oModelNoteOption->save();
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user