no message
This commit is contained in:
parent
3cf5ad23d1
commit
410c2b344e
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
93
app/Services/TomTool/Http.php
Executable file
93
app/Services/TomTool/Http.php
Executable file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services\TomTool;
|
||||
|
||||
class Http
|
||||
{
|
||||
public $sMethod = 'get';
|
||||
public $aData = [];
|
||||
public $sToUrl; // 必须
|
||||
public $bIsJson = false; // 默认值为 false
|
||||
|
||||
public function send($sUrl = false): string
|
||||
{
|
||||
// 两种传递方式
|
||||
if ($sUrl) {
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,18 @@ use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
function tomd($aData, $iType = 0) {
|
||||
|
||||
if (env("is_loc") == 1) {
|
||||
echo "<pre>";
|
||||
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;
|
||||
|
||||
@ -89,6 +89,12 @@
|
||||
|
||||
<p>购买套餐时输入优惠码【clashfreenode.com】享7折优惠。</p>
|
||||
|
||||
@if ($aData["aHuodong"]["status"] == 1)
|
||||
<p>
|
||||
<span style="background-color:pink; ">{{ $aData["aHuodong"]["data"]["str"] }}</span>
|
||||
</p>
|
||||
@endif
|
||||
|
||||
<p><a target="__blank" href="https://fuuu.cloud" style="color:blue;">点击进入官网:福云</a></p>
|
||||
|
||||
<h2>免费节点订阅链接:</h2>
|
||||
|
||||
@ -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']); // 点赞初始
|
||||
|
||||
Loading…
Reference in New Issue
Block a user