diff --git a/app/Http/Controllers/Article/SingleController.php b/app/Http/Controllers/Article/SingleController.php index 8f0c4c7..424b33f 100755 --- a/app/Http/Controllers/Article/SingleController.php +++ b/app/Http/Controllers/Article/SingleController.php @@ -7,6 +7,7 @@ use App\Models\ArticleList; use App\Services\Time; use App\Services\Tag; use voku\helper\AntiXSS; +use App\Services\TomTool\Http; class SingleController extends Controller { @@ -85,6 +86,16 @@ class SingleController extends Controller $this->aData['clashPath'] = env('APP_URL')."/feed/clash-".$iCode.".yaml"; + $oHttp = new Http(); + $oHttp->sToUrl = env("url_jichang_base")."/api/huodong/datehit"; +// $oHttp->sToUrl = env("url_jichang_base")."/api/huodong/datehit/2025-01-01"; + $sHuodong = $oHttp->send(); + $aHuodong = json_decode($sHuodong, 1); + +// if + + $this->aData['aHuodong'] = $aHuodong; + $this->sViewPath = 'freenode/single'; return $this->view(); diff --git a/app/Http/Controllers/ExecController.php b/app/Http/Controllers/ExecController.php index 65eb4dd..ba39694 100755 --- a/app/Http/Controllers/ExecController.php +++ b/app/Http/Controllers/ExecController.php @@ -486,6 +486,38 @@ class ExecController extends Controller dd($sDateCodeStart); } + public function freenodeHtmlSingle($code) + { + + if (!$code) { + echo "not have code"; + exit; + } + + $sFreenodeNewUrl = env("APP_URL")."/fn/single/".$code; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $sFreenodeNewUrl); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + + $sFreeNodeNewView = curl_exec($ch); + curl_close($ch); + + $sFreeNodePath = "fn/".$code.".html"; + $r = file_put_contents($sFreeNodePath, $sFreeNodeNewView); + + if ($r == false) { + echo "false"; + } else { + echo "true"; + } + + exit; + } + + // 节点文章静态化,所有 public function freenodeHtmlAll () { $aFreenodeAll = ArticleList::where("type", "node")->get()->toArray(); diff --git a/app/Services/TomTool/Http.php b/app/Services/TomTool/Http.php new file mode 100755 index 0000000..8cd52a6 --- /dev/null +++ b/app/Services/TomTool/Http.php @@ -0,0 +1,93 @@ +sToUrl = $sUrl; + } + + // 初始化 cURL 会话 + $ch = curl_init(); + + // 设置请求 URL + curl_setopt($ch, CURLOPT_URL, $this->sToUrl); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回响应而不是输出 + + // 根据请求方法设置 cURL 选项 + switch (strtolower($this->sMethod)) { + case 'post': + curl_setopt($ch, CURLOPT_POST, true); // 设置为 POST 请求 + if ($this->bIsJson) { + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($this->aData)); // 设置 POST 数据为 JSON + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json', // 设置内容类型为 JSON + 'Content-Length: ' . strlen(json_encode($this->aData)) // 设置内容长度 + ]); + } else { + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->aData)); // 设置 POST 数据为普通表单格式 + } + break; + + case 'put': + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // 设置为 PUT 请求 + if ($this->bIsJson) { + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($this->aData)); // 设置 PUT 数据为 JSON + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json', // 设置内容类型为 JSON + 'Content-Length: ' . strlen(json_encode($this->aData)) // 设置内容长度 + ]); + } else { + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->aData)); // 设置 PUT 数据为普通表单格式 + } + break; + + case 'get': + // 默认使用 GET 请求 + curl_setopt($ch, CURLOPT_HTTPGET, true); // 设置为 GET 请求 + curl_setopt($ch, CURLOPT_URL, $this->sToUrl . '?' . http_build_query($this->aData)); // 设置请求 URL + if ($this->bIsJson) { + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Accept: application/json' // 设置接受的内容类型为 JSON + ]); + } + break; + } + + // 禁用 SSL 验证 + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 不验证对等证书 + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // 不验证主机名 + + // 执行 cURL 请求 + $response = curl_exec($ch); + + // 检查是否有错误 + if (curl_errno($ch)) { + return 'Error: ' . curl_error($ch); + } + + // 关闭 cURL 会话 + curl_close($ch); + + // 返回响应 + return $response; + } + + public static function response($iCode, $sMsg = '') + { + http_response_code($iCode); + echo $sMsg; + exit; + } +} diff --git a/public/index.php b/public/index.php index 947d989..a56ba59 100755 --- a/public/index.php +++ b/public/index.php @@ -4,6 +4,18 @@ use Illuminate\Http\Request; define('LARAVEL_START', microtime(true)); +function tomd($aData, $iType = 0) { + + if (env("is_loc") == 1) { + echo "
";
+        var_dump($aData);
+        
+        if ($iType == 1) {
+            exit;
+        }
+    }
+}
+
 // Determine if the application is in maintenance mode...
 if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
     require $maintenance;
diff --git a/resources/views/freenode/single.blade.php b/resources/views/freenode/single.blade.php
index 61b7add..42a6932 100755
--- a/resources/views/freenode/single.blade.php
+++ b/resources/views/freenode/single.blade.php
@@ -89,6 +89,12 @@
           
                             

购买套餐时输入优惠码【clashfreenode.com】享7折优惠。

+ @if ($aData["aHuodong"]["status"] == 1) +

+ {{ $aData["aHuodong"]["data"]["str"] }} +

+ @endif +

点击进入官网:福云

免费节点订阅链接:

diff --git a/routes/web.php b/routes/web.php index d9f64da..c9ecf86 100755 --- a/routes/web.php +++ b/routes/web.php @@ -28,6 +28,7 @@ Route::get('/exec/freenode/del', [ExecController::class, 'freenodeDelAuto']); // Route::get('/exec/html/toptags', [ExecController::class, 'tagCountToHtml']); // 热门标签静态生成 Route::get('/exec/html/client', [ExecController::class, 'clientSingleToHtml']); // 客户端文章静态生成 Route::get('/exec/freenode/html/all', [ExecController::class, 'freenodeHtmlAll']); // 所有文章静态生成 +Route::get('/exec/freenode/html/single/{code}', [ExecController::class, 'freenodeHtmlSingle']); // 所有文章静态生成 Route::get('/exec/freenode/data/all', [ExecController::class, 'freenodeDataAll']); // 所有文章数据生成 Route::get('/exec/like/auto', [ExecController::class, 'likeAuto']); // 自动点赞 Route::get('/exec/like/init', [ExecController::class, 'likeInit']); // 点赞初始