From c7f0d65adc9b0f0961c5913d14ce28ef1cec5b9e Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Thu, 20 Mar 2025 19:32:19 +0800 Subject: [PATCH] 1 --- src/Services/Cron.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Services/Cron.php b/src/Services/Cron.php index 3f60cc9d..1406413d 100755 --- a/src/Services/Cron.php +++ b/src/Services/Cron.php @@ -489,14 +489,25 @@ final class Cron $oDucksAll = $oDucks->orderBy('code')->get(); foreach ($oDucksAll as $oDucksRow) { - $targetDate = new DateTime($oZhuanfasRow->end_date); + if ($oDucksRow->width_reset_day > date('d')) { + $iWidthResetDay = $oDucksRow->width_reset_day - date('d'); + } else { + $date = new DateTime(); + $date->modify('first day of next month'); + $date->setDate((int)$date->format('Y'), (int)$date->format('m'), $oDucksRow->width_reset_day); + $sEndDate = $date; + + $currentDate = new DateTime(); + $interval = $currentDate->diff($sEndDate); + $iWidthResetDay = $interval->days; + } $oTgSendFormat->rowAdd( $oDucksRow->code, $iDuckFlowToday[$oDucksRow->code] ?? 0, $oDucksRow->use_width, $oDucksRow->max_width, - $oDucksRow->width_reset_day - date('d') + $iWidthResetDay ); }