diff --git a/app/Models/CacheTg.php b/app/Models/CacheTg.php new file mode 100755 index 00000000..b6fb39ae --- /dev/null +++ b/app/Models/CacheTg.php @@ -0,0 +1,24 @@ +toArray(); +// +// foreach ($aSelf as &$aSelfRow) { +// unset($aSelfRow["content"]); +// } +// +// return $aSelf; +// } + + +} diff --git a/app/Models/CacheTgTime.php b/app/Models/CacheTgTime.php new file mode 100755 index 00000000..3e8da5a0 --- /dev/null +++ b/app/Models/CacheTgTime.php @@ -0,0 +1,24 @@ +toArray(); +// +// foreach ($aSelf as &$aSelfRow) { +// unset($aSelfRow["content"]); +// } +// +// return $aSelf; +// } + + +} diff --git a/app/Services/CacheTg.php b/app/Services/CacheTg.php new file mode 100755 index 00000000..db41ffac --- /dev/null +++ b/app/Services/CacheTg.php @@ -0,0 +1,68 @@ +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"] = "本次更新共".$iNodeLimit."个可用节点,"; + + return $aData; +// +// echo json_encode($aData); +// exit; + } + + public function strGithub($randData) + { + $str = date('Y年m月d日').",本次更新共".$randData["nodeCount"]."个可用节点,最高速度".$randData["speed"]."M/S。覆盖".implode("、", $randData["country"])."等多个区域。"; + + return $str; + } + +} diff --git a/app/Services/Tg/Hook/Dog.php b/app/Services/Tg/Hook/Dog.php index a0dd2e5f..9b0b3d5e 100755 --- a/app/Services/Tg/Hook/Dog.php +++ b/app/Services/Tg/Hook/Dog.php @@ -441,6 +441,17 @@ class Dog extends Mod\Base { return $iLimit; } + public function last() + { + $iLastId = $this->oModelSelf->orderBy("id", "desc")->first()?->id; + + $aParam = []; + $aParam["aOption"][1] = "id"; + $aParam["aArg"][1] = $iLastId; + + return $this->find($aParam); + } + public function find($aParam) { $sField = $aParam["aOption"][1] ?? $this->sPrimaryKey; diff --git a/app/Services/Tg/Hook/Mod/ArticleSchema.php b/app/Services/Tg/Hook/Mod/Arma.php similarity index 77% rename from app/Services/Tg/Hook/Mod/ArticleSchema.php rename to app/Services/Tg/Hook/Mod/Arma.php index 4deea9db..4175440d 100755 --- a/app/Services/Tg/Hook/Mod/ArticleSchema.php +++ b/app/Services/Tg/Hook/Mod/Arma.php @@ -11,7 +11,7 @@ use App\Services\Article\Cmd as ServiceArticleCmd; use App\Services\TomTool\Flow; use App\Services\TomTool\ThrowableHandler; -class ArticleSchema extends Base { +class Arsc extends Base { public function __construct($aUpdate) { @@ -26,6 +26,48 @@ class ArticleSchema extends Base { return $this->oDog->$sName($aArg[0]); } + public function tu($aParam) + { + $iId = $aParam["aOption"][1] ?? 0; + $sThumbUse = $aParam["aArg"][1] ?? ""; + + if ($iId == "?") { + return "/thumbUse__[id?last] [a,b,c]"; + } + + if (!$sThumbUse) { + return "空值不可以"; + } + + if (!$iId) { + $iId = ModelArticleSchema::where("status", 1)->orderBy("id", "desc")->first()?->id; + } + + $oArticleSchema = ModelArticleSchema::where("id", $iId)->first(); + + if (!$oArticleSchema) { + return "没有这个id的数据"; + } + + $sOpt = $oArticleSchema->opt; + $aOpt = json_decode($sOpt, true); + + $aThumbUse = explode(",", $sThumbUse); + + $aOpt["thumb_use"] = $aThumbUse; + + $oArticleSchema->opt = $aOpt; + $oArticleSchema->save(); + + $aResult = [ + "id" => $oArticleSchema->id, + "code" => $oArticleSchema->code, + "opt" => $oArticleSchema->opt, + ]; + + return $this->toJson($aResult); + } + public function last() { $iLastId = ModelArticleSchema::where("status", 1)->orderBy("id", "desc")->first()?->id; diff --git a/app/Services/Tg/Hook/Mod/CacheTg.php b/app/Services/Tg/Hook/Mod/CacheTg.php new file mode 100755 index 00000000..7703644d --- /dev/null +++ b/app/Services/Tg/Hook/Mod/CacheTg.php @@ -0,0 +1,177 @@ +oDog = new Dog(new ModelArticleSchema()); + $this->oDog->_setDogName("articleSchema"); + $this->oDog->_setStrField(["content"]); + $this->aUpdate = $aUpdate; + } + + public function __call($sName, $aArg) + { + return $this->oDog->$sName($aArg[0]); + } + + public function test_cron_saveAuto() + { + $r = ServiceArticleSchema::make()->cron_saveAuto(); + + return $r; + } + + public function build_test_ttcp($aParam) + { + $oArticleCodeFirst = ModelArticleSchema::where("status", 1)->orderBy("id", "desc")->first(); + + $aArg["sArticleCode"] = $oArticleCodeFirst->code; + $aArg["sFromCode"] = 'ttcp'; + $aArg["sFromName"] = '天天测评'; + $aArg["sFromUrl"] = 'ttcp.loc'; + $aArg["sFromGroup"] = 'vue_md_ceping'; + + $aParam["aArg"][1] = json_encode($aArg); + $r = $this->build_test($aParam); + } + + public function build_test($aParam) + { + $aJson = $aParam["aArg"]; + $sJson = implode(" ", $aJson); + $aJson = json_decode($sJson, true); + + $sShell = $this->aUpdate["shell"] ?? ''; + + $aJson["isTest"] = true; + + $url = $_ENV["APP_URL"]."/api/article/build"; + + $r = HttpV2::make($url)->enableJsonSend()->setData($aJson)->send(); + + $a = json_decode($r, true); + + if ($sShell !== "cmd") { + $oTelegramVdb = TelegramVdb::make("master"); + foreach ($a["aData"] as $aa) { + $oTelegramVdb->send($aa); + } + } + + echo "标题:".$a["aData"]["title"] ?? "?"; + echo "
"; + echo $a["aData"]["content"] ?? "?"; + exit; + } + + public function build_test_case($aParam) + { + $aArg["sArticleCode"] = 'ffq_tg::20251028113221'; + $aArg["sFromCode"] = 'ttcp'; + $aArg["sFromName"] = '天天测评'; + $aArg["sFromUrl"] = 'ttcp.loc'; + $aArg["sFromGroup"] = 'vue_md_ceping'; + + return $this->toJson($aArg); + } + + public function cmdReset($aParam) + { + $xId = $aParam["aArg"][1] ?? "first"; + + if ($xId == "?") { + return "#cmdRe [xId:first]"; + } + + if ($xId == "first") { + $oModelArticleSchema = ModelArticleSchema::where("status", 1)->orderBy("id", "desc")->first(); + } else { + $oModelArticleSchema = ModelArticleSchema::where("status", 1)->where("id", $xId)->first(); + } + + $oModelArticleSchema->enable_sync = true; + $oModelArticleSchema->save(); + + $bool = ServiceArticleCmd::start($oModelArticleSchema->code)->reset(); + + return $bool; + } + + public function cmdGet($aParam) + { + $xId = $aParam["aArg"][1] ?? "first"; + + if ($xId == "?") { + return "#cmdGet [xId:first]"; + } + + if ($xId == "first") { + $oModelArticleSchema = ModelArticleSchema::where("status", 1)->orderBy("id", "desc")->first(); + } else { + $oModelArticleSchema = ModelArticleSchema::where("status", 1)->where("id", $xId)->first(); + } + + return json_decode($oModelArticleSchema->cmd, true); + } + + public function schemaGet($aParam) + { + $xId = $aParam["aArg"][1] ?? "first"; + + if ($xId == "?") { + return "#schemaGet [xId:first]"; + } + + if ($xId == "first") { + $oModelArticleSchema = ModelArticleSchema::where("status", 1)->orderBy("id", "desc")->first(); + } else { + $oModelArticleSchema = ModelArticleSchema::where("status", 1)->where("id", $xId)->first(); + } + + $aSchema = json_decode($oModelArticleSchema->schema, true); + + $sMsg = json_encode($aSchema, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + + return $sMsg; + } + + public function cacheAdd($aParam) + { + $sFromGroupCode = $aParam["aOption"][1] ?? "ffq_tg_a"; + $sContent = implode(' ', $aParam["aArg"]); + + $r = ServiceArticleCacheTg::start()->add($sFromGroupCode, $sContent); + + return $r; + } + +// public function save($aParam) +// { +// $r = ServiceArticleSchema::make()->save(); +// +// return $r; +// } + +} diff --git a/config/system.php b/config/system.php new file mode 100755 index 00000000..f4672673 --- /dev/null +++ b/config/system.php @@ -0,0 +1,126 @@ + env('APP_NAME', 'Laravel'), + + /* + |-------------------------------------------------------------------------- + | Application Environment + |-------------------------------------------------------------------------- + | + | This value determines the "environment" your application is currently + | running in. This may determine how you prefer to configure various + | services the application utilizes. Set this in your ".env" file. + | + */ + + 'env' => env('APP_ENV', 'production'), + + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ + + 'debug' => (bool) env('APP_DEBUG', false), + + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | the application so that it's available within Artisan commands. + | + */ + + 'url' => env('APP_URL', 'http://localhost'), + + /* + |-------------------------------------------------------------------------- + | Application Timezone + |-------------------------------------------------------------------------- + | + | Here you may specify the default timezone for your application, which + | will be used by the PHP date and date-time functions. The timezone + | is set to "UTC" by default as it is suitable for most use cases. + | + */ + + 'timezone' => env('APP_TIMEZONE', 'UTC'), + + /* + |-------------------------------------------------------------------------- + | Application Locale Configuration + |-------------------------------------------------------------------------- + | + | The application locale determines the default locale that will be used + | by Laravel's translation / localization methods. This option can be + | set to any locale for which you plan to have translation strings. + | + */ + + 'locale' => env('APP_LOCALE', 'en'), + + 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), + + 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), + + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is utilized by Laravel's encryption services and should be set + | to a random, 32 character string to ensure that all encrypted values + | are secure. You should do this prior to deploying the application. + | + */ + + 'cipher' => 'AES-256-CBC', + + 'key' => env('APP_KEY'), + + 'previous_keys' => [ + ...array_filter( + explode(',', env('APP_PREVIOUS_KEYS', '')) + ), + ], + + /* + |-------------------------------------------------------------------------- + | Maintenance Mode Driver + |-------------------------------------------------------------------------- + | + | These configuration options determine the driver used to determine and + | manage Laravel's "maintenance mode" status. The "cache" driver will + | allow maintenance mode to be controlled across multiple machines. + | + | Supported drivers: "file", "cache" + | + */ + + 'maintenance' => [ + 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), + 'store' => env('APP_MAINTENANCE_STORE', 'database'), + ], + +]; diff --git a/public/upload/无标题.png b/public/upload/无标题.png deleted file mode 100755 index 6ea897b9..00000000 Binary files a/public/upload/无标题.png and /dev/null differ