no message
This commit is contained in:
1 parent
2a3b82fa35
commit
bb9e20bd9b
4 files changed
+157
-34
No files matched your search
+98
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\v1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
//use voku\helper\AntiXSS;
|
||||
use App\Models\ArticleList as Article;
|
||||
use App\Http\Services\FreenodeHelperService;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class GithubController
|
||||
{
|
||||
|
||||
public function todayUpd()
|
||||
{
|
||||
|
||||
$sCode = date("Ymd");
|
||||
|
||||
$bUpd = Article::where("code", $sCode)->exists();
|
||||
|
||||
return $bUpd;
|
||||
|
||||
}
|
||||
|
||||
public function getLast()
|
||||
{
|
||||
// $sCode = date("Ymd");
|
||||
|
||||
$aToday = Article::orderBy("id", "desc")->first()->toArray();
|
||||
|
||||
echo json_encode($aToday);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 始终返回数据,今天没有就是前一天,前一天没有就是异常情况
|
||||
public function getFnToday($sDate = false)
|
||||
{
|
||||
$sMasterUrl = "https://".$_ENV["url_master_base"];
|
||||
$sSiteCodeShort = $_ENV["site_code_short"];
|
||||
|
||||
$oResponse = Http::withOptions([
|
||||
'verify' => false, // 禁用 SSL 证书检查
|
||||
])
|
||||
->timeout(8)
|
||||
->get($sMasterUrl."/api/v1/freenode/url_feed_today/".$sSiteCodeShort);
|
||||
|
||||
$aData = [];
|
||||
$rcode = 400;
|
||||
if ($oResponse->successful()) {
|
||||
$aData = $oResponse->json();
|
||||
$rcode = 100;
|
||||
}
|
||||
|
||||
$aData["code"] = $rcode;
|
||||
|
||||
return $aData;
|
||||
|
||||
|
||||
|
||||
// echo 1233;exit;
|
||||
// if (!$sDate) {
|
||||
// $sDate = date("Ymd");
|
||||
// }
|
||||
//
|
||||
// $sCode = $sDate;
|
||||
//
|
||||
// //// test
|
||||
// // 20250721 - 23 有数据
|
||||
//// $sCode = "20250720";
|
||||
//
|
||||
// $bUpd = Article::where("code", $sCode)->exists();
|
||||
//
|
||||
// if ($bUpd === true) {
|
||||
// $sCodeTrue = $sCode;
|
||||
// } else {
|
||||
// $sCodeTrue = date("Ymd", strtotime("-1 day"));
|
||||
// }
|
||||
//
|
||||
// $sFilePathClash = "sub/".$sCodeTrue."-clash.yaml";
|
||||
// $sFilePathV2ray = "sub/".$sCodeTrue."-v2ray.txt";
|
||||
//
|
||||
// $sFileClash = file_get_contents($sFilePathClash);
|
||||
// $sFileV2ray = file_get_contents($sFilePathV2ray);
|
||||
//
|
||||
// $aData = [
|
||||
// "code" => "100",
|
||||
// "clash" => $sFileClash,
|
||||
// "v2ray" => $sFileV2ray
|
||||
// ];
|
||||
//
|
||||
// echo json_encode($aData);
|
||||
//
|
||||
// exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user