mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-28 06:47:24 +08:00
fix: resolve known issues and improve code standards
- Fix known bugs in user, plan, and server modules - Standardize code formatting and structure - Optimize database queries and model relationships - Improve request validation and error handling - Update admin controllers for better consistency
This commit is contained in:
@@ -87,13 +87,6 @@ class ServerService
|
||||
public static function getRoutes(array $routeIds)
|
||||
{
|
||||
$routes = ServerRoute::select(['id', 'match', 'action', 'action_value'])->whereIn('id', $routeIds)->get();
|
||||
// TODO: remove on 1.8.0
|
||||
foreach ($routes as $k => $route) {
|
||||
$array = json_decode($route->match, true);
|
||||
if (is_array($array))
|
||||
$routes[$k]['match'] = $array;
|
||||
}
|
||||
// TODO: remove on 1.8.0
|
||||
return $routes;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,6 @@ class TrafficResetService
|
||||
Plan::RESET_TRAFFIC_MONTHLY => $this->getNextMonthlyReset($user, $now),
|
||||
Plan::RESET_TRAFFIC_FIRST_DAY_YEAR => $this->getNextYearFirstDay($now),
|
||||
Plan::RESET_TRAFFIC_YEARLY => $this->getNextYearlyReset($user, $now),
|
||||
Plan::RESET_TRAFFIC_NEVER => null,
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
@@ -251,6 +250,7 @@ class TrafficResetService
|
||||
Plan::RESET_TRAFFIC_MONTHLY => TrafficResetLog::TYPE_MONTHLY,
|
||||
Plan::RESET_TRAFFIC_FIRST_DAY_YEAR => TrafficResetLog::TYPE_FIRST_DAY_YEAR,
|
||||
Plan::RESET_TRAFFIC_YEARLY => TrafficResetLog::TYPE_YEARLY,
|
||||
Plan::RESET_TRAFFIC_NEVER => TrafficResetLog::TYPE_MANUAL,
|
||||
default => TrafficResetLog::TYPE_MANUAL,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -145,8 +145,8 @@ class UserService
|
||||
'total_available' => $user->transfer_enable ?? 0,
|
||||
'remaining' => $user->getRemainingTraffic(),
|
||||
'usage_percentage' => $user->getTrafficUsagePercentage(),
|
||||
'next_reset_at' => $user->next_reset_at?->timestamp,
|
||||
'last_reset_at' => $user->last_reset_at?->timestamp,
|
||||
'next_reset_at' => $user->next_reset_at,
|
||||
'last_reset_at' => $user->last_reset_at,
|
||||
'reset_count' => $user->reset_count,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user