no message

This commit is contained in:
hellcat 2025-10-18 13:55:40 +08:00
parent b2ccba1df3
commit a74ef3f56f
4 changed files with 57 additions and 1 deletions

View File

@ -68,6 +68,7 @@ EOL;
) { ) {
$jobs->cleanDb(); $jobs->cleanDb();
// $jobs->resetNodeBandwidth(); // $jobs->resetNodeBandwidth();
$jobs->reportPayUser(); // 付费用户统计
$jobs->resetDuckBandwidth(); // 重置每日的duck流量 $jobs->resetDuckBandwidth(); // 重置每日的duck流量
$jobs->reportBandWidth(); // 报告流量给tg $jobs->reportBandWidth(); // 报告流量给tg
$jobs->resetFreeUserBandwidth(); // 重置免费用户的流量 $jobs->resetFreeUserBandwidth(); // 重置免费用户的流量

View File

@ -47,7 +47,7 @@ final class ProductController extends BaseController
} else if ($aProductRow["class_time"] < 180) { } else if ($aProductRow["class_time"] < 180) {
$aProductRow["time_group_str"] = "季付"; $aProductRow["time_group_str"] = "季付";
} else if ($aProductRow["class_time"] < 360) { } else if ($aProductRow["class_time"] < 360) {
$aProductRow["time_group_str"] = "半年"; $aProductRow["time_group_str"] = "半年";
} else { } else {
$aProductRow["time_group_str"] = "年付"; $aProductRow["time_group_str"] = "年付";
} }

View File

@ -51,6 +51,7 @@ use function time;
use const PHP_EOL; use const PHP_EOL;
use App\Models\Smtp as ModelSmtp; use App\Models\Smtp as ModelSmtp;
//use Illuminate\Support\Facades\DB; // 线上可能要开 //use Illuminate\Support\Facades\DB; // 线上可能要开
use Carbon\Carbon;
final class Cron final class Cron
@ -146,6 +147,54 @@ final class Cron
TgStep::where("date", "<=", date('Y-m-d', strtotime('-1 day')))->delete(); TgStep::where("date", "<=", date('Y-m-d', strtotime('-1 day')))->delete();
} }
// 付费用户统计
public static function reportPayUser(): void
{
$iPayClass = $_ENV["user_payClass"];
$now = Carbon::now();
$threeMonthsAgo = $now->copy()->subMonths(3);
$sixMonthsAgo = $now->copy()->subMonths(6);
$twelveMonthsAgo = $now->copy()->subMonths(12);
$aCount = [
'三月' => DB::table('user')
->where('class', '>=', $iPayClass)
->where('reg_date', '>', $threeMonthsAgo)
->count(),
'半年' => DB::table('user')
->where('class', '>=', $iPayClass)
->whereBetween('reg_date', [$sixMonthsAgo, $threeMonthsAgo])
->count(),
'一年' => DB::table('user')
->where('class', '>=', $iPayClass)
->whereBetween('reg_date', [$twelveMonthsAgo, $sixMonthsAgo])
->count(),
'一年+' => DB::table('user')
->where('class', '>=', $iPayClass)
->where('reg_date', '<=', $twelveMonthsAgo)
->count(),
'总共' => DB::table('user')
->where('class', '>=', $iPayClass)
->count(),
];
$str = "# 付费用户计数";
foreach ($aCount as $k => $v) {
$str .= "\n".$k."".$v;
}
$oTelegramV2 = new TelegramV2("base");
$oTelegramV2->setMsgType("html");
$oTelegramV2->send($str, "str");
}
// 统计用户数据入库发送tg // 统计用户数据入库发送tg
public static function userCount(): void public static function userCount(): void
{ {

View File

@ -180,6 +180,12 @@ final class Test extends Base
return 1; return 1;
} }
public function reportPayUser()
{
$oJob = new Cron();
$oJob->reportPayUser();
}
public function orderPay() public function orderPay()
{ {
$job = new Cron(); $job = new Cron();