first()?->content; $sShadowRocketIds = ShadowRocketIds::whereDate('created_at', date("Y-m-d"))->first()?->arr; $aShadowRocketIds = json_decode($sShadowRocketIds, true); $iShadowRocketIdsCount = count($aShadowRocketIds); foreach ($cSiteFnb as $oSiteFnb) { $sArticle = $sBlade; $aSiteConfig = json_decode($oSiteFnb->config, true); $sShip = ServiceShipHtml::byShipCode($aSiteConfig['ship_code']); $aShadowRocketIdsHtml = []; foreach ($aShadowRocketIds as $a) { $s = ""; $s .= "

"; $s .= '账号: '.$a['sEmail'].','; $s .= '密码: '.$a['sPassword'].','; $s .= "地区:".$a['sRegion'].",检测时间:".$a['sCheckTime'].''; $s .= "

"; $aShadowRocketIdsHtml[] = $s; } $sShadowRocketIdsHtml = implode("\n\n", $aShadowRocketIdsHtml); $aFilter = [ '{$sContent}' => $sShadowRocketIdsHtml, '{$sShip}' => $sShip, '{$sTgHref}' => $aSiteConfig['telegram'], '{$sGithubHref}' => $aSiteConfig['github'] ?? '' ]; $sArticle = self::nl2p(str_replace(array_keys($aFilter), array_values($aFilter), $sArticle)); $aResult = [ "content" => $sArticle, "title" => '「'.date("n月j日").'」'.date("Y").'年最新免费苹果账号(小火箭账号、shadowrocket id)', "title_sub" => "本次更新共{$iShadowRocketIdsCount}个免费苹果账号,可用于使用小火箭(shadowrocket)。", "tags" => ["ios", "shadowrocket", "小火箭", "小火箭账号", "shadowrocket id", "免费苹果账号"], "7like" => 9 ]; $aApiPath = json_decode($oSiteFnb->api_path, true); $sArticleReceiveShadowrocketids = "https://".$oSiteFnb->url."/".$aApiPath["article_receive_shadowrocketids"]; $sFlow = HttpV2::make($sArticleReceiveShadowrocketids, "post")->setDataA($aResult)->send(); $aFlow = json_decode($sFlow, true); if (!isset($aFlow["isDone"]) || !$aFlow["isDone"]) { echo $sFlow; TeleSlave::warn()->send('ShadowRocketPublish::fn_b()的发送文章失败'); continue; } echo "\n ok"; } } public static function nl2p($text) { // 将文本按换行符拆分成数组 $paragraphs = explode("\n", $text); // 将每一段用

标签包裹 $paragraphs = array_map(function($paragraph) { return '

' . trim($paragraph) . '

'; }, $paragraphs); // 使用 implode 拼接成一个字符串 return implode('', $paragraphs); } }