diff --git a/src/Services/Cron.php b/src/Services/Cron.php index 06ba6b260..a6b6e2428 100755 --- a/src/Services/Cron.php +++ b/src/Services/Cron.php @@ -418,19 +418,19 @@ final class Cron // echo $e->getMessage() . PHP_EOL; // } // - if (Config::obtain('telegram_node_offline')) { - $notice_text = str_replace( - '%node_name%', - $node->name, - Config::obtain('telegram_node_offline_text') - ); - - try { - (new Telegram())->send(0, $notice_text); - } catch (TelegramSDKException $e) { - echo $e->getMessage(); - } - } +// if (Config::obtain('telegram_node_offline')) { +// $notice_text = str_replace( +// '%node_name%', +// $node->name, +// Config::obtain('telegram_node_offline_text') +// ); +// +// try { +// (new Telegram())->send(0, $notice_text); +// } catch (TelegramSDKException $e) { +// echo $e->getMessage(); +// } +// } $node->online = 0; $node->save(); @@ -1591,7 +1591,7 @@ final class Cron $oTgSendFormat->sTitleEmoji = "\n\n"; $oTgSendFormat->sTitle = "# 机器流量"; - $oServers = Node::where('type', 2)->get(); + $oServers = Node::where('type', 2)->orderBy('order_group')->get(); if ($oServers->isEmpty()) { return; @@ -1630,7 +1630,12 @@ final class Cron } foreach ($aZhuanfaToday as $sZhuanfaCode => $iZhuanfaWidthToday) { - $oZhuanfa = Zhuanfas::updateOrCreate(['code' => $sZhuanfaCode]); + + $oZhuanfa = Zhuanfas::firstOrCreate( + ['code' => $sZhuanfaCode], // 查询条件 + ['name' => $sZhuanfaName] // 只有在创建新记录时,这些字段才会被写入 + ); + $oZhuanfa->today_width = $iZhuanfaWidthToday; // 这个覆盖是可以的,因为这是当前周期的总量 $oZhuanfa->save(); $oZhuanfa->increment('use_width', $iZhuanfaWidthToday); // 这里使用原子递增