mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-28 06:47:24 +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\PaymentController;
|
||||||
use App\Http\Controllers\V2\Admin\SystemController;
|
use App\Http\Controllers\V2\Admin\SystemController;
|
||||||
use App\Http\Controllers\V2\Admin\ThemeController;
|
use App\Http\Controllers\V2\Admin\ThemeController;
|
||||||
use App\Http\Controllers\V2\Admin\UpdateController;
|
|
||||||
use Illuminate\Contracts\Routing\Registrar;
|
use Illuminate\Contracts\Routing\Registrar;
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
|
|
||||||
class AdminRoute
|
class AdminRoute
|
||||||
{
|
{
|
||||||
@@ -197,12 +195,12 @@ class AdminRoute
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
$router->group([
|
// $router->group([
|
||||||
'prefix' => 'update'
|
// 'prefix' => 'update'
|
||||||
], function ($router) {
|
// ], function ($router) {
|
||||||
$router->get('/check', [UpdateController::class, 'checkUpdate']);
|
// $router->get('/check', [UpdateController::class, 'checkUpdate']);
|
||||||
$router->post('/execute', [UpdateController::class, 'executeUpdate']);
|
// $router->post('/execute', [UpdateController::class, 'executeUpdate']);
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Theme
|
// Theme
|
||||||
$router->group([
|
$router->group([
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ class AuthService
|
|||||||
|
|
||||||
$accessToken = PersonalAccessToken::findToken($token);
|
$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
|
private function calcResetDayByMonthFirstDay(): int
|
||||||
{
|
{
|
||||||
$today = date('d');
|
$today = (int) date('d');
|
||||||
$lastDay = date('d', strtotime('last day of +0 months'));
|
$lastDay = (int) date('d', strtotime('last day of +0 months'));
|
||||||
return $lastDay - $today;
|
return $lastDay - $today;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function calcResetDayByExpireDay(int $expiredAt)
|
private function calcResetDayByExpireDay(int $expiredAt)
|
||||||
{
|
{
|
||||||
$day = date('d', $expiredAt);
|
$day = (int) date('d', $expiredAt);
|
||||||
$today = date('d');
|
$today = (int) date('d');
|
||||||
$lastDay = date('d', strtotime('last day of +0 months'));
|
$lastDay = (int) date('d', strtotime('last day of +0 months'));
|
||||||
if ((int) $day >= (int) $today && (int) $day >= (int) $lastDay) {
|
if ($day >= $today && $day >= $lastDay) {
|
||||||
return $lastDay - $today;
|
return $lastDay - $today;
|
||||||
}
|
}
|
||||||
if ((int) $day >= (int) $today) {
|
if ($day >= $today) {
|
||||||
return $day - $today;
|
return $day - $today;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user