no message

This commit is contained in:
hellcat 2025-07-23 17:05:34 +08:00
parent b8b15fee0f
commit 1dc110425d
3 changed files with 52 additions and 8 deletions

View File

@ -27,6 +27,8 @@ class CronController
private $sSendTg = "y";
private $sPull = "y";
public function index()
{
try {
@ -60,10 +62,14 @@ class CronController
$this->sSendTg = $aGet["sSendTg"];
}
if (isset($aGet["sPull"])) {
$this->sPull = $aGet["sPull"];
}
// 暂停
// $option = Option::where("type", "pause")->first();
$option = Option::_hit("pause");
$isPause = $option ? $option->value : null;
$option = Option::_hit("pause") ?? null;
$isPause = isset($option->value) ? $option->value : null;
if ($isPause == 1 && $isTest !== 1) {
exit("暂停");
}
@ -140,6 +146,9 @@ class CronController
$sModType = $row["mod_type"] ?? "v1";
$sMod = $row["mod"];
// $oHttp->aData = $row;
// $sReadMe = $oHttp->send($sMasterUrl);
// 获取文章的方式
if ($sModType == "v1") {
@ -162,6 +171,8 @@ class CronController
mkdir($this->sProjectPath, 0755, true); // 0755 是权限true 表示递归创建目录
mkdir($this->sProjectPath."/feed", 0755, true);
}
// 没有仓库,创建一个
@ -173,6 +184,36 @@ class CronController
}
if ($this->sPull == "n") {
exit("\n 不提交");
}
// 请求cfn更新订阅文件
// 不管是是否真更新cfn那边没更新就返回昨天的文件一样用。
$sFnCode = date("Ymd");
//// test
// 20250721 - 23 有数据
// $sFnCode = 20250721;
//// test end
$oHttp = new Http();
$oHttp->sMethod = "get";
$sMasterUrl = env("api_url_freenode_base")."/api/github/getfntoday/".$sFnCode;
$sReturn = $oHttp->send($sMasterUrl);
$aReturn = json_decode($sReturn, true);
if (!isset($aReturn["code"])) {
exit("异常没有code");
}
if ($aReturn["code"] == "400") { // test
exit("异常400");
}
if ($aReturn["code"] == "100") {
file_put_contents($this->sProjectPath."/feed/clash-".$sFnCode.".yaml", $aReturn["clash"]);
file_put_contents($this->sProjectPath."/feed/v2ray-".$sFnCode.".txt", $aReturn["v2ray"]);
}
// 写入内容
if ($sReadMe) {
file_put_contents($this->sProjectPath."/README.md", $this->formatstr($sReadMe));

View File

@ -11,9 +11,10 @@ class Test extends Base {
$sValue = $aParam["aArg"][1];
// $sIsText = $aParam["aOption"][2] ?? "yes";
$sSendTg = $aParam["aOption"][2] ?? "n";
$sPull = $aParam["aOption"][3] ?? "n";
if ($sValue == "?") {
return "#cron__{type:id,i_in10,rand}__{bSendTg:y,n-default}";
return "#cron__{type:id,i_in10,rand}__{bSendTg:y,n-default}__{bPull:y,n-defulat}";
}
// if ($sSendTg == "yes") {
@ -35,7 +36,8 @@ class Test extends Base {
"is_test" => true,
"time_type" => $sTimeType,
"v" => $sValue,
"sSendTg" => $sSendTg
"sSendTg" => $sSendTg,
"sPull" => $sPull
];
$r = $this->oHttp->send();

View File

@ -59,8 +59,9 @@ www创建
导出的话mysqldump -uroot -p --no-data github > github.sql
nginx配置
/etc/nginx/nginx.conf 用户改为www-data
vim /etc/nginx/nginx.conf 用户改为www-data
添加nginx域名配置.conf后缀别忘了下面有nginx配置复制就行
vim /etc/nginx/conf.d/github-sg01.diaodu.us.conf
systemctl restart nginx
安装证书
@ -70,7 +71,7 @@ nginx配置
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx
测试https://github-x.diaodu.us/test/hello
测试https://github-sg01.diaodu.us/test/hello
去tg上配置他
@ -102,9 +103,9 @@ server {
listen 80;
listen [::]:80;
root /www/wwwroot/github-3.diaodu.us/public;
root /www/wwwroot/github-sg01.diaodu.us/public;
index index.php;
server_name github-3.diaodu.us;
server_name github-sg01.diaodu.us;
location / {
try_files $uri /index.php$is_args$args;