From 2afa8cc4c263b438eaee6668fbfb3bc27b427237 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Sat, 18 Oct 2025 18:34:56 +0800 Subject: [PATCH] no message --- src/Services/Cron.php | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/Services/Cron.php b/src/Services/Cron.php index 959c655e2..b46f5a822 100755 --- a/src/Services/Cron.php +++ b/src/Services/Cron.php @@ -158,7 +158,7 @@ final class Cron $sixMonthsAgo = $now->copy()->subMonths(6); $twelveMonthsAgo = $now->copy()->subMonths(12); - $aCount = [ + $aCountPay = [ '三月' => DB::table('user') ->where('class', '>=', $iPayClass) ->where('reg_date', '>', $threeMonthsAgo) @@ -184,17 +184,40 @@ final class Cron ->count(), ]; + $aCountAll = [ + '三月' => DB::table('user') + ->where('reg_date', '>', $threeMonthsAgo) + ->count(), + + '半年' => DB::table('user') + ->whereBetween('reg_date', [$sixMonthsAgo, $threeMonthsAgo]) + ->count(), + + '一年' => DB::table('user') + ->whereBetween('reg_date', [$twelveMonthsAgo, $sixMonthsAgo]) + ->count(), + + '一年+' => DB::table('user') + ->where('reg_date', '<=', $twelveMonthsAgo) + ->count(), + + '总共' => DB::table('user') + ->where('class', '<', $iPayClass) + ->count(), + ]; + $str = "# 付费用户计数 \n"; -// $str .= ""; - foreach ($aCount as $k => $v) { - $str .= "\n".$k.":".$v; -// $str .= ""; -// $str .= ""; -// $str .= ""; -// $str .= ""; + + foreach ($aCountPay as $k => $v) { + + if ($v) { + $iRate = $v / $aCountAll[$k] * 100; + } else { + $iRate = 0; + } + + $str .= "\n".$k.":".$v." [共".$aCountAll[$k].",占".$iRate."%]"; } -// $str .= "
".$k."".$v."
"; -// $str .= "\n\n----END--------"; $oTelegramV2 = new TelegramV2("base"); // $oTelegramV2->setMsgType("html");