122 lines
3.4 KiB
PHP
Executable File
122 lines
3.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers\Article;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Models\ArticleList;
|
|
use App\Models\Option;
|
|
use App\Models\Jichang;
|
|
use App\Services\Time;
|
|
use App\Services\Tag;
|
|
use voku\helper\AntiXSS;
|
|
use App\Services\TomTool\Http;
|
|
|
|
class SingleController extends Controller
|
|
{
|
|
|
|
protected $sType = '';
|
|
protected $sCode = '';
|
|
protected $aData = [];
|
|
protected $sViewPath = 'article/single';
|
|
|
|
public function __construct()
|
|
{
|
|
|
|
$this->oAntiXss = new AntiXSS();
|
|
|
|
}
|
|
|
|
protected function view()
|
|
{
|
|
|
|
$this->aData['sType'] = $this->sType;
|
|
|
|
$this->aData['aTagNames'] = Tag::strToNames($this->aData['tags']);
|
|
|
|
return view($this->sViewPath, [
|
|
"aData" => $this->aData,
|
|
"sMenu" => $this->aData['sMenu'],
|
|
]);
|
|
}
|
|
|
|
public function client ($iCode)
|
|
{
|
|
|
|
$this->code = $this->oAntiXss->xss_clean($iCode);
|
|
|
|
$this->aData = ArticleList::where("code", "=", $iCode)->first()->toArray();
|
|
|
|
$this->sType = 'client';
|
|
|
|
$this->aData['sTypeName'] = '客户端';
|
|
|
|
$this->aData['pathBase'] = '/client/';
|
|
|
|
$this->aData['urlParent'] = '/client';
|
|
|
|
$this->aData['sMenu'] = 'client';
|
|
|
|
$this->aData['pageTitle'] = $this->aData["title"];
|
|
|
|
$this->aData['pageKw'] = "Clash,Quantumult,Shadowrocket,SSR,v2ray,免费节点,节点,订阅链接";
|
|
|
|
return $this->view();
|
|
}
|
|
|
|
public function freenode ($iCode)
|
|
{
|
|
|
|
$this->code = $this->oAntiXss->xss_clean($iCode);
|
|
|
|
$this->aData = ArticleList::where("code", "=", $iCode)->first()->toArray();
|
|
|
|
$this->sType = 'freenode';
|
|
|
|
$this->aData['sTypeName'] = '免费节点';
|
|
|
|
$this->aData['pathBase'] = '/fn/';
|
|
|
|
$this->aData['urlParent'] = '/';
|
|
|
|
$this->aData['sMenu'] = 'freenode';
|
|
|
|
$this->aData['pageTitle'] = '「'.$this->aData['date_str'].'」'.$this->aData["title"];
|
|
|
|
$this->aData['pageKw'] = "Clash,Quantumult,Shadowrocket,SSR,v2ray,免费节点,节点,订阅链接";
|
|
|
|
// $this->aData['v2rayPath'] = env('APP_URL')."/feed/v2ray-".$iCode.".txt";
|
|
//
|
|
// $this->aData['clashPath'] = env('APP_URL')."/feed/clash-".$iCode.".yaml";
|
|
|
|
$aOption = Option::_all();
|
|
$aOptionFreenodeClient = explode(",", $aOption["freenode_client"]);
|
|
|
|
foreach ($aOptionFreenodeClient as $sFnClient) {
|
|
|
|
$sEnding = ".txt";
|
|
if ($sFnClient == "v2ray") {
|
|
$sEnding = ".txt";
|
|
} else if ($sFnClient == "clash") {
|
|
$sEnding = ".yaml";
|
|
}
|
|
|
|
$this->aData["fnFilePath"][$sFnClient] = env('APP_URL')."/sub/".$iCode."-".$sFnClient.".".$sEnding;
|
|
|
|
}
|
|
|
|
$this->aData['jichang'] = Jichang::first()->toArray();
|
|
|
|
$oHttp = new Http();
|
|
$oHttp->sToUrl = $this->aData['jichang']['url']."/api/huodong/datehit";
|
|
// $oHttp->sToUrl = env("url_jichang_base")."/api/huodong/datehit/2025-01-01";
|
|
$sHuodong = $oHttp->send();
|
|
$aHuodong = json_decode($sHuodong, 1);
|
|
$this->aData['aHuodong'] = $aHuodong;
|
|
|
|
$this->sViewPath = 'freenode/single';
|
|
|
|
return $this->view();
|
|
}
|
|
|
|
}
|