mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
fix
This commit is contained in:
parent
8f4ebe1764
commit
ab2e39f7dd
@ -39,8 +39,8 @@ class ResetTraffic extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$user = User::where('expired_at', '!=', NULL);
|
$user = User::where('expired_at', '!=', NULL);
|
||||||
$resetTrafficMethod = (int)config('v2board.reset_traffic_method', 0);
|
$resetTrafficMethod = config('v2board.reset_traffic_method', 0);
|
||||||
switch ($resetTrafficMethod) {
|
switch ((int)$resetTrafficMethod) {
|
||||||
// 1 a month
|
// 1 a month
|
||||||
case 0:
|
case 0:
|
||||||
$this->resetByMonthFirstDay($user);
|
$this->resetByMonthFirstDay($user);
|
||||||
@ -63,17 +63,17 @@ class ResetTraffic extends Command
|
|||||||
private function resetByExpireDay(User $user):void
|
private function resetByExpireDay(User $user):void
|
||||||
{
|
{
|
||||||
$date = date('Y-m-d', time());
|
$date = date('Y-m-d', time());
|
||||||
$startAt = strtotime($date);
|
$startAt = strtotime((string)$date);
|
||||||
$endAt = $startAt + 24 * 3600;
|
$endAt = (int)$startAt + 24 * 3600;
|
||||||
$lastDay = (string)date('d', strtotime('last day of +0 months'));
|
$lastDay = date('d', strtotime('last day of +0 months'));
|
||||||
if ($lastDay === '29') {
|
if ((string)$lastDay === '29') {
|
||||||
$endAt = $startAt + 72 * 3600;
|
$endAt = (int)$startAt + 72 * 3600;
|
||||||
}
|
}
|
||||||
if ($lastDay === '30') {
|
if ((string)$lastDay === '30') {
|
||||||
$endAt = $startAt + 48 * 3600;
|
$endAt = (int)$startAt + 48 * 3600;
|
||||||
}
|
}
|
||||||
$user->where('expired_at', '>=', $startAt)
|
$user->where('expired_at', '>=', (int)$startAt)
|
||||||
->where('expired_at', '<', $endAt)
|
->where('expired_at', '<', (int)$endAt)
|
||||||
->update([
|
->update([
|
||||||
'u' => 0,
|
'u' => 0,
|
||||||
'd' => 0
|
'd' => 0
|
||||||
|
Loading…
Reference in New Issue
Block a user