mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-16 05:00:54 +08:00
refactor: comment out update-check routes and refactor findUserByBearerToken, calcResetDayByMonthFirstDay, calcResetDayByExpireDay
This commit is contained in:
@@ -16,9 +16,7 @@ use App\Http\Controllers\V2\Admin\KnowledgeController;
|
||||
use App\Http\Controllers\V2\Admin\PaymentController;
|
||||
use App\Http\Controllers\V2\Admin\SystemController;
|
||||
use App\Http\Controllers\V2\Admin\ThemeController;
|
||||
use App\Http\Controllers\V2\Admin\UpdateController;
|
||||
use Illuminate\Contracts\Routing\Registrar;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class AdminRoute
|
||||
{
|
||||
@@ -197,12 +195,12 @@ class AdminRoute
|
||||
});
|
||||
|
||||
// Update
|
||||
$router->group([
|
||||
'prefix' => 'update'
|
||||
], function ($router) {
|
||||
$router->get('/check', [UpdateController::class, 'checkUpdate']);
|
||||
$router->post('/execute', [UpdateController::class, 'executeUpdate']);
|
||||
});
|
||||
// $router->group([
|
||||
// 'prefix' => 'update'
|
||||
// ], function ($router) {
|
||||
// $router->get('/check', [UpdateController::class, 'checkUpdate']);
|
||||
// $router->post('/execute', [UpdateController::class, 'executeUpdate']);
|
||||
// });
|
||||
|
||||
// Theme
|
||||
$router->group([
|
||||
|
||||
@@ -58,7 +58,9 @@ class AuthService
|
||||
|
||||
$accessToken = PersonalAccessToken::findToken($token);
|
||||
|
||||
return $accessToken?->tokenable;
|
||||
$tokenable = $accessToken?->tokenable;
|
||||
|
||||
return $tokenable instanceof User ? $tokenable : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,20 +14,20 @@ class UserService
|
||||
{
|
||||
private function calcResetDayByMonthFirstDay(): int
|
||||
{
|
||||
$today = date('d');
|
||||
$lastDay = date('d', strtotime('last day of +0 months'));
|
||||
$today = (int) date('d');
|
||||
$lastDay = (int) date('d', strtotime('last day of +0 months'));
|
||||
return $lastDay - $today;
|
||||
}
|
||||
|
||||
private function calcResetDayByExpireDay(int $expiredAt)
|
||||
{
|
||||
$day = date('d', $expiredAt);
|
||||
$today = date('d');
|
||||
$lastDay = date('d', strtotime('last day of +0 months'));
|
||||
if ((int) $day >= (int) $today && (int) $day >= (int) $lastDay) {
|
||||
$day = (int) date('d', $expiredAt);
|
||||
$today = (int) date('d');
|
||||
$lastDay = (int) date('d', strtotime('last day of +0 months'));
|
||||
if ($day >= $today && $day >= $lastDay) {
|
||||
return $lastDay - $today;
|
||||
}
|
||||
if ((int) $day >= (int) $today) {
|
||||
if ($day >= $today) {
|
||||
return $day - $today;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user