no message
This commit is contained in:
parent
8dd9eb5efd
commit
6ba0665967
@ -59,4 +59,11 @@ final class CountryController
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toGithub($randData)
|
||||||
|
{
|
||||||
|
$str = date('Y年m月d日').",本次更新共".$randData["nodeCount"]."个可用节点,最高速度".$randData["speed"]."M/S。覆盖".implode("、", $randData["country"])."等多个区域。";
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,19 +4,45 @@ namespace App\Http\Controllers\Api;
|
|||||||
|
|
||||||
//use App\Models\Book as ModelBook;
|
//use App\Models\Book as ModelBook;
|
||||||
//use App\Models\BookOption as ModelBookOption;
|
//use App\Models\BookOption as ModelBookOption;
|
||||||
//use App\Services\TomTool\Http;
|
use App\Services\TomTool\Http;
|
||||||
|
use App\Services\TG\Http as TgHttp;
|
||||||
use App\Models\GoodPool as ModelGoodPool;
|
use App\Models\GoodPool as ModelGoodPool;
|
||||||
|
use App\Models\Blade as ModelBlade;
|
||||||
|
use App\Models\Ship as ModelShip;
|
||||||
|
use App\Models\BoxCountry as ModelCountry;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\BladeJctj as ModelBladeJctj;
|
||||||
|
use App\Models\BladeJctjOption as ModelBladeJctjOption;
|
||||||
|
|
||||||
class GithubController
|
class GithubController
|
||||||
{
|
{
|
||||||
|
|
||||||
private function echo($zz){
|
public $aArticle = [];
|
||||||
return $zz;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function eval($sEval)
|
private function echo($sStr, $sMod)
|
||||||
{
|
{
|
||||||
return eval("return ".$sEval);
|
if (empty($sStr)) {
|
||||||
|
return $sStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sBr = "
|
||||||
|
";
|
||||||
|
|
||||||
|
if ($sMod == "brTop") {
|
||||||
|
|
||||||
|
$sStr = $sBr.$sStr;
|
||||||
|
|
||||||
|
} else if ($sMod == "brBottom") {
|
||||||
|
|
||||||
|
$sStr = $sStr.$sBr;
|
||||||
|
|
||||||
|
} else if ($sMod == "brFull") {
|
||||||
|
|
||||||
|
$sStr = $sBr.$sStr.$sBr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function date($date)
|
private function date($date)
|
||||||
@ -43,6 +69,241 @@ class GithubController
|
|||||||
return $sGoodStr;
|
return $sGoodStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function toDayUpd($aArticle)
|
||||||
|
{
|
||||||
|
$oHttp = new Http();
|
||||||
|
$oHttp->sMethod = "get";
|
||||||
|
$oHttp->sToUrl = "https://".$this->aArticle["fn_www"]."/api/github/todayupd";
|
||||||
|
// $oHttp->bIsJson = true;
|
||||||
|
// $oHttp->aData = $row;
|
||||||
|
$r = $oHttp->send();
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getHuodong($aShip)
|
||||||
|
{
|
||||||
|
$sDateNow = date("Y-m-d");
|
||||||
|
// $sDateNow = "2025-05-03";
|
||||||
|
|
||||||
|
$oHttp = new Http();
|
||||||
|
$oHttp->sMethod = "get";
|
||||||
|
$oHttp->sToUrl = "https://".$aShip["www"]."/api/huodong/findbydate/".$sDateNow;
|
||||||
|
// $oHttp->bIsJson = true;
|
||||||
|
// $oHttp->aData = $row;
|
||||||
|
$r = $oHttp->send();
|
||||||
|
$aHuodong = json_decode($r, true);
|
||||||
|
|
||||||
|
$sHuodongStr = "";
|
||||||
|
if (!empty($aHuodong)) {
|
||||||
|
$sStartDateStr = date("n月j日", strtotime($aHuodong['start_date']));
|
||||||
|
$sEndDateStr = date("n月j日", strtotime($aHuodong['end_date']));
|
||||||
|
|
||||||
|
$sHuodongStr = "🎁 ".$aHuodong['title'].":".$sStartDateStr."至".$sEndDateStr."期间,".$aHuodong['content'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sHuodongStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function nodeContryStr()
|
||||||
|
{
|
||||||
|
$aBoxCountryRand = ModelCountry::rand();
|
||||||
|
|
||||||
|
return $aBoxCountryRand["str"];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function mod_blade()
|
||||||
|
{
|
||||||
|
$aArticle = $this->aArticle;
|
||||||
|
|
||||||
|
// 可选
|
||||||
|
// $t = $this->toDayUpd(); freenode是否更新
|
||||||
|
// $t = $this->nodeContryStr(); 地区速度
|
||||||
|
$oBlade = ModelBlade::where("code", $aArticle["mod"])->first();
|
||||||
|
$aBlade = $oBlade->toArray();
|
||||||
|
|
||||||
|
$oShip = ModelShip::where("code", $aArticle["ship_code"])->first();
|
||||||
|
$aShip = $oShip->toArray();
|
||||||
|
|
||||||
|
$aGoodRand = ModelGoodPool::_rand($aArticle["ship_code"]);
|
||||||
|
$sGoodRand = ModelGoodPool::_goodToGithub($aGoodRand["good"]);
|
||||||
|
$ex["good_rand"] = $sGoodRand;
|
||||||
|
|
||||||
|
$sGoodShip = ModelGoodPool::_goodToGithub($aShip["good"]);
|
||||||
|
$ex["good_ship"] = $sGoodShip;
|
||||||
|
|
||||||
|
$ex["url_sub_v2ray"] = "https://".$aArticle["fn_www"]."/feed/v2ray-".date("Ymd").".txt";
|
||||||
|
$ex["url_sub_clash"] = "https://".$aArticle["fn_www"]."/clash/v2ray-".date("Ymd").".yaml";
|
||||||
|
// $ex["youhui"] = "购买套餐时输入【".$aArticle['sale_code']."】优惠码,可享".$aArticle['sale_rate']."折优惠,折后低至8元/月。";
|
||||||
|
|
||||||
|
$ex["huodong"] = $this->getHuodong($aShip);
|
||||||
|
|
||||||
|
$eval = $oBlade->content;
|
||||||
|
|
||||||
|
eval("\$eval = \"$eval\";");
|
||||||
|
echo $eval;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function mod_jctj()
|
||||||
|
{
|
||||||
|
$aArticle = $this->aArticle;
|
||||||
|
|
||||||
|
$oBladeArtile = ModelBlade::where("code", $aArticle["mod"])->first();
|
||||||
|
|
||||||
|
if (!$oBladeArtile) {
|
||||||
|
throw new \Exception("jctj也有有对应blade,没找到 \n\n".json_encode($aArticle));
|
||||||
|
}
|
||||||
|
|
||||||
|
$aBladeArtile = $oBladeArtile->toArray();
|
||||||
|
|
||||||
|
//// 生成随机文章,完全独立,可以拿到services里
|
||||||
|
$iLimit = ModelBladeJctjOption::_hit("limit");
|
||||||
|
$iRand100 = rand(0, 100);
|
||||||
|
|
||||||
|
$oTomShip = ModelBladeJctj::where("is_tom", 1)->where("in100", ">=", $iRand100)->get();
|
||||||
|
$iTomShipCount = count($oTomShip);
|
||||||
|
|
||||||
|
$iLajiLimit = $iLimit - $iTomShipCount;
|
||||||
|
$oLaji = ModelBladeJctj::where("is_tom", "!=", 1)->get();
|
||||||
|
|
||||||
|
$aTomShip = $oTomShip->toArray();
|
||||||
|
$aLaji = $oLaji->toArray();
|
||||||
|
|
||||||
|
shuffle($aLaji);
|
||||||
|
shuffle($aTomShip);
|
||||||
|
$aLaji = array_slice($aLaji, 0, $iLimit);
|
||||||
|
|
||||||
|
$iTopCount = 0;
|
||||||
|
$iRandCount = 0;
|
||||||
|
$aTopShip = [];
|
||||||
|
$aRandShip = [];
|
||||||
|
foreach ($aTomShip as $aTomShipRow) {
|
||||||
|
|
||||||
|
if ($aTomShipRow["position"] == "top") {
|
||||||
|
unset($aLaji[$iTopCount]);
|
||||||
|
$iTopCount++;
|
||||||
|
$aTopShip[] = $aTomShipRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($aTomShipRow["position"] == "rand") {
|
||||||
|
$iRandCount++;
|
||||||
|
$aRandShip[] = $aTomShipRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 优先top,rand补充
|
||||||
|
if ($iRandCount > count($aLaji)) {
|
||||||
|
$iRandCount = count($aLaji);
|
||||||
|
}
|
||||||
|
|
||||||
|
$aRandKey = [];
|
||||||
|
if ($iRandCount >= 1) {
|
||||||
|
$aRandKey = array_rand($aLaji, $iRandCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!empty($aRandKey) && !is_array($aRandKey)) || $aRandKey === 0) {
|
||||||
|
$tmp = $aRandKey;
|
||||||
|
$aRandKey = [];
|
||||||
|
$aRandKey[] = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始填充
|
||||||
|
if (count($aTopShip) > 0) {
|
||||||
|
foreach ($aTopShip as $k => $aTopShipRow) {
|
||||||
|
$aLaji[$k] = $aTopShipRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($aRandKey) > 0) {
|
||||||
|
$i = 0;
|
||||||
|
foreach ($aRandKey as $v) {
|
||||||
|
$aLaji[$v] = $aRandShip[$i];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($aLaji);
|
||||||
|
//// 生成随机文章 end
|
||||||
|
|
||||||
|
$sTitleSize = ModelBladeJctjOption::_hit("title_size");
|
||||||
|
$sJctj = "";
|
||||||
|
$i = 1;
|
||||||
|
$sEnter = "
|
||||||
|
";
|
||||||
|
|
||||||
|
$eval = $aBladeArtile["content"];
|
||||||
|
eval("\$eval = \"$eval\";");
|
||||||
|
$sJctj .= $eval;
|
||||||
|
$sJctj .= $sEnter;
|
||||||
|
$sJctj .= $sEnter;
|
||||||
|
foreach ($aLaji as $k => $aLajiRow) {
|
||||||
|
|
||||||
|
// is_tom处理
|
||||||
|
if ($aLajiRow["is_tom"] == 1) {
|
||||||
|
|
||||||
|
$oShip = ModelShip::where("code", $aLajiRow["code"])->first();
|
||||||
|
|
||||||
|
if ($oShip) {
|
||||||
|
$aShip = $oShip->toArray();
|
||||||
|
$aGoodRand = ModelGoodPool::_rand($aLajiRow["code"]);
|
||||||
|
$sGoodRand = ModelGoodPool::_goodToGithub($aGoodRand["good"]);
|
||||||
|
$ex["good_rand"] = $sGoodRand;
|
||||||
|
|
||||||
|
$sGoodShip = ModelGoodPool::_goodToGithub($aShip["good"]);
|
||||||
|
$ex["good_ship"] = $sGoodShip;
|
||||||
|
|
||||||
|
$ex["huodong"] = $this->getHuodong($aShip);
|
||||||
|
|
||||||
|
$eval = $aLajiRow["content"];
|
||||||
|
eval("\$eval = \"$eval\";");
|
||||||
|
$aLajiRow["content"] = $eval;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($i !== 1) {
|
||||||
|
$sJctj .= $sEnter;
|
||||||
|
$sJctj .= $sEnter;
|
||||||
|
}
|
||||||
|
$sJctj .= $sTitleSize." ".$i.".".$aLajiRow["title"];
|
||||||
|
$sJctj .= $sEnter;
|
||||||
|
$sJctj .= $sEnter;
|
||||||
|
$sJctj .= $aLajiRow["content"];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $sJctj;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$aArticle = $request->all();
|
||||||
|
$this->aArticle = $aArticle;
|
||||||
|
|
||||||
|
if ($aArticle["mod_type"] == "blade") {
|
||||||
|
|
||||||
|
return $this->mod_blade();
|
||||||
|
|
||||||
|
} else if ($aArticle["mod_type"] == "jctj") {
|
||||||
|
|
||||||
|
return $this->mod_jctj();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
|
||||||
|
$sMessage = "错误(文件: " . $e->getFile() . ",行: " . $e->getLine() . "): " . $e->getMessage();
|
||||||
|
|
||||||
|
$oTgHttp = (new TgHttp())->send($sMessage);
|
||||||
|
|
||||||
|
Http::response(200, 'error');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,11 +10,18 @@ use App\Models\GoodPool as ModelGoodPool;
|
|||||||
class GoodController
|
class GoodController
|
||||||
{
|
{
|
||||||
|
|
||||||
// public function rand($sClass)
|
public function rand($sClass)
|
||||||
// {
|
{
|
||||||
// $oGood = ModelGoodPool::_all();
|
$aGood = ModelGoodPool::where("class", $sClass)->get()->toArray();
|
||||||
//
|
|
||||||
// tomd($oGood, 1);
|
$iGoodRandKey = array_rand($aGood);
|
||||||
// }
|
|
||||||
|
$aGoodRand = $aGood[$iGoodRandKey];
|
||||||
|
|
||||||
|
$sGoodRandJson = json_encode($aGoodRand);
|
||||||
|
|
||||||
|
echo $sGoodRandJson;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,34 +87,37 @@ final class HookController
|
|||||||
$sClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sClass;
|
$sClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sClass;
|
||||||
$sUClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sUClass;
|
$sUClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sUClass;
|
||||||
|
|
||||||
|
$oInstans = new $sClassPath($aUpdate);
|
||||||
|
$r = $oInstans->$sFunc($aParams);
|
||||||
|
|
||||||
// 兼容大小写,自己挖的坑
|
// 兼容大小写,自己挖的坑
|
||||||
if (method_exists($sClassPath, $sFunc)) {
|
// if (method_exists($sClassPath, $sFunc)) {
|
||||||
$oInstans = new $sClassPath();
|
// $oInstans = new $sClassPath($aUpdate);
|
||||||
$r = $oInstans->$sFunc($aParams, $aUpdate);
|
|
||||||
} else if (method_exists($sUClassPath, $sUFunc)) {
|
|
||||||
$oInstans = new $sUClassPath();
|
|
||||||
$r = $oInstans->$sUFunc($aParams, $aUpdate);
|
|
||||||
}
|
|
||||||
// else if ($sClass == "book" || $sClass == "Book") {
|
|
||||||
// $sFunc = "main";
|
|
||||||
// $oInstans = new $sUClassPath();
|
|
||||||
// $r = $oInstans->$sFunc($aParams, $aUpdate);
|
// $r = $oInstans->$sFunc($aParams, $aUpdate);
|
||||||
|
// } else if (method_exists($sUClassPath, $sUFunc)) {
|
||||||
|
// $oInstans = new $sUClassPath($aUpdate);
|
||||||
|
// $r = $oInstans->$sUFunc($aParams, $aUpdate);
|
||||||
|
// }
|
||||||
|
//// else if ($sClass == "book" || $sClass == "Book") {
|
||||||
|
//// $sFunc = "main";
|
||||||
|
//// $oInstans = new $sUClassPath();
|
||||||
|
//// $r = $oInstans->$sFunc($aParams, $aUpdate);
|
||||||
|
//// }
|
||||||
|
// else {
|
||||||
|
// throw new \Exception("没有这个方法:".$sClass.'#'.$sFunc);
|
||||||
// }
|
// }
|
||||||
else {
|
|
||||||
throw new \Exception("没有这个方法:".$sClass.'#'.$sFunc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($r)) {
|
if (isset($r)) {
|
||||||
// 返回可以是数组
|
// 返回可以是数组
|
||||||
if (is_array($r)) {
|
if (is_array($r)) {
|
||||||
foreach ($r as $row) {
|
foreach ($r as $row) {
|
||||||
$oTGHttp->sendToTG($row);
|
$oTGHttp->sendToTG($row, $aUpdate);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$oTGHttp->sendToTG($r);
|
$oTGHttp->sendToTG($r, $aUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
Http::response(200, 'ok');
|
Http::response(200);
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception("?!?!?!?!");
|
throw new \Exception("?!?!?!?!");
|
||||||
}
|
}
|
||||||
@ -122,7 +125,7 @@ final class HookController
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$sMessage = "错误(文件: " . $e->getFile() . ",行: " . $e->getLine() . "): " . $e->getMessage();
|
$sMessage = "错误(文件: " . $e->getFile() . ",行: " . $e->getLine() . "): " . $e->getMessage();
|
||||||
|
|
||||||
$oTGHttp->sendToTG($sMessage);
|
$oTGHttp->sendToTG($sMessage, $aUpdate);
|
||||||
|
|
||||||
Http::response(200, 'error');
|
Http::response(200, 'error');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,79 +2,189 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
//use Illuminate\Http\Request;
|
//use App\Models\Book as ModelBook;
|
||||||
//use App\Models\ArticleList;
|
//use App\Models\BookOption as ModelBookOption;
|
||||||
//use App\Services\Time;
|
use App\Services\TomTool\Http;
|
||||||
//use voku\helper\AntiXSS;
|
use App\Models\DoveSite as ModelDoveSite;
|
||||||
//use App\Models\Tags;
|
|
||||||
//use App\Services\TomTool\Http;
|
|
||||||
use App\Models\Book as ModelBook;
|
|
||||||
use App\Models\BookOption as ModelBookOption;
|
|
||||||
use App\Services\TG\Http as TGHttp;
|
|
||||||
|
|
||||||
class CronController
|
class CmdController
|
||||||
{
|
{
|
||||||
public $oTGHttp;
|
|
||||||
|
|
||||||
function __construct()
|
|
||||||
{
|
|
||||||
$this->oTGHttp = new TGHttp();
|
|
||||||
$this->oTGHttp->sApiToken = env('telegram_token');
|
|
||||||
$this->oTGHttp->sApiChatId = env('telegram_chatid');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$h = date("H");
|
|
||||||
$i = date("i");
|
|
||||||
$s = date("s");
|
|
||||||
|
|
||||||
//// test
|
return view("cmd", [
|
||||||
$k = $_GET["k"] ?? false;
|
// "aSinge" => $aSinge,
|
||||||
$v = $_GET["v"] ?? false;
|
// 'aTagNames' => $aTagsName,
|
||||||
|
// 'sMenu' => 'client',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($k == "h") {
|
public function imageUploadExec()
|
||||||
$h = $v;
|
{
|
||||||
} else if ($k == "i") {
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
$i = $v;
|
// 检查文件是否上传成功
|
||||||
} else if ($k == "k") {
|
if (isset($_FILES['files']) && $_FILES['files']['error'][0] == 0) {
|
||||||
$s = $v;
|
$uploadFileDir = './upload/';
|
||||||
}
|
|
||||||
|
|
||||||
// $h = "00";
|
foreach ($_FILES['files']['tmp_name'] as $key => $tmpName) {
|
||||||
//// test end
|
$fileName = $_FILES['files']['name'][$key];
|
||||||
|
$fileError = $_FILES['files']['error'][$key];
|
||||||
|
|
||||||
if ($h == "00" && $i== "00") {
|
// 检查文件上传是否有错误
|
||||||
|
if ($fileError == 0) {
|
||||||
|
$dest_path = $uploadFileDir . $fileName;
|
||||||
|
|
||||||
$iFireWarningLine = ModelBookOption::_hit("fire_warning_line");
|
// 移动文件到目标目录
|
||||||
|
if (move_uploaded_file($tmpName, $dest_path)) {
|
||||||
$sDateWarningLine = date("Y-m-d H:i:s", strtotime($iFireWarningLine."day"));
|
echo '文件上传成功: ' . $dest_path . '<br>';
|
||||||
$oBook = ModelBook::whereDate("fire", "<=", $sDateWarningLine)->where("fire_close", 0)->get();
|
} else {
|
||||||
|
echo '文件上传失败: ' . $fileName . '<br>';
|
||||||
if (!$oBook->isEmpty()) {
|
}
|
||||||
|
} else {
|
||||||
$oDateNow = new \DateTime();
|
echo '文件上传错误: ' . $fileName . '<br>';
|
||||||
|
|
||||||
foreach ($oBook as $oBookRow) {
|
|
||||||
|
|
||||||
$oDateRag = new \DateTime($oBookRow->fire);
|
|
||||||
|
|
||||||
$iDiffDay = $oDateNow->diff($oDateRag)->days;
|
|
||||||
|
|
||||||
if ($oDateNow > $oDateRag) {
|
|
||||||
$iDiffDay = -$iDiffDay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sTgStr = "⚠️⚠️⚠️ {{ ".$oBookRow->rag." }} 还有 {{ ".$iDiffDay." }} 天到期 ⚠️⚠️⚠️";
|
|
||||||
|
|
||||||
$this->oTGHttp->sendToTG($sTgStr);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
echo '没有文件上传或发生错误。';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function imageUpload()
|
||||||
|
{
|
||||||
|
return view("cmd/image/upload");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ajaxSend()
|
||||||
|
{
|
||||||
|
$sSite = $_POST["site"];
|
||||||
|
$sValue = $_POST["value"];
|
||||||
|
$sHook = $_POST["hook"];
|
||||||
|
$sArea = $_POST["area"];
|
||||||
|
$sUser = $_POST["user"];
|
||||||
|
$sEnterType = $_POST["enterType"];
|
||||||
|
|
||||||
|
if ($sHook) {
|
||||||
|
$sValue = $sHook.$sValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sEnterType == "area") {
|
||||||
|
$sValue = trim($sValue)." ".$sArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
$aDoveSiteMap = ModelDoveSite::_getMap();
|
||||||
|
|
||||||
|
$sUrl = isset($aDoveSiteMap[$sSite]) ? $aDoveSiteMap[$sSite] : false;
|
||||||
|
|
||||||
|
if (!$sUrl) {
|
||||||
|
return "没有这个dove";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sUrl = "https://".$sUrl;
|
||||||
|
|
||||||
|
$aData = [
|
||||||
|
"shell" => "cmd",
|
||||||
|
'update_id' => 123456789,
|
||||||
|
'message' => [
|
||||||
|
'message_id' => 1,
|
||||||
|
'from' => [
|
||||||
|
'id' => 7740568271,
|
||||||
|
'is_bot' => false,
|
||||||
|
'first_name' => $sUser,
|
||||||
|
'last_name' => 'Doe',
|
||||||
|
'username' => 'johndoe',
|
||||||
|
'language_code' => 'en'
|
||||||
|
],
|
||||||
|
'chat' => [
|
||||||
|
'id' => -4668400285,
|
||||||
|
'first_name' => 'John',
|
||||||
|
'last_name' => 'Doe',
|
||||||
|
'username' => 'johndoe',
|
||||||
|
'type' => 'private'
|
||||||
|
],
|
||||||
|
'date' => 1610000000,
|
||||||
|
"text" => $sValue,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// $data = ['key1' => 'value1', 'key2' => 'value2'];
|
||||||
|
// $options = [
|
||||||
|
// 'http' => [
|
||||||
|
// 'method' => 'POST',
|
||||||
|
// 'header' => "Content-Type: application/json\r\n",
|
||||||
|
// 'content' => json_encode($aData)
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
//
|
||||||
|
// $options['ssl'] = [
|
||||||
|
// 'verify_peer' => false,
|
||||||
|
// 'verify_peer_name' => false
|
||||||
|
// ];
|
||||||
|
//
|
||||||
|
// $context = stream_context_create($options);
|
||||||
|
// $response = file_get_contents($url, false, $context);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// echo "<pre>";
|
||||||
|
//// echo($response);
|
||||||
|
//// echo nl2br($response);
|
||||||
|
// echo $response;
|
||||||
|
// exit;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// exit;
|
||||||
|
|
||||||
|
$oHttp = new Http();
|
||||||
|
$oHttp->sMethod = "post";
|
||||||
|
$oHttp->sToUrl = $sUrl;
|
||||||
|
$oHttp->bIsJson = true;
|
||||||
|
$oHttp->aData = $aData;
|
||||||
|
// $oHttp->aData = [
|
||||||
|
// 'update_id' => 123456789,
|
||||||
|
// 'message' => [
|
||||||
|
// 'message_id' => 1,
|
||||||
|
// 'from' => [
|
||||||
|
// 'id' => 7740568271,
|
||||||
|
// 'is_bot' => false,
|
||||||
|
// 'first_name' => 'John',
|
||||||
|
// 'last_name' => 'Doe',
|
||||||
|
// 'username' => 'johndoe',
|
||||||
|
// 'language_code' => 'en'
|
||||||
|
// ],
|
||||||
|
// 'chat' => [
|
||||||
|
// 'id' => -4668400285,
|
||||||
|
// 'first_name' => 'John',
|
||||||
|
// 'last_name' => 'Doe',
|
||||||
|
// 'username' => 'johndoe',
|
||||||
|
// 'type' => 'private'
|
||||||
|
// ],
|
||||||
|
// 'date' => 1610000000,
|
||||||
|
// "text" => $sValue,
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
|
||||||
|
$r = $oHttp->send();
|
||||||
|
|
||||||
|
// echo "<pre>";
|
||||||
|
// echo($r);
|
||||||
|
echo $r;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
//use App\Models\Book as ModelBook;
|
|
||||||
//use App\Models\BookOption as ModelBookOption;
|
|
||||||
//use App\Services\TomTool\Http;
|
|
||||||
//use App\Models\DoveSite as ModelDoveSite;
|
|
||||||
|
|
||||||
class GoodController
|
|
||||||
{
|
|
||||||
|
|
||||||
public function rand($sClass)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -11,6 +11,38 @@ use App\Services\TomTool\Http;
|
|||||||
|
|
||||||
class SakaiController
|
class SakaiController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function xx($a)
|
||||||
|
{
|
||||||
|
$huiche = "
|
||||||
|
";
|
||||||
|
return $huiche.$a.$huiche;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test1()
|
||||||
|
{
|
||||||
|
|
||||||
|
function xx($a){
|
||||||
|
return 234234234;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
$a = "哈哈哈哈";
|
||||||
|
$a = "z";
|
||||||
|
|
||||||
|
|
||||||
|
$str = "asdfasdfasdfasdfas
|
||||||
|
|
||||||
|
dfasdfa
|
||||||
|
{$this->xx($a)}
|
||||||
|
sdsdfasdf";
|
||||||
|
|
||||||
|
|
||||||
|
// file_put_contents('output.txt', $str);
|
||||||
|
echo $str;
|
||||||
|
// echo 123123;
|
||||||
|
}
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
// $sPath = ModelBookHook::_first_path();
|
// $sPath = ModelBookHook::_first_path();
|
||||||
@ -372,6 +404,8 @@ class SakaiController
|
|||||||
|
|
||||||
$s = "/box#country_test";
|
$s = "/box#country_test";
|
||||||
|
|
||||||
|
// $s = "";
|
||||||
|
|
||||||
// $s = "toWait 333333";
|
// $s = "toWait 333333";
|
||||||
// $s = "no 2";
|
// $s = "no 2";
|
||||||
//
|
//
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class Blade extends Model
|
class Blade extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'blade';
|
protected $table = 'blade';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
public static function _listKey()
|
public static function _listKey()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,9 +4,9 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Jctj extends Model
|
class BladeJctj extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'jctj';
|
protected $table = 'blade_jctj';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
// public static function _listKey()
|
// public static function _listKey()
|
||||||
|
|||||||
@ -4,11 +4,18 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class BladeJctj extends Model
|
class BladeJctjOption extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'blade_jctj';
|
protected $table = 'blade_jctj_option';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
public static function _hit($k)
|
||||||
|
{
|
||||||
|
$v = self::where("k", $k)->first()?->v;
|
||||||
|
|
||||||
|
return $v;
|
||||||
|
}
|
||||||
|
|
||||||
// public static function _listKey()
|
// public static function _listKey()
|
||||||
// {
|
// {
|
||||||
// $aSelf = self::all()->toArray();
|
// $aSelf = self::all()->toArray();
|
||||||
|
|||||||
@ -10,36 +10,23 @@ class BookHook extends Model
|
|||||||
protected $table = 'book_hook';
|
protected $table = 'book_hook';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
// public static function _first($sType)
|
public static function _first_path($aUpdate)
|
||||||
// {
|
|
||||||
// $oData = first();
|
|
||||||
//
|
|
||||||
// return $oData;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static function _first_key($sType)
|
|
||||||
// {
|
|
||||||
// $sKey = self::where("type", $sType)->first()?->key;
|
|
||||||
//
|
|
||||||
// return $sKey;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function _first_path()
|
|
||||||
{
|
{
|
||||||
$oSelf = self::first()?->path;
|
$sUser = $aUpdate["message"]["from"]["first_name"];
|
||||||
|
|
||||||
|
$oSelf = self::where("user", $sUser)->first()?->path;
|
||||||
|
|
||||||
return $oSelf;
|
return $oSelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function _cd($sPath)
|
public static function _cd($sPath, $aUpdate)
|
||||||
{
|
{
|
||||||
|
$sUser = $aUpdate["message"]["from"]["first_name"];
|
||||||
DB::table('book_hook')->truncate();
|
self::where("user", $sUser)->delete();
|
||||||
|
|
||||||
$oBookHook = new self();
|
$oBookHook = new self();
|
||||||
$oBookHook->path = $sPath;
|
$oBookHook->path = $sPath;
|
||||||
|
$oBookHook->user = $sUser;
|
||||||
$r = $oBookHook->save();
|
$r = $oBookHook->save();
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
|
|||||||
@ -9,5 +9,60 @@ class boxCountry extends Model
|
|||||||
protected $table = 'box_country';
|
protected $table = 'box_country';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
public static function rand($sCase = "a")
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($sCase == "a") {
|
||||||
|
$iCountryLimit = rand(5, 8); // 平均6
|
||||||
|
$iNodeLimit = rand(10, 35); // 平局20多
|
||||||
|
$iSpeedLimit = rand(5, 30);
|
||||||
|
} else if ($sCase == "b") {
|
||||||
|
$iCountryLimit = rand(6, 10);
|
||||||
|
$iNodeCount = rand(12, 35);
|
||||||
|
$iSpeedLimit = rand(5, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
//test
|
||||||
|
// $iCountryLimit = 3;
|
||||||
|
|
||||||
|
$iNodeCount = $iNodeLimit;
|
||||||
|
$iSpeed = $iSpeedLimit;
|
||||||
|
|
||||||
|
$aCountry = self::all()->toArray();
|
||||||
|
|
||||||
|
shuffle($aCountry);
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
$aRandCountry = [];
|
||||||
|
foreach ($aCountry as $aCountryRow) {
|
||||||
|
|
||||||
|
if (in_array($aCountryRow["name"], $aRandCountry)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$aRandCountry[] = $aCountryRow["name"];
|
||||||
|
|
||||||
|
if ($i >= $iCountryLimit) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$aData["country"] = $aRandCountry;
|
||||||
|
$aData["nodeCount"] = $iNodeCount;
|
||||||
|
$aData["speed"] = $iSpeed;
|
||||||
|
$aData["str"] = self::toStr($aData);
|
||||||
|
|
||||||
|
return $aData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toStr($randData)
|
||||||
|
{
|
||||||
|
$str = "本次更新共".$randData["nodeCount"]."个可用节点,最高速度".$randData["speed"]."M/S。覆盖".implode("、", $randData["country"])."等多个区域。";
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,4 +8,17 @@ class DoveSite extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'dove_site';
|
protected $table = 'dove_site';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
public static function _getMap()
|
||||||
|
{
|
||||||
|
$oSelf = self::all();
|
||||||
|
|
||||||
|
$aMap = [];
|
||||||
|
foreach ($oSelf as $oSelfRow) {
|
||||||
|
$aMap[$oSelfRow["code"]] = $oSelfRow["www"].$oSelfRow["api_path"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $aMap;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,16 +4,61 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Ship extends Model
|
class GoodPool extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'ship';
|
protected $table = 'good_pool';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
public static function _find($sCode)
|
// public static function _find($sCode)
|
||||||
|
// {
|
||||||
|
// $oSelf = self::where("code", $sCode)->first();
|
||||||
|
//
|
||||||
|
// return $oSelf;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static function _all()
|
||||||
{
|
{
|
||||||
$oSelf = self::where("code", $sCode)->first();
|
$oSelf = self::all();
|
||||||
|
|
||||||
|
// $oNew;
|
||||||
|
foreach ($oSelf as &$oSelfRow) {
|
||||||
|
$oSelfRow->good = json_decode($oSelfRow->good);
|
||||||
|
}
|
||||||
|
|
||||||
return $oSelf;
|
return $oSelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function _rand($sClass)
|
||||||
|
{
|
||||||
|
$aGood = self::where("class", $sClass)->get()->toArray();
|
||||||
|
|
||||||
|
$iGoodRandKey = array_rand($aGood);
|
||||||
|
|
||||||
|
$aGoodRand = $aGood[$iGoodRandKey];
|
||||||
|
|
||||||
|
return $aGoodRand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function _goodToGithub($sGood, $bEnter = true)
|
||||||
|
{
|
||||||
|
$aGood = json_decode($sGood);
|
||||||
|
|
||||||
|
$str = "";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($aGood as $sGoodRow) {
|
||||||
|
if ($i !== 0) {
|
||||||
|
$str .= "
|
||||||
|
";
|
||||||
|
if ($bEnter == true) {
|
||||||
|
$str .= "
|
||||||
|
";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$str .= $sGoodRow;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,61 +4,11 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class GoodPool extends Model
|
class Me extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'good_pool';
|
protected $table = 'me';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
// public static function _find($sCode)
|
// public static function
|
||||||
// {
|
|
||||||
// $oSelf = self::where("code", $sCode)->first();
|
|
||||||
//
|
|
||||||
// return $oSelf;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static function _all()
|
|
||||||
{
|
|
||||||
$oSelf = self::all();
|
|
||||||
|
|
||||||
// $oNew;
|
|
||||||
foreach ($oSelf as &$oSelfRow) {
|
|
||||||
$oSelfRow->good = json_decode($oSelfRow->good);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $oSelf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function _rand($sClass)
|
|
||||||
{
|
|
||||||
$aGood = self::where("class", $sClass)->get()->toArray();
|
|
||||||
|
|
||||||
$iGoodRandKey = array_rand($aGood);
|
|
||||||
|
|
||||||
$aGoodRand = $aGood[$iGoodRandKey];
|
|
||||||
|
|
||||||
return $aGoodRand;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function _goodToGithub($sGood, $bEnter = true)
|
|
||||||
{
|
|
||||||
$aGood = json_decode($sGood);
|
|
||||||
|
|
||||||
$str = "";
|
|
||||||
$i = 0;
|
|
||||||
foreach ($aGood as $sGoodRow) {
|
|
||||||
if ($i !== 0) {
|
|
||||||
$str .= "
|
|
||||||
";
|
|
||||||
if ($bEnter == true) {
|
|
||||||
$str .= "
|
|
||||||
";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$str .= $sGoodRow;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,20 +5,41 @@ use App\Models\Blade as ModelBlade;
|
|||||||
|
|
||||||
class Blade extends Base {
|
class Blade extends Base {
|
||||||
|
|
||||||
private function filter($oBlade)
|
private function subStr($string, $length = 50) {
|
||||||
{
|
if (strlen($string) > $length) {
|
||||||
foreach ($oBlade as &$oBladeRow) {
|
return mb_substr($string, 0, $length) . '...'; // 添加省略号
|
||||||
unset($oBladeRow->content);
|
|
||||||
unset($oBladeRow->id);
|
|
||||||
}
|
}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _filter($oBladeRow)
|
||||||
|
{
|
||||||
|
$oBladeRow->content = $this->subStr($oBladeRow->content);
|
||||||
|
unset($oBladeRow->id);
|
||||||
|
|
||||||
|
return $oBladeRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function filter($oBlade, $sMod = "row")
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($sMod == "row") {
|
||||||
|
|
||||||
|
$oBlade = $this->_filter($oBlade);
|
||||||
|
|
||||||
|
} else if ($sMod == "list") {
|
||||||
|
foreach ($oBlade as &$oBladeRow) {
|
||||||
|
$oBladeRow = $this->_filter($oBladeRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return $oBlade;
|
return $oBlade;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function List()
|
public function List()
|
||||||
{
|
{
|
||||||
$oBlade = ModelBlade::all();
|
$oBlade = ModelBlade::all();
|
||||||
$oBlade = $this->filter($oBlade);
|
$oBlade = $this->filter($oBlade, "list");
|
||||||
|
|
||||||
return $this->toJson($oBlade);
|
return $this->toJson($oBlade);
|
||||||
}
|
}
|
||||||
@ -34,6 +55,20 @@ class Blade extends Base {
|
|||||||
|
|
||||||
$oBlade = ModelBlade::where($sField, $sValue)->first();
|
$oBlade = ModelBlade::where($sField, $sValue)->first();
|
||||||
|
|
||||||
|
return $this->toJson($oBlade);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Content($aParam)
|
||||||
|
{
|
||||||
|
$sField = $aParam["aOption"][1] ?? "code";
|
||||||
|
$sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sValue == "?") {
|
||||||
|
return "/blade#content__{field?} {value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oBlade = ModelBlade::where($sField, $sValue)->first();
|
||||||
|
|
||||||
return $oBlade->content;
|
return $oBlade->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,9 +96,112 @@ class Blade extends Base {
|
|||||||
return $this->toJson($oBlade);
|
return $this->toJson($oBlade);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function Add($aParam)
|
||||||
|
{
|
||||||
|
$sCode = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sCode == "?") {
|
||||||
|
return "/blade#add <code>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sCode) {
|
||||||
|
return "需要code";
|
||||||
|
}
|
||||||
|
|
||||||
|
$bExists = ModelBlade::where("code", $sCode)->exists();
|
||||||
|
if ($bExists) {
|
||||||
|
return "code以存在";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oBlade = new ModelBlade();
|
||||||
|
$oBlade->code = $sCode;
|
||||||
|
$oBlade->save();
|
||||||
|
|
||||||
|
$aParam["aOption"][1] = "code";
|
||||||
|
$aParam["aArg"][1] = $sCode;
|
||||||
|
return $this->Find($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
public function Del($aParam)
|
public function Del($aParam)
|
||||||
{
|
{
|
||||||
$sCode = $aParam["aArg"][]
|
$sCode = $aParam["aArg"][1] ?? false;
|
||||||
|
$sWhereField = $aParam["aOption"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sCode == "?") {
|
||||||
|
return "/blade#del__<whereField> <code>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sCode) {
|
||||||
|
return "需要code";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oBlade = ModelBlade::where("code", $sCode);
|
||||||
|
|
||||||
|
if (!$oBlade->exists()) {
|
||||||
|
return "没有这个code";
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = $oBlade->delete();
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Set($aParam)
|
||||||
|
{
|
||||||
|
$sSetValue = $aParam["aArg"] ?? false;
|
||||||
|
$sSetValue = implode(" ", $sSetValue);
|
||||||
|
|
||||||
|
if ($sSetValue == "?") {
|
||||||
|
$tmp = "/blade#set__<whereField>__<WhereValue>__<setField> <setValue>";
|
||||||
|
$tmp .= "\n /blade#set__<code>__<setField> <serValue>";
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 有第三参数说明是findSet模式
|
||||||
|
if (isset($aParam["aOption"][3])) {
|
||||||
|
$sWhereField = $aParam["aOption"][1] ?? false;
|
||||||
|
$sWhereValue = $aParam["aOption"][2] ?? false;
|
||||||
|
$sSetField = $aParam["aOption"][3] ?? false;
|
||||||
|
$sMod = "findSet";
|
||||||
|
} else {
|
||||||
|
$sWhereField = "code";
|
||||||
|
$sWhereValue = $aParam["aOption"][1] ?? false;
|
||||||
|
$sSetField = $aParam["aOption"][2] ?? false;
|
||||||
|
$sMod = "set";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sWhereField) {
|
||||||
|
return "需要whereField";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sWhereValue) {
|
||||||
|
return "需要whereValue";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sSetField) {
|
||||||
|
return "需要setValue";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oBlade = ModelBlade::where($sWhereField, $sWhereValue)->get();
|
||||||
|
|
||||||
|
if ($oBlade->isEmpty()) {
|
||||||
|
return "没找到这个blade";
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach ($oBlade as $oBladeRow) {
|
||||||
|
$oBladeRow->$sSetField = $sSetValue;
|
||||||
|
$oBladeRow->save();
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($i == 1) {
|
||||||
|
$aParam["aOption"][1] = "code";
|
||||||
|
$aParam["aArg"][1] = $oBladeRow->code;
|
||||||
|
return $this->find($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "影响".$i."条数据";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,10 +19,13 @@ class Book extends Base {
|
|||||||
private $aParentType = [];
|
private $aParentType = [];
|
||||||
private $oRag = "";
|
private $oRag = "";
|
||||||
private $aRagOption = "";
|
private $aRagOption = "";
|
||||||
|
private $aUpdate;
|
||||||
|
|
||||||
function __construct()
|
function __construct($aUpdate)
|
||||||
{
|
{
|
||||||
$sPath = ModelBookHook::_first_path();
|
$this->aUpdate = $aUpdate;
|
||||||
|
|
||||||
|
$sPath = ModelBookHook::_first_path($aUpdate);
|
||||||
|
|
||||||
if ($sPath) {
|
if ($sPath) {
|
||||||
$this->sPath = $sPath;
|
$this->sPath = $sPath;
|
||||||
@ -54,7 +57,7 @@ class Book extends Base {
|
|||||||
|
|
||||||
private function _cd($sPath = "/")
|
private function _cd($sPath = "/")
|
||||||
{
|
{
|
||||||
ModelBookHook::_cd($sPath);
|
ModelBookHook::_cd($sPath, $this->aUpdate);
|
||||||
$this->sPath = $sPath;
|
$this->sPath = $sPath;
|
||||||
|
|
||||||
$this->_optionIn();
|
$this->_optionIn();
|
||||||
@ -71,6 +74,13 @@ class Book extends Base {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function userClear()
|
||||||
|
{
|
||||||
|
$r = DB::table('book_hook')->truncate();
|
||||||
|
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
|
||||||
public function path($aParam)
|
public function path($aParam)
|
||||||
{
|
{
|
||||||
$sPath = $aParam["aArg"][1] ?? false;
|
$sPath = $aParam["aArg"][1] ?? false;
|
||||||
|
|||||||
@ -5,31 +5,436 @@ namespace App\Services\TG\Hook\Mod;
|
|||||||
//use App\Models\GoodPool as ModelGoodPool;
|
//use App\Models\GoodPool as ModelGoodPool;
|
||||||
//use App\Services\TomTool\Http;
|
//use App\Services\TomTool\Http;
|
||||||
//use App\Models\BladeJctj as ModelBladeJctj;
|
//use App\Models\BladeJctj as ModelBladeJctj;
|
||||||
|
use App\Models\Me as ModelMe;
|
||||||
|
|
||||||
class Common extends Base {
|
class DDT extends Base {
|
||||||
|
|
||||||
public $oModelSelf;
|
public $oModelSelf;
|
||||||
|
public $sPrimaryKey = "id";
|
||||||
|
public $iStrMaxLen = 50;
|
||||||
|
public $aStrField = [];
|
||||||
|
public $sMe;
|
||||||
|
|
||||||
public function __construct($oModelSelf)
|
public function __construct($oModelSelf)
|
||||||
{
|
{
|
||||||
|
|
||||||
// $this->oModelSelf = $oModelSelf;
|
|
||||||
$this->_setModel($oModelSelf);
|
$this->_setModel($oModelSelf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function _setStrMaxLen($iStrMaxLen)
|
||||||
|
{
|
||||||
|
$this->iStrMaxLen = $iStrMaxLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function _setStrField($aStrField)
|
||||||
|
{
|
||||||
|
$this->aStrField = $aStrField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function _setMe($sMe)
|
||||||
|
{
|
||||||
|
$this->sMe = $sMe;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function filterList($oSelfList)
|
||||||
|
{
|
||||||
|
foreach ($oSelfList as &$oSelfListRow) {
|
||||||
|
$oSelfListRow = $this->filterRow($oSelfListRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $oSelfList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function meToStr_list($oMe)
|
||||||
|
{
|
||||||
|
$str = "";
|
||||||
|
$i = 0;
|
||||||
|
foreach ($oMe as $oMeRow) {
|
||||||
|
if ($i !== 0) {
|
||||||
|
$str .= "\n\n";
|
||||||
|
}
|
||||||
|
$str .= $this->meToStr($oMeRow);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function meToStr($oMe)
|
||||||
|
{
|
||||||
|
$str = $oMe->id.":".$oMe->rag;
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function me()
|
||||||
|
{
|
||||||
|
$oMe = ModelMe::where("class", $this->sMe)->get();
|
||||||
|
|
||||||
|
return $this->meToStr_list($oMe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function meAdd($aParam)
|
||||||
|
{
|
||||||
|
$aRag = $aParam["aArg"] ?? false;
|
||||||
|
$sRag = implode(" ", $aRag);
|
||||||
|
|
||||||
|
if ($sRag == "?") {
|
||||||
|
return "meAdd {value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sRag) {
|
||||||
|
return "需要value";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oMe = new ModelMe();
|
||||||
|
$oMe->class = $this->sMe;
|
||||||
|
$oMe->rag = $sRag;
|
||||||
|
$oMe->save();
|
||||||
|
|
||||||
|
return $this->toJson($oMe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function meLike($aParam)
|
||||||
|
{
|
||||||
|
$sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sValue == "?") {
|
||||||
|
return "meLike {value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sValue) {
|
||||||
|
return "需要value";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oMe = ModelMe::where("rag", "like", "%".$sValue."%")->get();
|
||||||
|
|
||||||
|
return $this->meToStr_list($oMe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function meSet($aParam)
|
||||||
|
{
|
||||||
|
$iId = $aParam["aOption"][1] ?? false;
|
||||||
|
$sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sValue == "?") {
|
||||||
|
return "#meSet__{id} {value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sValue) {
|
||||||
|
return "需要value";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oMe = ModelMe::find($iId);
|
||||||
|
|
||||||
|
if (!$oMe) {
|
||||||
|
return "没找到这个";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oMe->rag = $sValue;
|
||||||
|
$oMe->save();
|
||||||
|
|
||||||
|
return $this->toJson($oMe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function meDelDone($aParam)
|
||||||
|
{
|
||||||
|
$aParam["isDone"] = true;
|
||||||
|
|
||||||
|
return $this->meDel($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function meDel($aParam)
|
||||||
|
{
|
||||||
|
if ($aParam["aArg"][1] == "?") {
|
||||||
|
return "#meDel {id多个}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$aId = $aParam["aArg"] ?? [];
|
||||||
|
$isDone = $aParam["isDone"] ?? false;
|
||||||
|
|
||||||
|
if (!$aId) {
|
||||||
|
return "需要id";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oMe = ModelMe::whereIn("id", $aId)->get();
|
||||||
|
|
||||||
|
if ($oMe->isEmpty()) {
|
||||||
|
return "没找到这个";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isDone === false) {
|
||||||
|
|
||||||
|
$sMsg = "删除这几个,确认用meDelDone。\n\n";
|
||||||
|
|
||||||
|
$sMe = $this->meToStr_list($oMe);
|
||||||
|
|
||||||
|
return $sMsg.$sMe;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isDone === true) {
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach ($oMe as $oMeRow) {
|
||||||
|
$r = $oMeRow->delete();
|
||||||
|
$i = $i+$r;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "删除".$i."条数据";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function filterRow($oSelfRow)
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach ($this->aStrField as $v) {
|
||||||
|
$oSelfRow->{$v} = $this->subStr($oSelfRow->{$v});
|
||||||
|
}
|
||||||
|
|
||||||
|
return $oSelfRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function subStr($input) {
|
||||||
|
|
||||||
|
if (mb_strlen($input, 'UTF-8') > $this->iStrMaxLen) {
|
||||||
|
|
||||||
|
return mb_substr($input, 0, $this->iStrMaxLen, 'UTF-8')."……";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
|
||||||
public function _setModel($oModelSelf)
|
public function _setModel($oModelSelf)
|
||||||
{
|
{
|
||||||
$this->oModelSelf = $oModelSelf;
|
$this->oModelSelf = $oModelSelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function _setPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->sPrimaryKey = $key;
|
||||||
|
}
|
||||||
|
|
||||||
public function list()
|
public function list()
|
||||||
{
|
{
|
||||||
// $oJctj = ModelBladeJctj::all();
|
|
||||||
|
|
||||||
$oSelf = $this->oModelSelf->all();
|
$oSelf = $this->oModelSelf->all();
|
||||||
|
|
||||||
tomd($oSelf, 1);
|
$oSelf = $this->filterList($oSelf);
|
||||||
|
|
||||||
|
return $this->toJson($oSelf);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add($aParam)
|
||||||
|
{
|
||||||
|
$sField = $aParam["aOption"][1] ?? false;
|
||||||
|
$sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sValue == "?") {
|
||||||
|
|
||||||
|
return "#add__{field} {value}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sValue) {
|
||||||
|
return "需要value";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sField) {
|
||||||
|
return "需要field";
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->oModelSelf->$sField = $sValue;
|
||||||
|
|
||||||
|
$this->oModelSelf->save();
|
||||||
|
|
||||||
|
$aParam["aOption"][1] = "id";
|
||||||
|
$aParam["aArg"][1] = $this->oModelSelf->id;
|
||||||
|
|
||||||
|
return $this->find($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function like($aParam)
|
||||||
|
{
|
||||||
|
|
||||||
|
$aParam["is_like"] = true;
|
||||||
|
|
||||||
|
return $this->find($aParam);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function find($aParam)
|
||||||
|
{
|
||||||
|
$sField = $aParam["aOption"][1] ?? $this->sPrimaryKey;
|
||||||
|
$sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
$isLike = $aParam["is_like"] ?? false;
|
||||||
|
$sHitField = $aParam["sHitField"] ?? false;
|
||||||
|
|
||||||
|
if ($sValue == "?") {
|
||||||
|
return "#find__{field?primaryKey} {value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sValue) {
|
||||||
|
return "需要value";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sField) {
|
||||||
|
return "需要field";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isLike === true) {
|
||||||
|
$oSelf = $this->oModelSelf->where($sField, "like", "%".$sValue."%")->get();
|
||||||
|
} else {
|
||||||
|
$oSelf = $this->oModelSelf->where($sField, $sValue)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($oSelf->isEmpty()) {
|
||||||
|
return "没找到这个";
|
||||||
|
}
|
||||||
|
|
||||||
|
// hit必然单体
|
||||||
|
if ($sHitField) {
|
||||||
|
return $oSelf[0]->$sHitField;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->toJson($this->filterList($oSelf));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set($aParam)
|
||||||
|
{
|
||||||
|
$sSetValue = $aParam["aArg"] ?? false;
|
||||||
|
$sSetValue = implode(" ", $sSetValue);
|
||||||
|
|
||||||
|
if ($sSetValue == "?") {
|
||||||
|
$tmp = "#set__{whereField}__{WhereValue}__{setField} {setValue}";
|
||||||
|
$tmp .= "\n\n";
|
||||||
|
$tmp .= "#set__{primaryValue主键值,默认id}__{setField} {serValue}";
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 有第三参数说明是findSet模式
|
||||||
|
if (isset($aParam["aOption"][3])) {
|
||||||
|
$sWhereField = $aParam["aOption"][1] ?? false;
|
||||||
|
$sWhereValue = $aParam["aOption"][2] ?? false;
|
||||||
|
$sSetField = $aParam["aOption"][3] ?? false;
|
||||||
|
$sMod = "findSet";
|
||||||
|
} else {
|
||||||
|
$sWhereField = $this->sPrimaryKey;
|
||||||
|
$sWhereValue = $aParam["aOption"][1] ?? false;
|
||||||
|
$sSetField = $aParam["aOption"][2] ?? false;
|
||||||
|
$sMod = "set";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sWhereField) {
|
||||||
|
return "需要whereField";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sWhereValue) {
|
||||||
|
return "需要whereValue";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sSetField) {
|
||||||
|
return "需要setValue";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oSelf = $this->oModelSelf->where($sWhereField, $sWhereValue)->get();
|
||||||
|
|
||||||
|
if ($oSelf->isEmpty()) {
|
||||||
|
return "没找到这个";
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach ($oSelf as $oSelfRow) {
|
||||||
|
$oSelfRow->$sSetField = $sSetValue;
|
||||||
|
$oSelfRow->save();
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($i == 1) {
|
||||||
|
$aParam["aOption"][1] = $this->sPrimaryKey;
|
||||||
|
$aParam["aArg"][1] = $oSelfRow->{$this->sPrimaryKey};
|
||||||
|
return $this->find($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "影响".$i."条数据";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delDone($aParam)
|
||||||
|
{
|
||||||
|
$aParam["is_done"] = true;
|
||||||
|
|
||||||
|
return $this->del($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function del($aParam)
|
||||||
|
{
|
||||||
|
$sField = $aParam["aOption"][1] ?? $this->sPrimaryKey;
|
||||||
|
$sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
$bIsDone = $aParam["is_done"] ?? false;
|
||||||
|
|
||||||
|
if ($sValue == "?") {
|
||||||
|
return "#del__{field?默认primaryKey} {value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oSelf = $this->oModelSelf->where($sField, $sValue)->get();
|
||||||
|
|
||||||
|
if ($oSelf->isEmpty()) {
|
||||||
|
return "没找到这个";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sMsg = "匹配以下数据,确认删除使用delDone()。\n\n";
|
||||||
|
$sStr = $this->toJson($oSelf);
|
||||||
|
|
||||||
|
return $sMsg.$sStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hit($aParam)
|
||||||
|
{
|
||||||
|
$sHitField = $aParam["aOption"][1] ?? false;
|
||||||
|
$sWhereField = $aParam["aOption"][2] ?? $this->sPrimaryKey;
|
||||||
|
$sWhereValue = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sWhereValue == "?") {
|
||||||
|
return "#hit__{hitField}__{whereField?primaryKey} {whereValue}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sWhereValue) {
|
||||||
|
return "需要value";
|
||||||
|
}
|
||||||
|
|
||||||
|
$aParam["sHitField"] = $sHitField;
|
||||||
|
$aParam["aOption"][1] = $sWhereField;
|
||||||
|
|
||||||
|
return $this->find($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function content($aParam)
|
||||||
|
{
|
||||||
|
$sWhereField = $aParam["aOption"][1] ?? $this->sPrimaryKey;
|
||||||
|
$sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sValue == "?") {
|
||||||
|
return "#content__{whereField?primaryKey} {whereValue}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sValue) {
|
||||||
|
return "需要value";
|
||||||
|
}
|
||||||
|
|
||||||
|
$aParam["aOption"][1] = "content";
|
||||||
|
$aParam["aOption"][2] = $sWhereField;
|
||||||
|
|
||||||
|
return $this->hit($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function table()
|
||||||
|
{
|
||||||
|
$sTable = $this->oModelSelf->getTable();
|
||||||
|
// tomd($sTable, 1);
|
||||||
|
// $columns = \DB::select("SHOW FULL COLUMNS FROM blade");
|
||||||
|
$columns = \DB::select("SHOW CREATE TABLE `{$sTable}`");
|
||||||
|
tomd($columns[0]->{"Create Table"}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,6 +106,50 @@ class Dove extends Base {
|
|||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function class($aParam)
|
||||||
|
{
|
||||||
|
$sClass = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sClass == "?") {
|
||||||
|
return "/dove#class <class>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sClass) {
|
||||||
|
return "需要class";
|
||||||
|
}
|
||||||
|
|
||||||
|
$aParam["aOption"][1] = "class";
|
||||||
|
$aParam["aArg"][1] = $sClass;
|
||||||
|
|
||||||
|
return $this->where($aParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function where($aParam)
|
||||||
|
{
|
||||||
|
$sField = $aParam["aOption"][1] ?? false;
|
||||||
|
$sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($sValue == "?") {
|
||||||
|
return "/dove#where__<firld> <value>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sField) {
|
||||||
|
return "需要field";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sValue) {
|
||||||
|
return "需要value";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oDoveSite = ModelDoveSite::where($sField, $sValue)->get();
|
||||||
|
|
||||||
|
if ($oDove->isEmpty()) {
|
||||||
|
return "没找到这个";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->toJson($oDoveSite);
|
||||||
|
}
|
||||||
|
|
||||||
public function check($aParam)
|
public function check($aParam)
|
||||||
{
|
{
|
||||||
$iSetValue = $aParam['iSetValue'] ?? 1;
|
$iSetValue = $aParam['iSetValue'] ?? 1;
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class DoveSite extends Base {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function option($aParam)
|
public function Set($aParam)
|
||||||
{
|
{
|
||||||
$sCode = $aParam['aOption'][1];
|
$sCode = $aParam['aOption'][1];
|
||||||
$sField = $aParam['aOption'][2];
|
$sField = $aParam['aOption'][2];
|
||||||
@ -64,4 +64,6 @@ class DoveSite extends Base {
|
|||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,70 +2,92 @@
|
|||||||
|
|
||||||
namespace App\Services\TG\Hook\Mod;
|
namespace App\Services\TG\Hook\Mod;
|
||||||
|
|
||||||
use App\Models\Ship as ModelShip;
|
use App\Models\GoodPool as ModelGoodPool;
|
||||||
//use App\Services\TomTool\Http;
|
//use App\Services\TomTool\Http;
|
||||||
|
|
||||||
class Ship extends Base {
|
class Good extends Base {
|
||||||
|
|
||||||
public function List()
|
public function List()
|
||||||
{
|
{
|
||||||
|
$oGood = ModelGoodPool::_all();
|
||||||
|
|
||||||
$oShip = ModelShip::all();
|
return $this->toJson($oGood);
|
||||||
|
|
||||||
foreach ($oShip as $oShipRow) {
|
|
||||||
$oShipRow->good = json_decode($oShipRow->good, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->toJson($oShip);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Find($aParam)
|
|
||||||
{
|
|
||||||
|
|
||||||
$sCode = $aParam["aArg"][1] ?? false;
|
|
||||||
|
|
||||||
if (!$sCode) {
|
|
||||||
return "需要code";
|
|
||||||
}
|
|
||||||
|
|
||||||
$oShip = ModelShip::_find($sCode);
|
|
||||||
|
|
||||||
if (!$oShip) {
|
|
||||||
return "没找到这个";
|
|
||||||
}
|
|
||||||
|
|
||||||
$oShip->good = json_decode($oShip->good);
|
|
||||||
|
|
||||||
return $this->toJson($oShip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Add($aParam)
|
public function Add($aParam)
|
||||||
{
|
{
|
||||||
$sCode = $aParam["aArg"][1] ?? false;
|
if ($aParam["aArg"][1] == "?") {
|
||||||
|
return "/good#add {class}";
|
||||||
if (!$sCode) {
|
|
||||||
return "需要code";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$oShip = new ModelShip();
|
$sClass = $aParam["aArg"][1] ?? false;
|
||||||
$oShip->code = $sCode;
|
|
||||||
$oShip->save();
|
|
||||||
|
|
||||||
return $this->toJson($oShip);
|
$oGood = new ModelGoodPool();
|
||||||
|
$oGood->class = $sClass;
|
||||||
|
$oGood->good = json_encode(["test", "test"]);
|
||||||
|
$oGood->save();
|
||||||
|
|
||||||
|
return $this->_find($oGood->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Set($aParam)
|
public function Find($aParam)
|
||||||
{
|
{
|
||||||
$sCode = $aParam["aOption"][1] ?? false;
|
if ($aParam["aArg"][1] == "?") {
|
||||||
$sField = $aParam["aOption"][2] ?? false;
|
return "/good#find__{field?} {id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$iId = $aParam["aArg"][1] ?? false;
|
||||||
|
$sField = $aParam["aOption"][1] ?? false;
|
||||||
|
|
||||||
|
return $this->_find($iId, $sField);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _find($iId, $sField = false)
|
||||||
|
{
|
||||||
|
$oGood = ModelGoodPool::find($iId);
|
||||||
|
|
||||||
|
$oGood->good = json_decode($oGood->good, true);
|
||||||
|
|
||||||
|
if (!$oGood) {
|
||||||
|
return "这个id的没有";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sField) {
|
||||||
|
return $this->toJson($oGood->$sField);
|
||||||
|
} else {
|
||||||
|
return $this->toJson($oGood);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function FindSet($aParam)
|
||||||
|
// {
|
||||||
|
// $iId = $aParam["aOption"][1] ?? false;
|
||||||
|
// $sField = $aParam["aOption"][2] ?? false;
|
||||||
// $sValue = $aParam["aArg"][1] ?? false;
|
// $sValue = $aParam["aArg"][1] ?? false;
|
||||||
$aValue = $aParam["aArg"] ?? false;
|
// $sFieldWhere = $aParam["sFieldWhere"] ?? "id";
|
||||||
|
//
|
||||||
|
// if ($sValue == "?") {
|
||||||
|
// return "/good#set__{id}__{field} {value}";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// $aParam["sFieldWhere"] =
|
||||||
|
// }
|
||||||
|
|
||||||
$sValue = implode(" ", $aValue);
|
public function Set($aParam, $aUpdate)
|
||||||
|
{
|
||||||
|
$iId = $aParam["aOption"][1] ?? false;
|
||||||
|
$sField = $aParam["aOption"][2] ?? false;
|
||||||
|
$sValue = $aParam["aArg"] ?? false;
|
||||||
|
$sFieldWhere = $aParam["sFieldWhere"] ?? "id";
|
||||||
|
$sValue = implode(" ", $sValue);
|
||||||
|
|
||||||
if (!$sCode) {
|
if ($sValue == "?") {
|
||||||
return "需要code";
|
return "/good#set__{id}__{field} {value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$iId) {
|
||||||
|
return "需要id";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$sField) {
|
if (!$sField) {
|
||||||
@ -76,33 +98,42 @@ class Ship extends Base {
|
|||||||
return "需要value";
|
return "需要value";
|
||||||
}
|
}
|
||||||
|
|
||||||
$oShip = ModelShip::_find($sCode);
|
$oGood = ModelGoodPool::where($sFieldWhere, $iId)->get();
|
||||||
|
|
||||||
if (!$oShip) {
|
if ($oGood->isEmpty()) {
|
||||||
return "没找到";
|
return "没有找到";
|
||||||
}
|
}
|
||||||
|
|
||||||
$oShip->$sField = $sValue;
|
$i = 0;
|
||||||
$oShip->save();
|
foreach ($oGood as $oGoodRow) {
|
||||||
|
$oGoodRow->$sField = $sValue;
|
||||||
|
$oGoodRow->save();
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
// return $this->toJson($oShip);
|
if ($i > 1) {
|
||||||
|
return "影响".$i."条数据";
|
||||||
|
} else {
|
||||||
|
return $this->_find($oGoodRow->id);
|
||||||
|
}
|
||||||
|
|
||||||
$aParam["aArg"][1] = $oShip->code;
|
}
|
||||||
|
|
||||||
return $this->Find($aParam);
|
public function Del($aParam)
|
||||||
|
{
|
||||||
|
$iId = $aParam["aArg"][1] ?? false;
|
||||||
|
|
||||||
|
if ($iId == "?") {
|
||||||
|
return "/good#del {id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$iId) {
|
||||||
|
return "需要id";
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = ModelGoodPool::where("id", $iId)->delete();
|
||||||
|
|
||||||
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//[
|
|
||||||
// "* 好好 - 就是好",
|
|
||||||
// "* 不好不好 - 就是不好"
|
|
||||||
//]
|
|
||||||
|
|
||||||
//[
|
|
||||||
// "* 好好 - 就是好",
|
|
||||||
// "* 不好不好 - 就是不好",
|
|
||||||
// "* 你就是个瘠薄 - 知道不",
|
|
||||||
// "* 去死吧 - 去死"
|
|
||||||
//]
|
|
||||||
|
|||||||
@ -2,15 +2,29 @@
|
|||||||
|
|
||||||
namespace App\Services\TG\Hook\Mod;
|
namespace App\Services\TG\Hook\Mod;
|
||||||
|
|
||||||
//use App\Models\GoodPool as ModelGoodPool;
|
use App\Models\BladeJctj as ModelBladeJctj;
|
||||||
//use App\Services\TomTool\Http;
|
use App\Services\TG\Hook\Mod\DDT;
|
||||||
use App\Services\BladeJctj as ModelBladeJctj;
|
|
||||||
|
|
||||||
class Jctj extends Base {
|
class Jctj extends Base {
|
||||||
|
|
||||||
public function list()
|
private $oDDT;
|
||||||
|
|
||||||
|
public function __construct($aUpdate)
|
||||||
{
|
{
|
||||||
$j
|
|
||||||
|
$this->oDDT = new DDT(new ModelBladeJctj());
|
||||||
|
$this->oDDT->_setPrimaryKey("id"); // 可选,默认id
|
||||||
|
$this->oDDT->_setStrField(["content"]); // 可选,指定长文本字段
|
||||||
|
$this->oDDT->_setMe("jctj"); // 必须,me用,正常就是类名,只不过后期没准改名,所以就这里写死
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __call($sName, $aArg)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->oDDT->$sName($aArg[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Services\TG\Hook\Mod;
|
namespace App\Services\TG\Hook\Mod;
|
||||||
|
|
||||||
use App\Models\BladeJctj as ModelBladeJctj;
|
use App\Models\BladeJctjOption as ModelBladeJctjOption;
|
||||||
use App\Services\TG\Hook\Mod\DDT;
|
use App\Services\TG\Hook\Mod\DDT;
|
||||||
|
|
||||||
|
class JctjOption extends Base {
|
||||||
class Jctj extends Base {
|
|
||||||
|
|
||||||
private $oDDT;
|
private $oDDT;
|
||||||
private $aUpdate;
|
private $aUpdate;
|
||||||
@ -15,9 +14,9 @@ class Jctj extends Base {
|
|||||||
{
|
{
|
||||||
|
|
||||||
$this->aUpdate = $aUpdate;
|
$this->aUpdate = $aUpdate;
|
||||||
$this->oDDT = new DDT(new ModelBladeJctj());
|
$this->oDDT = new DDT(new ModelBladeJctjOption());
|
||||||
$this->oDDT->_setPrimaryKey("id");
|
$this->oDDT->_setPrimaryKey("k");
|
||||||
$this->oDDT->_setStrField(["content"]);
|
// $this->oDDT->_setStrField(["content"]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,10 @@ class Ship extends Base {
|
|||||||
|
|
||||||
$oShip = ModelShip::all();
|
$oShip = ModelShip::all();
|
||||||
|
|
||||||
|
foreach ($oShip as $oShipRow) {
|
||||||
|
$oShipRow->good = json_decode($oShipRow->good, true);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->toJson($oShip);
|
return $this->toJson($oShip);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -27,6 +31,12 @@ class Ship extends Base {
|
|||||||
|
|
||||||
$oShip = ModelShip::_find($sCode);
|
$oShip = ModelShip::_find($sCode);
|
||||||
|
|
||||||
|
if (!$oShip) {
|
||||||
|
return "没找到这个";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oShip->good = json_decode($oShip->good);
|
||||||
|
|
||||||
return $this->toJson($oShip);
|
return $this->toJson($oShip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +59,10 @@ class Ship extends Base {
|
|||||||
{
|
{
|
||||||
$sCode = $aParam["aOption"][1] ?? false;
|
$sCode = $aParam["aOption"][1] ?? false;
|
||||||
$sField = $aParam["aOption"][2] ?? false;
|
$sField = $aParam["aOption"][2] ?? false;
|
||||||
$sValue = $aParam["aArg"][1] ?? false;
|
// $sValue = $aParam["aArg"][1] ?? false;
|
||||||
|
$aValue = $aParam["aArg"] ?? false;
|
||||||
|
|
||||||
|
$sValue = implode(" ", $aValue);
|
||||||
|
|
||||||
if (!$sCode) {
|
if (!$sCode) {
|
||||||
return "需要code";
|
return "需要code";
|
||||||
@ -72,7 +85,24 @@ class Ship extends Base {
|
|||||||
$oShip->$sField = $sValue;
|
$oShip->$sField = $sValue;
|
||||||
$oShip->save();
|
$oShip->save();
|
||||||
|
|
||||||
return $this->toJson($oShip);
|
// return $this->toJson($oShip);
|
||||||
|
|
||||||
|
$aParam["aArg"][1] = $oShip->code;
|
||||||
|
|
||||||
|
return $this->Find($aParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//[
|
||||||
|
// "* 好好 - 就是好",
|
||||||
|
// "* 不好不好 - 就是不好"
|
||||||
|
//]
|
||||||
|
|
||||||
|
//[
|
||||||
|
// "* 好好 - 就是好",
|
||||||
|
// "* 不好不好 - 就是不好",
|
||||||
|
// "* 你就是个瘠薄 - 知道不",
|
||||||
|
// "* 去死吧 - 去死"
|
||||||
|
//]
|
||||||
|
|||||||
@ -14,30 +14,67 @@ class Http {
|
|||||||
$this->sApiChatId = env('telegram_chatid');
|
$this->sApiChatId = env('telegram_chatid');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendToTG($sMsg)
|
// 原来的命名不合理,包装一下
|
||||||
|
public function send($sMsg, $aUpdate = []) {
|
||||||
|
|
||||||
|
return $this->sendToTG($sMsg, $aUpdate = []);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendToTG($sMsg, $aUpdate = [])
|
||||||
{
|
{
|
||||||
|
|
||||||
if (env('is_loc') == true) {
|
if (isset($aUpdate["shell"]) && $aUpdate["shell"] == "cmd") {
|
||||||
echo "<pre>";
|
|
||||||
echo($sMsg);
|
|
||||||
} else {
|
|
||||||
// $url = "https://api.telegram.org/bot$this->sApiToken/sendMessage?chat_id=$this->sApiChatId&text=" . urlencode($sMsg);
|
|
||||||
// file_get_contents($url);
|
|
||||||
|
|
||||||
$oHttp = new TomHttp();
|
echo $sMsg;
|
||||||
$oHttp->sMethod = "post";
|
|
||||||
$oHttp->sToUrl = "https://api.telegram.org/bot$this->sApiToken/sendMessage";
|
} else if (isset($aUpdate["is_dove"]) && $aUpdate["is_dove"] == true) {
|
||||||
// $oHttp->bIsJson = true;
|
|
||||||
$oHttp->aData = [
|
echo $sMsg;
|
||||||
"chat_id" => $this->sApiChatId,
|
|
||||||
"text" => $sMsg
|
} else {
|
||||||
];
|
|
||||||
$r = $oHttp->send();
|
if (env("is_loc") == true) {
|
||||||
//
|
echo $sMsg;
|
||||||
tomd($r);
|
} else {
|
||||||
|
$oHttp = new TomHttp();
|
||||||
|
$oHttp->sMethod = "post";
|
||||||
|
$oHttp->sToUrl = "https://api.telegram.org/bot$this->sApiToken/sendMessage";
|
||||||
|
// $oHttp->bIsJson = true;
|
||||||
|
$oHttp->aData = [
|
||||||
|
"chat_id" => $this->sApiChatId,
|
||||||
|
"text" => $sMsg
|
||||||
|
];
|
||||||
|
|
||||||
|
$oHttp->send();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if (isset($aUpdate["shell"]) && $aUpdate["shell"] == "cmd") {
|
||||||
|
//
|
||||||
|
// echo $sMsg;;
|
||||||
|
// exit;
|
||||||
|
// } else if (env('is_loc') == true) {
|
||||||
|
// echo "<pre>";
|
||||||
|
// echo($sMsg);
|
||||||
|
// } else {
|
||||||
|
// $oHttp = new TomHttp();
|
||||||
|
// $oHttp->sMethod = "post";
|
||||||
|
// $oHttp->sToUrl = "https://api.telegram.org/bot$this->sApiToken/sendMessage";
|
||||||
|
//// $oHttp->bIsJson = true;
|
||||||
|
// $oHttp->aData = [
|
||||||
|
// "chat_id" => $this->sApiChatId,
|
||||||
|
// "text" => $sMsg
|
||||||
|
// ];
|
||||||
|
// $r = $oHttp->send();
|
||||||
|
////
|
||||||
|
// tomd($r);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||||||
]);
|
]);
|
||||||
$middleware->validateCsrfTokens(except: [
|
$middleware->validateCsrfTokens(except: [
|
||||||
'api/*',
|
'api/*',
|
||||||
|
'cmd/*',
|
||||||
]);
|
]);
|
||||||
})
|
})
|
||||||
->withExceptions(function (Exceptions $exceptions) {
|
->withExceptions(function (Exceptions $exceptions) {
|
||||||
|
|||||||
2
public/js/jquery.min.js
vendored
2
public/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
public/upload/clash.xcf
Normal file
BIN
public/upload/clash.xcf
Normal file
Binary file not shown.
BIN
public/upload/qweqwe.png
Normal file
BIN
public/upload/qweqwe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
public/upload/qweqwe.xcf
Normal file
BIN
public/upload/qweqwe.xcf
Normal file
Binary file not shown.
BIN
public/upload/xcvxcv.png
Normal file
BIN
public/upload/xcvxcv.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
BIN
public/upload/xcvxcv.xcf
Normal file
BIN
public/upload/xcvxcv.xcf
Normal file
Binary file not shown.
BIN
public/upload/无标题.png
Normal file
BIN
public/upload/无标题.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
BIN
public/upload/无标题.xcf
Normal file
BIN
public/upload/无标题.xcf
Normal file
Binary file not shown.
@ -1 +1,376 @@
|
|||||||
sdfsd
|
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<script src="/js/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color:#121212;
|
||||||
|
color:#eee;
|
||||||
|
// font-size:12px;
|
||||||
|
//font-size:30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
font-size:14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_text {
|
||||||
|
width:380px;
|
||||||
|
// font-size:16px;
|
||||||
|
//background-color:#222;
|
||||||
|
// border:1px solid cyan;
|
||||||
|
//color:cyan;
|
||||||
|
//border:none;
|
||||||
|
//border-radius: 4px;
|
||||||
|
//padding: 4px 4px;
|
||||||
|
//outline: none;
|
||||||
|
//box-shadow: none;
|
||||||
|
//height:30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_input
|
||||||
|
{
|
||||||
|
// width:350px;
|
||||||
|
font-size:22px;
|
||||||
|
background-color:#212121;
|
||||||
|
// border:1px solid cyan;
|
||||||
|
//color:Aquamarine;
|
||||||
|
color:Beige;
|
||||||
|
|
||||||
|
border:none;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 4px 6px;
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none;
|
||||||
|
//height:30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_option {
|
||||||
|
width:90px;
|
||||||
|
color:Aquamarine;
|
||||||
|
}
|
||||||
|
.cmd_user
|
||||||
|
{
|
||||||
|
width:100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_hook
|
||||||
|
{
|
||||||
|
width:200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus {
|
||||||
|
outline: none; /* 移除默认轮廓线 */
|
||||||
|
box-shadow: none; /* 移除可能存在的阴影 */
|
||||||
|
// border-color: #ccc; /* 保持与原边框相同颜色 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
width:100%;
|
||||||
|
// height:200px;
|
||||||
|
color:cyan;
|
||||||
|
text-align:center;
|
||||||
|
//margin-top:60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
width:100%;
|
||||||
|
// height:200px;
|
||||||
|
color:pink;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
//.cmd {
|
||||||
|
// margin-top:60px;
|
||||||
|
// vertical-align: top;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.cmd_r {
|
||||||
|
// width:100%;
|
||||||
|
|
||||||
|
//min-width:300px;
|
||||||
|
text-align:left;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.cmd {
|
||||||
|
//margin-top:60px;
|
||||||
|
list-style-type: none;
|
||||||
|
// margin: 0;
|
||||||
|
// padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
// background-color: #333;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd li {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd li a {
|
||||||
|
display: block;
|
||||||
|
// color: white;
|
||||||
|
text-align: center;
|
||||||
|
// padding: 14px 16px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd li a:hover {
|
||||||
|
// background-color: #111;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_table
|
||||||
|
{
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_r_table
|
||||||
|
{
|
||||||
|
min-width:400px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_btn
|
||||||
|
{
|
||||||
|
font-size:12px;
|
||||||
|
padding: 4px 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_btn-back
|
||||||
|
{
|
||||||
|
height:26px;
|
||||||
|
font-size:12px;
|
||||||
|
background-color:#222;
|
||||||
|
border-radius: 20px;
|
||||||
|
border-color:#FFFACD;
|
||||||
|
color:#FFFACD;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_site
|
||||||
|
{
|
||||||
|
width:100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cmd_area
|
||||||
|
{
|
||||||
|
padding: 10px 15px;
|
||||||
|
font-size:14px;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu_top
|
||||||
|
{
|
||||||
|
color: #bbb;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a{
|
||||||
|
color:#ddd;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="top">
|
||||||
|
<div class="menu_top">
|
||||||
|
<a href="/cmd/image/upload">图片上传</a>
|
||||||
|
</div>
|
||||||
|
<table class="cmd_table">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input class="cmd_user cmd_input cmd_enter" id="cmd_user" value="tom">
|
||||||
|
<input class="cmd_site cmd_input cmd_enter" id="cmd_site" value="master">
|
||||||
|
<input class="cmd_hook cmd_input cmd_enter" id="cmd_hook" value="">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input id="cmd_text" class="cmd_text cmd_input cmd_enter">
|
||||||
|
<input id="cmd_option" class="cmd_option cmd_input">
|
||||||
|
<!--
|
||||||
|
<button><i class="fa fa-plus"></i> 添加</button>
|
||||||
|
<input type="button" value="普通按钮">
|
||||||
|
-->
|
||||||
|
</td>
|
||||||
|
<tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<div class="top_row cmd_bar">
|
||||||
|
<input class="cmd_user cmd_input" id="cmd_user">
|
||||||
|
<input class="cmd_hook cmd_input" id="cmd_hook">
|
||||||
|
</div>
|
||||||
|
<ul class="cmd">
|
||||||
|
<li>
|
||||||
|
<select class="cmd_option" id="cmd_option">
|
||||||
|
<option value="master">master</option>
|
||||||
|
<option value="fuc">fuc</option>
|
||||||
|
<option value="cfn">cfn</option>
|
||||||
|
<option value="github">github</option>
|
||||||
|
</select>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<textarea id="cmd_text" class="cmd_text cmd_input"></textarea>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main">
|
||||||
|
<table class="cmd_r_table">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<textarea class="cmd_input cmd_area" id="cmd_area" hidden ></textarea>
|
||||||
|
<div class="cmd_r" id="cmd_r"></div>
|
||||||
|
<div class="cmd_r_shadow" id="cmd_r_shadow" hidden ></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bottom">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$('#cmd_text').focus();
|
||||||
|
|
||||||
|
function toggleArea(type)
|
||||||
|
{
|
||||||
|
if (type == "e") {
|
||||||
|
$("#cmd_r").hide();
|
||||||
|
$("#cmd_area").show();
|
||||||
|
|
||||||
|
$("#cmd_area").width("500px");
|
||||||
|
$("#cmd_area").height("700px");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == "ee") {
|
||||||
|
$("#cmd_r").hide();
|
||||||
|
$("#cmd_area").show();
|
||||||
|
|
||||||
|
$("#cmd_area").width("1000px");
|
||||||
|
$("#cmd_area").height("1200px");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == "eee") {
|
||||||
|
$("#cmd_r").hide();
|
||||||
|
$("#cmd_area").show();
|
||||||
|
|
||||||
|
$("#cmd_area").width("1400px");
|
||||||
|
$("#cmd_area").height("2000px");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == "i") {
|
||||||
|
$("#cmd_area").hide();
|
||||||
|
$("#cmd_r").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit(enterType)
|
||||||
|
{
|
||||||
|
var value = $("#cmd_text").val();
|
||||||
|
var site = $("#cmd_site").val();
|
||||||
|
var hook = $("#cmd_hook").val();
|
||||||
|
var area = $("#cmd_area").val();
|
||||||
|
var user = $("#cmd_user").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/cmd/send",
|
||||||
|
// dataType: "json",
|
||||||
|
data: {
|
||||||
|
site: site,
|
||||||
|
hook: hook,
|
||||||
|
value: value,
|
||||||
|
area: area,
|
||||||
|
user: user,
|
||||||
|
enterType: enterType
|
||||||
|
},
|
||||||
|
success: function(response){
|
||||||
|
|
||||||
|
$("#cmd_r").html("");
|
||||||
|
$("#cmd_area").val("");
|
||||||
|
|
||||||
|
$("#cmd_r_shadow").html(response);
|
||||||
|
$("#cmd_r").html("<pre>"+response+"</pre>");
|
||||||
|
$("#cmd_area").val(response);
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error){
|
||||||
|
// console.error("提交失败:", error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).keydown(function(event) {
|
||||||
|
|
||||||
|
if (event.shiftKey && event.metaKey && event.key === 'k') {
|
||||||
|
|
||||||
|
if ($("#cmd_option").val() == "" || $("#cmd_option").val() == "i") {
|
||||||
|
$("#cmd_option").val("e");
|
||||||
|
} else if ($("#cmd_option").val() == "e") {
|
||||||
|
$("#cmd_option").val("i");
|
||||||
|
}
|
||||||
|
//else if ($("#cmd_option").val() == "ee") {
|
||||||
|
// $("#cmd_option").val("i");
|
||||||
|
//}
|
||||||
|
|
||||||
|
toggleArea($("#cmd_option").val());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.shiftKey && event.metaKey && event.key === 'Enter') {
|
||||||
|
|
||||||
|
submit("input");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$("#cmd_option").keypress(function(e){
|
||||||
|
if (e.which == 13) {
|
||||||
|
var value = $(this).val();
|
||||||
|
toggleArea(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$("#cmd_area").keydown(function(event){
|
||||||
|
if (event.metaKey && event.key === 'Enter') {
|
||||||
|
submit("area");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.cmd_enter').keypress(function(e){
|
||||||
|
|
||||||
|
if(e.which == 13){ // 检测回车键
|
||||||
|
toggleArea($("#cmd_option").val());
|
||||||
|
submit("input");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
sdfsd
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<form action="upload.php" method="post" enctype="multipart/form-data">
|
<form action="/cmd/image/upload/exec" method="post" enctype="multipart/form-data">
|
||||||
<label for="file">选择图片:</label>
|
<label for="files">选择图片:</label>
|
||||||
<input type="file" name="file" id="file" accept="image/*" required>
|
<input type="file" name="files[]" id="files" accept="image/*" multiple required>
|
||||||
<input type="submit" value="上传">
|
<input type="submit" value="上传">
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -9,15 +9,25 @@ use App\Http\Controllers\HelperController;
|
|||||||
use App\Http\Controllers\HtmlController;
|
use App\Http\Controllers\HtmlController;
|
||||||
use App\Http\Controllers\SakaiController;
|
use App\Http\Controllers\SakaiController;
|
||||||
use App\Http\Controllers\CronController;
|
use App\Http\Controllers\CronController;
|
||||||
|
use App\Http\Controllers\CmdController;
|
||||||
use App\Http\Controllers\Api\ShipController;
|
use App\Http\Controllers\Api\ShipController;
|
||||||
//use App\Http\Controllers\Api\GithubController;
|
//use App\Http\Controllers\Api\GithubController;
|
||||||
use App\Http\Controllers\Api\TG\HookController;
|
use App\Http\Controllers\Api\TG\HookController;
|
||||||
use App\Http\Controllers\Api\CountryController;
|
use App\Http\Controllers\Api\CountryController;
|
||||||
|
use App\Http\Controllers\Api\GoodController;
|
||||||
|
use App\Http\Controllers\Api\GithubController;
|
||||||
|
|
||||||
//Route::get('/', [ArticleListController::class, 'fn'])->middleware('test');
|
//Route::get('/', [ArticleListController::class, 'fn'])->middleware('test');
|
||||||
|
|
||||||
Route::get('/api/freenode/country/rand/{case?}', [CountryController::class, 'rand']);
|
Route::get('/cmd', [CmdController::class, 'index']);
|
||||||
|
Route::post('/cmd/send', [CmdController::class, 'ajaxSend']);
|
||||||
|
Route::get('/cmd/image/upload', [CmdController::class, 'imageUpload']);
|
||||||
|
Route::post('/cmd/image/upload/exec', [CmdController::class, 'imageUploadExec']);
|
||||||
|
|
||||||
|
|
||||||
|
Route::post('/api/github/get', [GithubController::class, 'get']);
|
||||||
|
Route::get('/api/good/rand/{class}', [GoodController::class, 'rand']);
|
||||||
|
Route::get('/api/freenode/country/rand/{case?}', [CountryController::class, 'rand']);
|
||||||
Route::get('/api/ship/get/{shipCode}/{clientClass}/{clientCode?}', [ShipController::class, 'getShipByCode']);
|
Route::get('/api/ship/get/{shipCode}/{clientClass}/{clientCode?}', [ShipController::class, 'getShipByCode']);
|
||||||
|
|
||||||
Route::get('/cron', [CronController::class, 'index']);
|
Route::get('/cron', [CronController::class, 'index']);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user