diff --git a/app/Services/Cron.php b/app/Services/Cron.php index fb38f5eb..d5da8ed0 100755 --- a/app/Services/Cron.php +++ b/app/Services/Cron.php @@ -63,7 +63,8 @@ final class Cron } if ($h == 13 && $i == 3) { // 中午12点03发布fn的tg - CronFnTgPublish::run(); +// CronFnTgPublish::run(); + CronFnTgPublish::run_b(); } if ($i % 3 === 0) { diff --git a/app/Services/Cron/FnTgPublish.php b/app/Services/Cron/FnTgPublish.php index 068a72e6..3f827684 100755 --- a/app/Services/Cron/FnTgPublish.php +++ b/app/Services/Cron/FnTgPublish.php @@ -17,7 +17,7 @@ final class FnTgPublish { echo "\n\nFnTgPublish::run()"; - $aSiteList = ModelSiteMap::where("group_code", "fn_a")->get()->toArray(); + $aSiteList = ModelSiteMap::whereIn("group_code", ["fn_a"])->get()->toArray(); foreach ($aSiteList as $aSite) { $sConfig = $aSite["config"] ?? ""; @@ -60,6 +60,65 @@ final class FnTgPublish // $sImgUrl = "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"; // $sImgUrl = "https://clashfreenode.com/site/clashfreenode.com/images/article/5.png"; // $sImgUrl = "https://gips3.baidu.com/it/u=1821127123,1149655687&fm=3028&app=3028&f=JPEG&fmt=auto?w=720&h=1280"; +// $sImgUrl = ""; + + $r = TeleSlave::start($sSiteCode, $sSiteCode) +// ->enableSlaveQueue(false) + ->enableDetail(false) + ->enableAsync(false) + ->setPhotoUrl($sImgUrl, 1280, 720) + ->setMsgS($sStr) + ->setType("html") + ->send(); + + echo "\n - ok"; + } + } + + public static function run_b() + { + echo "\n\nFnTgPublish::run()"; + + $aSiteList = ModelSiteMap::whereIn("group_code", ["fn_b"])->get()->toArray(); + + foreach ($aSiteList as $aSite) { + $sConfig = $aSite["config"] ?? ""; + $sApiPath = $aSite["api_path"] ?? ""; + $sSiteDomain = $aSite["url"] ?? ""; + $sSiteCode = $aSite["code"] ?? ""; + + //// test +// $sSiteCode = "clashfreenode.com"; + + $aConfig = json_decode($sConfig, true); + $aApiPath = json_decode($sApiPath, true); + + $sApiPath = $aApiPath["article_find"] ?? ""; + $sApiUrl = "https://".$sSiteDomain."/".$sApiPath; + + $aData = [ + "articleType" => "freenode", + "code" => "fn".date("Ymd") + ]; + + $sResult = HttpV2::make($sApiUrl, "post")->setDataA($aData)->enableJsonSend(true)->send(); + $aResult = json_decode($sResult, true); + $sImgUrl = $aResult["sThumb"] ?? ''; + + if (!$sImgUrl) { + throw new \Exception("没得到sThumb >>> ".$sResult); + } + + $iImgId = $aResult["aData"]["img_id"] ?? 0; + + $sTitle = "「".date("m月d日")."」最新免费节点,SSR/V2ray/Clash/Shadowrocket"; + + $sStr = $sTitle."\n\n👉 https://".$sSiteDomain."/a/fn.".date("Ymd").".html"; + +// $sImgUrl = "https://".$sSiteDomain."/site/".$sSiteCode."/images/article/".$iImgId.".png"; +// $sImgUrl = "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"; +// $sImgUrl = "https://clashfreenode.com/site/clashfreenode.com/images/article/5.png"; +// $sImgUrl = "https://gips3.baidu.com/it/u=1821127123,1149655687&fm=3028&app=3028&f=JPEG&fmt=auto?w=720&h=1280"; // $sImgUrl = ""; $r = TeleSlave::start($sSiteCode, $sSiteCode)