no message
This commit is contained in:
parent
f582a2b716
commit
39600a9dd1
@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
||||
use App\Models\Article;
|
||||
use App\Models\Option;
|
||||
use App\Services\TG\Http as TGHttp;
|
||||
use App\Services\Github\Github as ServiceGithub;
|
||||
|
||||
class CronController
|
||||
{
|
||||
@ -19,15 +20,9 @@ class CronController
|
||||
|
||||
private $aArticle;
|
||||
|
||||
// public function __construct()
|
||||
// {
|
||||
// $this->sProjectPath = env("BASE_DIR")."github/".$this->sUserName."-".$this->sProjectName;
|
||||
// $this->sProjectUrl = env("github_url_base").":".$this->sUserName."/".$this->sProjectName.".git";
|
||||
// }
|
||||
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
// try {
|
||||
|
||||
$h = date("H");
|
||||
$i = date("i");
|
||||
@ -81,14 +76,14 @@ class CronController
|
||||
|
||||
}
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
$sMessage = "错误: " . $e->getMessage();
|
||||
|
||||
$oTGHttp = new TGHttp();
|
||||
$oTGHttp->sendToTG($sMessage);
|
||||
|
||||
}
|
||||
// } catch (\Throwable $e) {
|
||||
//
|
||||
// $sMessage = "错误: " . $e->getMessage();
|
||||
//
|
||||
// $oTGHttp = new TGHttp();
|
||||
// $oTGHttp->sendToTG($sMessage);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -102,17 +97,7 @@ class CronController
|
||||
$this->sProjectUrl = "git@".$this->sMailName.".com:".$this->sUserName."/".$this->sProjectName.".git";
|
||||
$this->aArticle = $row;
|
||||
|
||||
list($sClass, $sFunc) = explode('#', $row['mod']);
|
||||
|
||||
$sClass = "App\\Services\\Github\\Mod\\".$sClass;
|
||||
|
||||
if (method_exists($sClass, $sFunc)) {
|
||||
$oInstans = new $sClass();
|
||||
$sReadMe = $oInstans->$sFunc($row);
|
||||
} else {
|
||||
// 处理方法不存在的情况(可选)
|
||||
// $this->tgMessage("Method $sClass does not exist.");
|
||||
}
|
||||
$sReadMe = ServiceGithub::GetReadMe($row);
|
||||
|
||||
// 没有文件夹,创建一个
|
||||
if (!is_dir($this->sProjectPath)) {
|
||||
|
||||
@ -62,7 +62,7 @@ class TestsController
|
||||
//test
|
||||
// $s = "\/AticleSet__1115zz__sale_rate 1118.118";
|
||||
// $s = "\/git#LastTime 1";
|
||||
$s= "/article#list";
|
||||
$s= "/test#cron__i 07";
|
||||
|
||||
$oHttp = new Http();
|
||||
$oHttp->sMethod = "post";
|
||||
|
||||
57
app/Services/Github/Github.php
Normal file
57
app/Services/Github/Github.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Github;
|
||||
use App\Services\TomTool\Http;
|
||||
|
||||
class Github {
|
||||
|
||||
public static function GetReadMe($aArticle)
|
||||
{
|
||||
list($sClass, $sFunc) = explode('#', $aArticle['mod']);
|
||||
|
||||
$sClass = "App\\Services\\Github\\Mod\\".$sClass;
|
||||
|
||||
if (method_exists($sClass, $sFunc)) {
|
||||
$oInstans = new $sClass();
|
||||
$oInstans->aHuodong = self::GetHuodong($aArticle);
|
||||
$sReadMe = $oInstans->$sFunc($aArticle);
|
||||
return $sReadMe;
|
||||
} else {
|
||||
// 处理方法不存在的情况(可选)
|
||||
// $this->tgMessage("Method $sClass does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function GetHuodong($aArticle)
|
||||
{
|
||||
|
||||
$oHttp = new Http();
|
||||
|
||||
$sDateNow = date("Y-m-d");
|
||||
$sDateNow = "2025-05-03";
|
||||
|
||||
$sHuodongUrl = env('api_url_jichang_base').'/'.'api/huodong/findbydate/'.$sDateNow;
|
||||
$sHuodong = $oHttp->send($sHuodongUrl);
|
||||
$oHuodong = json_decode($sHuodong, 1);
|
||||
|
||||
$sHuodongStr = "购买套餐时输入【".$aArticle['sale_code']."】优惠码,可享".$aArticle['sale_rate']."折优惠,折后低至8元/月。";
|
||||
|
||||
if ($oHuodong) {
|
||||
$sStartDateStr = date("n月j日", strtotime($oHuodong['start_date']));
|
||||
$sEndDateStr = date("n月j日", strtotime($oHuodong['end_date']));
|
||||
|
||||
$sHuodongStr .= "
|
||||
|
||||
🎁 ".$oHuodong['title'].":".$sStartDateStr."至".$sEndDateStr."期间,".$oHuodong['content'];
|
||||
|
||||
}
|
||||
|
||||
$oHuodong['str'] = $sHuodongStr;
|
||||
|
||||
return $oHuodong;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,9 +4,16 @@ use App\Services\TomTool\Http;
|
||||
|
||||
class Base {
|
||||
|
||||
public $oHttp;
|
||||
public $oHuodong;
|
||||
public $sHuodongStr;
|
||||
public $aArticle;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->oHttp = new Http();
|
||||
|
||||
}
|
||||
|
||||
public function todayUpd()
|
||||
@ -15,6 +22,10 @@ class Base {
|
||||
$this->oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/todayupd';
|
||||
$r = $this->oHttp->send();
|
||||
|
||||
if (env('is_loc') == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($r == 1) {
|
||||
return true;
|
||||
} else {
|
||||
@ -23,4 +34,13 @@ class Base {
|
||||
|
||||
}
|
||||
|
||||
public function getArticleFreenode()
|
||||
{
|
||||
$this->oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/getlast';
|
||||
$sFreenodeNow = $this->oHttp->send();
|
||||
$aFreenodeNow = json_decode($sFreenodeNow, 1);
|
||||
// $sTitleSub = $aFreenodeNow['title_sub'];
|
||||
return $aFreenodeNow;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,9 +4,7 @@ use App\Services\TomTool\Http;
|
||||
|
||||
class FreeNode extends Base {
|
||||
|
||||
public $sTitle; // 必须
|
||||
public $sContent; // 必须
|
||||
public $sSubTitle; // 非必须
|
||||
public $aHuodong; // 必须,注入
|
||||
|
||||
public function A($aArticle)
|
||||
{
|
||||
@ -15,16 +13,13 @@ class FreeNode extends Base {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/getlast';
|
||||
$sFreenodeNow = $this->oHttp->send();
|
||||
$aFreenodeNow = json_decode($sFreenodeNow, 1);
|
||||
$sTitleSub = $aFreenodeNow['title_sub'];
|
||||
$aArticleFreenode = $this->getArticleFreenode();
|
||||
|
||||
$sContent = "
|
||||
|
||||
# 「".date("m月d日")."」每日更新免费节点,SSR/V2ray/Clash/Shadowrocket免费节点订阅链接。
|
||||
|
||||
".date("Y年m月d日").$sTitleSub."
|
||||
".date("Y年m月d日").$aArticleFreenode['title_sub']."
|
||||
|
||||
## 性价比机场推荐:[福云](https://fuuu.cloud)
|
||||
|
||||
@ -34,7 +29,9 @@ $sContent = "
|
||||
|
||||
* 稳定 - 稳定运营二年多,海外团队。
|
||||
|
||||
购买套餐时输入【".$aArticle['sale_code']."】享".$aArticle['sale_rate']."折优惠,点击进入[福云机场官网](https://fuuu.cloud)。
|
||||
".$this->aHuodong['str']."
|
||||
|
||||
点击进入[福云机场官网](https://fuuu.cloud)。
|
||||
|
||||
## 免费节点订阅链接
|
||||
|
||||
@ -66,16 +63,13 @@ https://clashfreenode.com/feed/clash-".date('Ymd').".yaml
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->oHttp->sToUrl = env('api_url_freenode_base').'/'.'api/github/getlast';
|
||||
$sFreenodeNow = $this->oHttp->send();
|
||||
$aFreenodeNow = json_decode($sFreenodeNow, 1);
|
||||
$sTitleSub = $aFreenodeNow['title_sub'];
|
||||
$aArticleFreenode = $this->getArticleFreenode();
|
||||
|
||||
$sContent = "
|
||||
|
||||
# clash节点、免费clash节点、clash订阅链接、clash免费节点、clash科学上网、clash翻墙、clash for windows、clash教程 每日更新 更新时间 ".date('Y-m-d H:i:s')."
|
||||
|
||||
".date("Y年m月d日").$sTitleSub."
|
||||
".date("Y年m月d日").$aArticleFreenode['title_sub']."
|
||||
|
||||
## clash使用教程:
|
||||
|
||||
@ -89,7 +83,9 @@ $sContent = "
|
||||
- 不限登陆设备数,不设置每日封顶流量。
|
||||
- 按流量付费、包月等多种套餐可选,价格便宜。
|
||||
|
||||
网站地址:【[福云](https://fuuu.cloud)】 **".$aArticle['sale_rate']."折优惠券:".$aArticle['sale_code']."**
|
||||
网站地址:[福云](https://fuuu.cloud)
|
||||
|
||||
".$this->aHuodong['str']."
|
||||
|
||||
## 免费节点订阅链接
|
||||
|
||||
@ -125,7 +121,9 @@ $sContent = "
|
||||
|
||||
* 稳定 - 稳定运营二年多,海外团队。
|
||||
|
||||
购买套餐时输入【".$aArticle['sale_code']."】享".$aArticle['sale_rate']."折优惠,点击进入[福云机场官网](https://fuuu.cloud)。
|
||||
".$this->aHuodong['str']."
|
||||
|
||||
点击进入[福云机场官网](https://fuuu.cloud)。
|
||||
|
||||
## 免费节点订阅链接
|
||||
|
||||
@ -188,7 +186,9 @@ https://clashfreenode.com/feed/clash-".date('Ymd').".yaml
|
||||
|
||||
* 稳定 - 稳定运营二年多,海外团队。
|
||||
|
||||
购买套餐时输入【".$aArticle['sale_code']."】享".$aArticle['sale_rate']."折优惠,点击进入[福云机场官网](https://fuuu.cloud)。
|
||||
".$this->aHuodong['str']."
|
||||
|
||||
点击进入[福云机场官网](https://fuuu.cloud)。
|
||||
|
||||
## 工具推荐
|
||||
|
||||
@ -264,7 +264,9 @@ https://clashfreenode.com/feed/clash-".date('Ymd').".yaml
|
||||
|
||||
* 稳定 - 稳定运营二年多,海外团队。
|
||||
|
||||
购买套餐时输入【".$aArticle['sale_code']."】享".$aArticle['sale_rate']."折优惠,点击进入[福云机场官网](https://fuuu.cloud)。
|
||||
".$this->aHuodong['str']."
|
||||
|
||||
点击进入[福云机场官网](https://fuuu.cloud)。
|
||||
|
||||
#### 更新于:".date("Y-m-d H:i:s");
|
||||
|
||||
@ -301,6 +303,8 @@ https://clashfreenode.com/feed/clash-".date('Ymd').".yaml
|
||||
**免费注册试用: https://fuuu.cloud/**<br/>
|
||||
**免费注册试用: https://fuuu.cloud/**<br/>
|
||||
|
||||
".$this->aHuodong['str']."
|
||||
|
||||
注:如果全部节点不可用,请先检查客户端是否最新版本。<br/>
|
||||
如果不是最新版本,请前往 Mikasa 官网下载最新版本。
|
||||
|
||||
@ -348,6 +352,11 @@ https://rAhGrD.mcsslk.xyz/37395c1d7f427ab0c886307c7b5a899b
|
||||
|
||||
public function Test($aArticle)
|
||||
{
|
||||
|
||||
$tt = $this->getHuodongStr($aArticle);
|
||||
tomd($tt, 1);
|
||||
|
||||
|
||||
if (!$this->todayUpd()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -11,8 +11,13 @@ class Http
|
||||
public $sToUrl; // 必须
|
||||
public $bIsJson = false; // 默认值为 false
|
||||
|
||||
public function send(): string
|
||||
public function send($sUrl = false): string
|
||||
{
|
||||
// 两种传递方式
|
||||
if ($sUrl) {
|
||||
$this->sToUrl = $sUrl;
|
||||
}
|
||||
|
||||
// 初始化 cURL 会话
|
||||
$ch = curl_init();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user