mirror of
https://github.com/v2board/v2board.git
synced 2025-06-16 06:37:53 +08:00
update: reset by next year
This commit is contained in:
@ -69,6 +69,9 @@ class ResetTraffic extends Command
|
||||
// no action
|
||||
case 2:
|
||||
break;
|
||||
// year
|
||||
case 3:
|
||||
$this->resetByYear($builder);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -85,10 +88,25 @@ class ResetTraffic extends Command
|
||||
case ($resetMethod['method'] === 2): {
|
||||
break;
|
||||
}
|
||||
case ($resetMethod['method'] === 3): {
|
||||
$builder = with(clone($this->builder))->whereIn('plan_id', $planIds);
|
||||
$this->resetByYear($builder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function resetByYear($builder):void
|
||||
{
|
||||
if ((string)date('d') === '01' && (string)date('m') === '01') {
|
||||
$builder->update([
|
||||
'u' => 0,
|
||||
'd' => 0
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function resetByMonthFirstDay($builder):void
|
||||
{
|
||||
if ((string)date('d') === '01') {
|
||||
|
Reference in New Issue
Block a user