diff --git a/app/Http/Controllers/Api/CountryController.php b/app/Http/Controllers/Api/CountryController.php
index fe55ab71..c9f1ad3b 100755
--- a/app/Http/Controllers/Api/CountryController.php
+++ b/app/Http/Controllers/Api/CountryController.php
@@ -59,4 +59,11 @@ final class CountryController
exit;
}
+ public function toGithub($randData)
+ {
+ $str = date('Y年m月d日').",本次更新共".$randData["nodeCount"]."个可用节点,最高速度".$randData["speed"]."M/S。覆盖".implode("、", $randData["country"])."等多个区域。";
+
+ return $str;
+ }
+
}
diff --git a/app/Http/Controllers/Api/GithubController.php b/app/Http/Controllers/Api/GithubController.php
index c499c79b..717184cf 100755
--- a/app/Http/Controllers/Api/GithubController.php
+++ b/app/Http/Controllers/Api/GithubController.php
@@ -4,19 +4,45 @@ namespace App\Http\Controllers\Api;
//use App\Models\Book as ModelBook;
//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\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
{
- private function echo($zz){
- return $zz;
- }
+ public $aArticle = [];
- 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)
@@ -43,6 +69,241 @@ class GithubController
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');
+ }
+
+ }
}
diff --git a/app/Http/Controllers/Api/GoodController.php b/app/Http/Controllers/Api/GoodController.php
index 61783c40..15b6a73c 100755
--- a/app/Http/Controllers/Api/GoodController.php
+++ b/app/Http/Controllers/Api/GoodController.php
@@ -10,11 +10,18 @@ use App\Models\GoodPool as ModelGoodPool;
class GoodController
{
-// public function rand($sClass)
-// {
-// $oGood = ModelGoodPool::_all();
-//
-// tomd($oGood, 1);
-// }
+ public function rand($sClass)
+ {
+ $aGood = ModelGoodPool::where("class", $sClass)->get()->toArray();
+
+ $iGoodRandKey = array_rand($aGood);
+
+ $aGoodRand = $aGood[$iGoodRandKey];
+
+ $sGoodRandJson = json_encode($aGoodRand);
+
+ echo $sGoodRandJson;
+ exit;
+ }
}
diff --git a/app/Http/Controllers/Api/TG/HookController.php b/app/Http/Controllers/Api/TG/HookController.php
index ab5685b9..b15cb546 100755
--- a/app/Http/Controllers/Api/TG/HookController.php
+++ b/app/Http/Controllers/Api/TG/HookController.php
@@ -87,34 +87,37 @@ final class HookController
$sClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sClass;
$sUClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sUClass;
+ $oInstans = new $sClassPath($aUpdate);
+ $r = $oInstans->$sFunc($aParams);
+
// 兼容大小写,自己挖的坑
- if (method_exists($sClassPath, $sFunc)) {
- $oInstans = new $sClassPath();
- $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();
+// if (method_exists($sClassPath, $sFunc)) {
+// $oInstans = new $sClassPath($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 (is_array($r)) {
foreach ($r as $row) {
- $oTGHttp->sendToTG($row);
+ $oTGHttp->sendToTG($row, $aUpdate);
}
} else {
- $oTGHttp->sendToTG($r);
+ $oTGHttp->sendToTG($r, $aUpdate);
}
- Http::response(200, 'ok');
+ Http::response(200);
} else {
throw new \Exception("?!?!?!?!");
}
@@ -122,7 +125,7 @@ final class HookController
} catch (\Throwable $e) {
$sMessage = "错误(文件: " . $e->getFile() . ",行: " . $e->getLine() . "): " . $e->getMessage();
- $oTGHttp->sendToTG($sMessage);
+ $oTGHttp->sendToTG($sMessage, $aUpdate);
Http::response(200, 'error');
}
diff --git a/app/Http/Controllers/CmdController.php b/app/Http/Controllers/CmdController.php
index 0c7f8314..0306a459 100755
--- a/app/Http/Controllers/CmdController.php
+++ b/app/Http/Controllers/CmdController.php
@@ -2,79 +2,189 @@
namespace App\Http\Controllers;
-//use Illuminate\Http\Request;
-//use App\Models\ArticleList;
-//use App\Services\Time;
-//use voku\helper\AntiXSS;
-//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;
+//use App\Models\Book as ModelBook;
+//use App\Models\BookOption as ModelBookOption;
+use App\Services\TomTool\Http;
+use App\Models\DoveSite as ModelDoveSite;
-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()
{
- $h = date("H");
- $i = date("i");
- $s = date("s");
- //// test
- $k = $_GET["k"] ?? false;
- $v = $_GET["v"] ?? false;
-
- if ($k == "h") {
- $h = $v;
- } else if ($k == "i") {
- $i = $v;
- } else if ($k == "k") {
- $s = $v;
- }
-
-// $h = "00";
- //// test end
-
- if ($h == "00" && $i== "00") {
-
- $iFireWarningLine = ModelBookOption::_hit("fire_warning_line");
-
- $sDateWarningLine = date("Y-m-d H:i:s", strtotime($iFireWarningLine."day"));
- $oBook = ModelBook::whereDate("fire", "<=", $sDateWarningLine)->where("fire_close", 0)->get();
-
- if (!$oBook->isEmpty()) {
+ return view("cmd", [
+// "aSinge" => $aSinge,
+// 'aTagNames' => $aTagsName,
+// 'sMenu' => 'client',
+ ]);
+ }
+
+ public function imageUploadExec()
+ {
+ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ // 检查文件是否上传成功
+ if (isset($_FILES['files']) && $_FILES['files']['error'][0] == 0) {
+ $uploadFileDir = './upload/';
- $oDateNow = new \DateTime();
-
- foreach ($oBook as $oBookRow) {
-
- $oDateRag = new \DateTime($oBookRow->fire);
-
- $iDiffDay = $oDateNow->diff($oDateRag)->days;
-
- if ($oDateNow > $oDateRag) {
- $iDiffDay = -$iDiffDay;
+ foreach ($_FILES['files']['tmp_name'] as $key => $tmpName) {
+ $fileName = $_FILES['files']['name'][$key];
+ $fileError = $_FILES['files']['error'][$key];
+
+ // 检查文件上传是否有错误
+ if ($fileError == 0) {
+ $dest_path = $uploadFileDir . $fileName;
+
+ // 移动文件到目标目录
+ if (move_uploaded_file($tmpName, $dest_path)) {
+ echo '文件上传成功: ' . $dest_path . '
';
+ } else {
+ echo '文件上传失败: ' . $fileName . '
';
+ }
+ } else {
+ echo '文件上传错误: ' . $fileName . '
';
}
-
- $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 "
";
+//// 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 "";
+// echo($r);
+ echo $r;
+
+ exit;
+ }
}
diff --git a/app/Http/Controllers/GoodController.php b/app/Http/Controllers/GoodController.php
deleted file mode 100755
index d783a64e..00000000
--- a/app/Http/Controllers/GoodController.php
+++ /dev/null
@@ -1,18 +0,0 @@
-";
+ $a = "哈哈哈哈";
+ $a = "z";
+
+
+ $str = "asdfasdfasdfasdfas
+
+dfasdfa
+{$this->xx($a)}
+sdsdfasdf";
+
+
+// file_put_contents('output.txt', $str);
+ echo $str;
+// echo 123123;
+ }
+
function __construct()
{
// $sPath = ModelBookHook::_first_path();
@@ -372,6 +404,8 @@ class SakaiController
$s = "/box#country_test";
+// $s = "";
+
// $s = "toWait 333333";
// $s = "no 2";
//
diff --git a/app/Models/Blade.php b/app/Models/Blade.php
index 862ec097..db8a2664 100755
--- a/app/Models/Blade.php
+++ b/app/Models/Blade.php
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
class Blade extends Model
{
protected $table = 'blade';
+ public $timestamps = false;
public static function _listKey()
{
diff --git a/app/Models/BladeJctj.php b/app/Models/BladeJctj.php
index 759d5eb0..65d2e520 100755
--- a/app/Models/BladeJctj.php
+++ b/app/Models/BladeJctj.php
@@ -4,9 +4,9 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
-class Jctj extends Model
+class BladeJctj extends Model
{
- protected $table = 'jctj';
+ protected $table = 'blade_jctj';
public $timestamps = false;
// public static function _listKey()
diff --git a/app/Models/BladeJctjOption.php b/app/Models/BladeJctjOption.php
index 65d2e520..9e3a603f 100755
--- a/app/Models/BladeJctjOption.php
+++ b/app/Models/BladeJctjOption.php
@@ -4,11 +4,18 @@ namespace App\Models;
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 static function _hit($k)
+ {
+ $v = self::where("k", $k)->first()?->v;
+
+ return $v;
+ }
+
// public static function _listKey()
// {
// $aSelf = self::all()->toArray();
diff --git a/app/Models/BookHook.php b/app/Models/BookHook.php
index 080027d1..d124967e 100755
--- a/app/Models/BookHook.php
+++ b/app/Models/BookHook.php
@@ -10,36 +10,23 @@ class BookHook extends Model
protected $table = 'book_hook';
public $timestamps = false;
-// public static function _first($sType)
-// {
-// $oData = first();
-//
-// return $oData;
-// }
-//
-// public static function _first_key($sType)
-// {
-// $sKey = self::where("type", $sType)->first()?->key;
-//
-// return $sKey;
-// }
-
-
-
- public static function _first_path()
+ public static function _first_path($aUpdate)
{
- $oSelf = self::first()?->path;
+ $sUser = $aUpdate["message"]["from"]["first_name"];
+
+ $oSelf = self::where("user", $sUser)->first()?->path;
return $oSelf;
}
- public static function _cd($sPath)
+ public static function _cd($sPath, $aUpdate)
{
-
- DB::table('book_hook')->truncate();
+ $sUser = $aUpdate["message"]["from"]["first_name"];
+ self::where("user", $sUser)->delete();
$oBookHook = new self();
$oBookHook->path = $sPath;
+ $oBookHook->user = $sUser;
$r = $oBookHook->save();
return $r;
diff --git a/app/Models/BoxCountry.php b/app/Models/BoxCountry.php
index 032f1b05..8b0f32f2 100755
--- a/app/Models/BoxCountry.php
+++ b/app/Models/BoxCountry.php
@@ -9,5 +9,60 @@ class boxCountry extends Model
protected $table = 'box_country';
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;
+ }
}
diff --git a/app/Models/DoveSite.php b/app/Models/DoveSite.php
index cde60620..33897f83 100755
--- a/app/Models/DoveSite.php
+++ b/app/Models/DoveSite.php
@@ -8,4 +8,17 @@ class DoveSite extends Model
{
protected $table = 'dove_site';
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;
+ }
+
}
diff --git a/app/Models/GoodPool.php b/app/Models/GoodPool.php
index 278f9f2c..269d17f0 100755
--- a/app/Models/GoodPool.php
+++ b/app/Models/GoodPool.php
@@ -4,16 +4,61 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
-class Ship extends Model
+class GoodPool extends Model
{
- protected $table = 'ship';
+ protected $table = 'good_pool';
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;
}
+ 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;
+ }
+
}
diff --git a/app/Models/Me.php b/app/Models/Me.php
index 269d17f0..07d1e3cd 100755
--- a/app/Models/Me.php
+++ b/app/Models/Me.php
@@ -4,61 +4,11 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
-class GoodPool extends Model
+class Me extends Model
{
- protected $table = 'good_pool';
+ protected $table = 'me';
public $timestamps = false;
-// public static function _find($sCode)
-// {
-// $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;
- }
+// public static function
}
diff --git a/app/Services/TG/Hook/Mod/Blade.php b/app/Services/TG/Hook/Mod/Blade.php
index 04791e80..bd310b09 100644
--- a/app/Services/TG/Hook/Mod/Blade.php
+++ b/app/Services/TG/Hook/Mod/Blade.php
@@ -5,20 +5,41 @@ use App\Models\Blade as ModelBlade;
class Blade extends Base {
- private function filter($oBlade)
- {
- foreach ($oBlade as &$oBladeRow) {
- unset($oBladeRow->content);
- unset($oBladeRow->id);
+ private function subStr($string, $length = 50) {
+ if (strlen($string) > $length) {
+ return mb_substr($string, 0, $length) . '...'; // 添加省略号
}
+ 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;
}
public function List()
{
$oBlade = ModelBlade::all();
- $oBlade = $this->filter($oBlade);
+ $oBlade = $this->filter($oBlade, "list");
return $this->toJson($oBlade);
}
@@ -34,6 +55,20 @@ class Blade extends Base {
$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;
}
@@ -61,9 +96,112 @@ class Blade extends Base {
return $this->toJson($oBlade);
}
+ public function Add($aParam)
+ {
+ $sCode = $aParam["aArg"][1] ?? false;
+
+ if ($sCode == "?") {
+ return "/blade#add ";
+ }
+
+ 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)
{
- $sCode = $aParam["aArg"][]
+ $sCode = $aParam["aArg"][1] ?? false;
+ $sWhereField = $aParam["aOption"][1] ?? false;
+
+ if ($sCode == "?") {
+ return "/blade#del__ ";
+ }
+
+ 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______ ";
+ $tmp .= "\n /blade#set____ ";
+ 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."条数据";
}
}
diff --git a/app/Services/TG/Hook/Mod/Book.php b/app/Services/TG/Hook/Mod/Book.php
index 40262038..832b2128 100644
--- a/app/Services/TG/Hook/Mod/Book.php
+++ b/app/Services/TG/Hook/Mod/Book.php
@@ -19,10 +19,13 @@ class Book extends Base {
private $aParentType = [];
private $oRag = "";
private $aRagOption = "";
+ private $aUpdate;
- function __construct()
+ function __construct($aUpdate)
{
- $sPath = ModelBookHook::_first_path();
+ $this->aUpdate = $aUpdate;
+
+ $sPath = ModelBookHook::_first_path($aUpdate);
if ($sPath) {
$this->sPath = $sPath;
@@ -54,7 +57,7 @@ class Book extends Base {
private function _cd($sPath = "/")
{
- ModelBookHook::_cd($sPath);
+ ModelBookHook::_cd($sPath, $this->aUpdate);
$this->sPath = $sPath;
$this->_optionIn();
@@ -71,6 +74,13 @@ class Book extends Base {
return true;
}
+ public function userClear()
+ {
+ $r = DB::table('book_hook')->truncate();
+
+ return "ok";
+ }
+
public function path($aParam)
{
$sPath = $aParam["aArg"][1] ?? false;
diff --git a/app/Services/TG/Hook/Mod/DDT.php b/app/Services/TG/Hook/Mod/DDT.php
index caf2ecf6..6dcccd97 100644
--- a/app/Services/TG/Hook/Mod/DDT.php
+++ b/app/Services/TG/Hook/Mod/DDT.php
@@ -5,31 +5,436 @@ namespace App\Services\TG\Hook\Mod;
//use App\Models\GoodPool as ModelGoodPool;
//use App\Services\TomTool\Http;
//use App\Models\BladeJctj as ModelBladeJctj;
+use App\Models\Me as ModelMe;
-class Common extends Base {
+class DDT extends Base {
public $oModelSelf;
+ public $sPrimaryKey = "id";
+ public $iStrMaxLen = 50;
+ public $aStrField = [];
+ public $sMe;
public function __construct($oModelSelf)
{
-// $this->oModelSelf = $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)
{
$this->oModelSelf = $oModelSelf;
}
+
+ public function _setPrimaryKey($key)
+ {
+ $this->sPrimaryKey = $key;
+ }
public function list()
{
-// $oJctj = ModelBladeJctj::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);
}
}
diff --git a/app/Services/TG/Hook/Mod/Dove.php b/app/Services/TG/Hook/Mod/Dove.php
index 7c012c4c..8d92cff5 100644
--- a/app/Services/TG/Hook/Mod/Dove.php
+++ b/app/Services/TG/Hook/Mod/Dove.php
@@ -106,6 +106,50 @@ class Dove extends Base {
return $r;
}
+ public function class($aParam)
+ {
+ $sClass = $aParam["aArg"][1] ?? false;
+
+ if ($sClass == "?") {
+ return "/dove#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__ ";
+ }
+
+ 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)
{
$iSetValue = $aParam['iSetValue'] ?? 1;
diff --git a/app/Services/TG/Hook/Mod/DoveSite.php b/app/Services/TG/Hook/Mod/DoveSite.php
index 27dcd98a..40b01897 100644
--- a/app/Services/TG/Hook/Mod/DoveSite.php
+++ b/app/Services/TG/Hook/Mod/DoveSite.php
@@ -46,7 +46,7 @@ class DoveSite extends Base {
}
- public function option($aParam)
+ public function Set($aParam)
{
$sCode = $aParam['aOption'][1];
$sField = $aParam['aOption'][2];
@@ -64,4 +64,6 @@ class DoveSite extends Base {
return $r;
}
+
+
}
diff --git a/app/Services/TG/Hook/Mod/Good.php b/app/Services/TG/Hook/Mod/Good.php
index 63029f74..94b4bc95 100644
--- a/app/Services/TG/Hook/Mod/Good.php
+++ b/app/Services/TG/Hook/Mod/Good.php
@@ -2,70 +2,92 @@
namespace App\Services\TG\Hook\Mod;
-use App\Models\Ship as ModelShip;
+use App\Models\GoodPool as ModelGoodPool;
//use App\Services\TomTool\Http;
-class Ship extends Base {
+class Good extends Base {
public function List()
{
+ $oGood = ModelGoodPool::_all();
- $oShip = ModelShip::all();
-
- 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);
+ return $this->toJson($oGood);
}
public function Add($aParam)
{
- $sCode = $aParam["aArg"][1] ?? false;
-
- if (!$sCode) {
- return "需要code";
+ if ($aParam["aArg"][1] == "?") {
+ return "/good#add {class}";
}
- $oShip = new ModelShip();
- $oShip->code = $sCode;
- $oShip->save();
+ $sClass = $aParam["aArg"][1] ?? false;
- 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;
- $sField = $aParam["aOption"][2] ?? false;
+ if ($aParam["aArg"][1] == "?") {
+ 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;
- $aValue = $aParam["aArg"] ?? false;
+// $sFieldWhere = $aParam["sFieldWhere"] ?? "id";
+//
+// if ($sValue == "?") {
+// return "/good#set__{id}__{field} {value}";
+// }
+//
+//
+// $aParam["sFieldWhere"] =
+// }
+
+ 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);
- $sValue = implode(" ", $aValue);
+ if ($sValue == "?") {
+ return "/good#set__{id}__{field} {value}";
+ }
- if (!$sCode) {
- return "需要code";
+ if (!$iId) {
+ return "需要id";
}
if (!$sField) {
@@ -76,33 +98,42 @@ class Ship extends Base {
return "需要value";
}
- $oShip = ModelShip::_find($sCode);
-
- if (!$oShip) {
- return "没找到";
+ $oGood = ModelGoodPool::where($sFieldWhere, $iId)->get();
+
+ if ($oGood->isEmpty()) {
+ return "没有找到";
}
- $oShip->$sField = $sValue;
- $oShip->save();
+ $i = 0;
+ 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;
+ }
+
+ public function Del($aParam)
+ {
+ $iId = $aParam["aArg"][1] ?? false;
- return $this->Find($aParam);
+ if ($iId == "?") {
+ return "/good#del {id}";
+ }
+
+ if (!$iId) {
+ return "需要id";
+ }
+
+ $r = ModelGoodPool::where("id", $iId)->delete();
+
+ return $r;
}
}
-
-
-//[
-// "* 好好 - 就是好",
-// "* 不好不好 - 就是不好"
-//]
-
-//[
-// "* 好好 - 就是好",
-// "* 不好不好 - 就是不好",
-// "* 你就是个瘠薄 - 知道不",
-// "* 去死吧 - 去死"
-//]
diff --git a/app/Services/TG/Hook/Mod/Jctj.php b/app/Services/TG/Hook/Mod/Jctj.php
index 9cbd62d7..5beb1394 100644
--- a/app/Services/TG/Hook/Mod/Jctj.php
+++ b/app/Services/TG/Hook/Mod/Jctj.php
@@ -2,15 +2,29 @@
namespace App\Services\TG\Hook\Mod;
-//use App\Models\GoodPool as ModelGoodPool;
-//use App\Services\TomTool\Http;
-use App\Services\BladeJctj as ModelBladeJctj;
+use App\Models\BladeJctj as ModelBladeJctj;
+use App\Services\TG\Hook\Mod\DDT;
+
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]);
+
}
}
diff --git a/app/Services/TG/Hook/Mod/JctjOption.php b/app/Services/TG/Hook/Mod/JctjOption.php
index cce8172c..61b83005 100644
--- a/app/Services/TG/Hook/Mod/JctjOption.php
+++ b/app/Services/TG/Hook/Mod/JctjOption.php
@@ -2,11 +2,10 @@
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;
-
-class Jctj extends Base {
+class JctjOption extends Base {
private $oDDT;
private $aUpdate;
@@ -15,9 +14,9 @@ class Jctj extends Base {
{
$this->aUpdate = $aUpdate;
- $this->oDDT = new DDT(new ModelBladeJctj());
- $this->oDDT->_setPrimaryKey("id");
- $this->oDDT->_setStrField(["content"]);
+ $this->oDDT = new DDT(new ModelBladeJctjOption());
+ $this->oDDT->_setPrimaryKey("k");
+// $this->oDDT->_setStrField(["content"]);
}
diff --git a/app/Services/TG/Hook/Mod/Ship.php b/app/Services/TG/Hook/Mod/Ship.php
index fb1b91a3..63029f74 100644
--- a/app/Services/TG/Hook/Mod/Ship.php
+++ b/app/Services/TG/Hook/Mod/Ship.php
@@ -12,6 +12,10 @@ class Ship extends Base {
$oShip = ModelShip::all();
+ foreach ($oShip as $oShipRow) {
+ $oShipRow->good = json_decode($oShipRow->good, true);
+ }
+
return $this->toJson($oShip);
}
@@ -27,6 +31,12 @@ class Ship extends Base {
$oShip = ModelShip::_find($sCode);
+ if (!$oShip) {
+ return "没找到这个";
+ }
+
+ $oShip->good = json_decode($oShip->good);
+
return $this->toJson($oShip);
}
@@ -49,7 +59,10 @@ class Ship extends Base {
{
$sCode = $aParam["aOption"][1] ?? 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) {
return "需要code";
@@ -72,7 +85,24 @@ class Ship extends Base {
$oShip->$sField = $sValue;
$oShip->save();
- return $this->toJson($oShip);
+// return $this->toJson($oShip);
+
+ $aParam["aArg"][1] = $oShip->code;
+
+ return $this->Find($aParam);
}
}
+
+
+//[
+// "* 好好 - 就是好",
+// "* 不好不好 - 就是不好"
+//]
+
+//[
+// "* 好好 - 就是好",
+// "* 不好不好 - 就是不好",
+// "* 你就是个瘠薄 - 知道不",
+// "* 去死吧 - 去死"
+//]
diff --git a/app/Services/TG/Http.php b/app/Services/TG/Http.php
index 3da00008..d55eb210 100644
--- a/app/Services/TG/Http.php
+++ b/app/Services/TG/Http.php
@@ -14,30 +14,67 @@ class Http {
$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) {
- echo "";
- echo($sMsg);
- } else {
-// $url = "https://api.telegram.org/bot$this->sApiToken/sendMessage?chat_id=$this->sApiChatId&text=" . urlencode($sMsg);
-// file_get_contents($url);
+ if (isset($aUpdate["shell"]) && $aUpdate["shell"] == "cmd") {
- $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);
+ echo $sMsg;
+
+ } else if (isset($aUpdate["is_dove"]) && $aUpdate["is_dove"] == true) {
+
+ echo $sMsg;
+
+ } else {
+
+ if (env("is_loc") == true) {
+ 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
+ ];
+
+ $oHttp->send();
+ }
}
+
+
+// if (isset($aUpdate["shell"]) && $aUpdate["shell"] == "cmd") {
+//
+// echo $sMsg;;
+// exit;
+// } else if (env('is_loc') == true) {
+// echo "";
+// 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);
+//
+// }
+
}
}
diff --git a/bootstrap/app.php b/bootstrap/app.php
index b4aef471..94cc5421 100755
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -16,6 +16,7 @@ return Application::configure(basePath: dirname(__DIR__))
]);
$middleware->validateCsrfTokens(except: [
'api/*',
+ 'cmd/*',
]);
})
->withExceptions(function (Exceptions $exceptions) {
diff --git a/public/js/jquery.min.js b/public/js/jquery.min.js
index e69de29b..7f37b5d9 100644
--- a/public/js/jquery.min.js
+++ b/public/js/jquery.min.js
@@ -0,0 +1,2 @@
+/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */
+!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+