mirror of
https://github.com/v2board/v2board.git
synced 2025-01-10 16:19:10 +08:00
feature: reset day
This commit is contained in:
parent
4f60cc5311
commit
95d71ae77f
@ -99,6 +99,7 @@ class UserController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$user['subscribe_url'] = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))) . '/api/v1/client/subscribe?token=' . $user['token'];
|
$user['subscribe_url'] = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))) . '/api/v1/client/subscribe?token=' . $user['token'];
|
||||||
|
$user['reset_day'] = $this->getResetDay($user);
|
||||||
return response([
|
return response([
|
||||||
'data' => $user
|
'data' => $user
|
||||||
]);
|
]);
|
||||||
@ -160,4 +161,24 @@ class UserController extends Controller
|
|||||||
'data' => true
|
'data' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getResetDay(User $user)
|
||||||
|
{
|
||||||
|
if ($user->expired_at <= time() || $user->expired_at === NULL) return null;
|
||||||
|
$day = date('d', $user->expired_at);
|
||||||
|
$today = date('d');
|
||||||
|
$lastDay = date('d', strtotime('last day of +0 months'));
|
||||||
|
|
||||||
|
if ((int)config('v2board.reset_traffic_method') === 0) {
|
||||||
|
return $lastDay - $today;
|
||||||
|
}
|
||||||
|
if ((int)config('v2board.reset_traffic_method') === 1) {
|
||||||
|
if ((int)$day >= (int)$today) {
|
||||||
|
return $day - $today;
|
||||||
|
} else {
|
||||||
|
return $lastDay - $today + $day;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
2
public/assets/admin/umi.css
vendored
2
public/assets/admin/umi.css
vendored
File diff suppressed because one or more lines are too long
2
public/assets/user/umi.css
vendored
2
public/assets/user/umi.css
vendored
File diff suppressed because one or more lines are too long
2
public/assets/user/umi.js
vendored
2
public/assets/user/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user