no message

This commit is contained in:
hellcat 2026-01-15 13:35:05 +08:00
parent 44bf6e5cdf
commit d73d851aba
5 changed files with 68 additions and 5 deletions

View File

@ -14,9 +14,37 @@ use App\Services\TomTool\Telegram\Slave as TelegramSlave;
final class HookController
{
private $sCustomText = '';
public function cache_tg($sGroupCode)
{
try {
$sUpdate = file_get_contents("php://input");
$aUpdate = json_decode($sUpdate, true);
$sText = $aUpdate["message"]["text"] ?? "没有text";
if (!str_starts_with($sText, '/')) {
$this->sCustomText = "/article#cacheAdd__{$sGroupCode}"." ".$sUpdate;
}
$this->cmd();
} catch (\Throwable $e) {
$aDataTg = ThrowableHandler::make($e)->enableTrace()->fetch();
TelegramSlave::fail()->enableSlaveQueue(false)->setMsgA([
"msg" => $aDataTg,
"data" => $sUpdate,
])->send();
$aDataCmd = $aDataTg;
$sDataCmd = json_encode($aDataCmd, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
$sDataCmd = str_replace("\\n", "<br>", $sDataCmd);
echo $sDataCmd;
exit;
}
}
public function cmd_ffq_article()
{
try {

View File

@ -101,7 +101,7 @@ final class CacheTg
$oArticleSchema->name = $aDataMix["name"] ?? "none";
$oArticleSchema->save();
ModelArticleCache::where("status", 1)->update([
ModelArticleCache::where("status", 1)->where("group_code", $sFromPaichu)->update([
"status" => 0, // 上线改0
"code" => $sArticleCode,
]);
@ -180,7 +180,7 @@ final class CacheTg
// }
$fileName = basename($filePath);
$fileName = uniqid('ffq_tg-'.$k.'-'.time().'-').$fileName; // 加前缀并提高熵值
$fileName = uniqid($sGroupCode.'-'.$k.'-'.time().'-').$fileName; // 加前缀并提高熵值
file_put_contents($sPathUpload . $fileName, $imageData);
$aDataTmp["content"]["img"][$k] = $_ENV["APP_URL"].'/upload/'.$fileName;;

View File

@ -7,6 +7,7 @@ namespace App\Services\Cron;
use App\Models\SiteMap as ModelSiteMap;
use App\Models\SitePathMap as ModelSitePathMap;
use App\Models\ArticleConfig as ModelArticleConfig;
use App\Models\ArticleCache as ModelArticleCache;
use App\Models\ArticleSchema as ModelArticleSchema;
use App\Models\ArticleCacheTime as ModelArticleCacheTime;
use App\Services\Article\CacheTg as ServiceArticleCacheTg;
@ -156,8 +157,15 @@ final class ArticleSchema
return false;
}
$oCacheTime->time = 0;
$oCacheTime->save();
//// 如果cache里还存在未处理的就维持cron
//// schema那边一次只处理一种group_code等于就是多种group_code时维持cron一次处理一种
$b = ModelArticleCache::where('status', 1)->exists();
if (!$b) {
$oCacheTime->time = 0;
$oCacheTime->save();
} else {
echo " - 有其他group_code维持cron\n";
}
echo " - ok\n";
}

25
github的blade说明.md Normal file
View File

@ -0,0 +1,25 @@
========可用变量================
$ex["good_rand"] = $sGoodRand;
$sGoodShip = ModelGoodPool::_goodToGithub($aShip["good"]);
$ex["good_ship"] = $sGoodShip;
$ex["url_sub_v2ray"] = "https://".$aArticle["fn_www"]."/sub/v2ray-".date("Ymd").".txt";
$ex["url_sub_clash"] = "https://".$aArticle["fn_www"]."/sub/v2ray-".date("Ymd").".yaml";
$ex["youhui"] = "购买套餐时输入【".$aArticle['sale_code']."】优惠码,可享".$aArticle['sale_rate']."折优惠,折后低至".$aArticle['sale_price']."元/月。";
$ex["url_github_clash"] = "https://raw.githubusercontent.com/".$aArticle["user_name"]."/".$aArticle["project_name"]."/main/feed/clash-".$sDateCode.".yaml";
$ex["url_github_v2ray"] = "https://raw.githubusercontent.com/".$aArticle["user_name"]."/".$aArticle["project_name"]."/main/feed/v2ray-".$sDateCode.".txt";
$ex["url_github_io_clash"] = "https://".$aArticle["user_name"].".github.io/feed/clash-".$sDateCode.".yaml";
$ex["url_github_io_v2ray"] = "https://".$aArticle["user_name"].".github.io/feed/v2ray-".$sDateCode.".txt";
$ex["huodong"] = $this->getHuodong($aShip);
用法:
{$this->date(\"m月d日\")}
{$ex["url_github_clash"]}

View File

@ -50,6 +50,8 @@ Route::get('/test5', [SakaiController::class, 'test5']);
Route::any('/api/tg/hook', [HookController::class, 'cmd']);
Route::any('/api/tg/hook/cmd_ffq_article', [HookController::class, 'cmd_ffq_article']);
Route::any('/api/tg/hook/cache_tg/{group_code}', [HookController::class, 'cache_tg']);
//Route::get('/', [ArticleListController::class, 'fn']);
//Route::get('/fn', [ArticleListController::class, 'fn']); // 免费节点list