no message

This commit is contained in:
hellcat 2025-05-02 17:56:40 +08:00
parent 4fe8ea08b8
commit 4e2ba8f2be
3 changed files with 32 additions and 5 deletions

View File

@ -82,8 +82,8 @@ final class TestController extends BaseController
public function test2()
{
$oCron = new Cron();
$oCron->boot();
$oCron = new CronService();
$oCron->resetFreeUserBandwidth();
}

View File

@ -43,6 +43,7 @@ use const PHP_EOL;
final class Cron
{
// 数据库清理
public static function cleanDb(): void
{
(new SubscribeLog())->where(
@ -62,11 +63,14 @@ final class Cron
echo Tools::toDateTime(time()) . ' 数据库清理完成' . PHP_EOL;
}
// 清理tg step暂时没用
public static function clearTgStep(): void
{
TgStep::where("date", "<=", date('Y-m-d', strtotime('-1 day')))->delete();
}
// 统计用户数据入库发送tg
public static function userCount(): void
{
$sPrevDate = date("Y-m-d", strtotime("-1 day"));
@ -208,6 +212,7 @@ final class Cron
//
// }
// 限制帐户检测
public static function detectInactiveUser(): void
{
$checkin_days = Config::obtain('detect_inactive_user_checkin_days');
@ -232,6 +237,7 @@ final class Cron
' 检测到 ' . (new User())->where('is_inactive', 1)->count() . ' 个账户处于闲置状态' . PHP_EOL;
}
// 节点掉线检测
public static function detectNodeOffline(): void
{
$nodes = (new Node())->where('type', 1)->get();
@ -307,6 +313,8 @@ final class Cron
echo Tools::toDateTime(time()) . ' 节点离线检测完成' . PHP_EOL;
}
// 付费用户过期检测
// class > 0所以不包含注册试用帐户
public static function expirePaidUserAccount(): void
{
$paidUsers = (new User())->where('class', '>', 0)->get();
@ -390,6 +398,7 @@ final class Cron
echo Tools::toDateTime(time()) . ' 付费用户过期检测完成' . PHP_EOL;
}
// 邮件队列处理
public static function processEmailQueue(): void
{
if ((new EmailQueue())->count() === 0) {
@ -639,6 +648,7 @@ final class Cron
echo Tools::toDateTime(time()) . ' TABP订单激活处理完成' . PHP_EOL;
}
// 流量包激活,暂时没用
public static function processBandwidthOrderActivation(): void
{
$users = User::all();
@ -668,9 +678,7 @@ final class Cron
echo Tools::toDateTime(time()) . ' 流量包订单激活处理完成' . PHP_EOL;
}
/**
* @throws Exception
*/
// 时间包激活,暂时没用
public static function processTimeOrderActivation(): void
{
$users = User::all();
@ -765,6 +773,7 @@ final class Cron
echo Tools::toDateTime(time()) . ' 重设节点流量完成' . PHP_EOL;
}
// 机器到日期重置流量
public static function resetDuckBandwidth(): void
{
(new Ducks())->where('width_reset_day', date('d'))->update(['use_width' => 0]);
@ -779,6 +788,7 @@ final class Cron
// echo Tools::toDateTime(time()) . ' 重设机器流量完成' . PHP_EOL;
// }
// 每小时统计节点流量入库tg警报
public static function mergeBandWidth(): void
{
@ -832,6 +842,7 @@ final class Cron
}
// 每日报表
public static function reportBandWidth(): void
{
@ -912,6 +923,7 @@ final class Cron
}
// 每日清空duck和转发的每日流量
public static function clearTodayWidth(): void
{
Ducks::query()->update(['today_width' => 0]);
@ -1003,6 +1015,8 @@ final class Cron
}
// 用户流量每日重置
public static function resetTodayBandwidth(): void
{
(new User())->query()->update(['transfer_today' => 0]);
@ -1035,6 +1049,7 @@ final class Cron
echo Tools::toDateTime(time()) . ' 免费用户流量重置完成' . PHP_EOL;
}
// 财务日报,好像没用
public static function sendDailyFinanceMail(): void
{
$today = strtotime('00:00:00');
@ -1068,6 +1083,7 @@ final class Cron
echo Tools::toDateTime(time()) . ' 成功发送财务日报' . PHP_EOL;
}
// 财务周报,好像没用
public static function sendWeeklyFinanceMail(): void
{
$today = strtotime('00:00:00');
@ -1091,6 +1107,7 @@ final class Cron
echo Tools::toDateTime(time()) . ' 成功发送财务周报' . PHP_EOL;
}
// 财务越好,好像没用
public static function sendMonthlyFinanceMail(): void
{
$today = strtotime('00:00:00');

View File

@ -40,6 +40,16 @@ final class User extends Base
{
// $sField = $aParam['aOption'][1];
$iLimit = $aParam['aArg'][1] ?? 1; // 默认五条
$sType = $aParam['aOption'][1] ?? "class0";
if ($sType) {
if ($sType == "class1") {
$aa = ">";
} else if ($sType == "class0") {
$sType = ">=";
}
}
$aUser = ModelUser::where("class", '>', 0)->orderBy("id", "desc")->limit($iLimit)->get()->toArray();