clinet fix
This commit is contained in:
parent
e900ebc957
commit
de2c68aaf6
2 changed files with 19 additions and 8 deletions
|
|
@ -297,15 +297,9 @@ public function generateAuthToken(int $id): JsonResponse
|
||||||
|
|
||||||
$result = $this->tokenService->generateAuthToken($client);
|
$result = $this->tokenService->generateAuthToken($client);
|
||||||
|
|
||||||
$this->logService->logOperation(
|
|
||||||
'admin',
|
|
||||||
$this->admin->id,
|
|
||||||
"Generated auth token for client: {$client->name}"
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->success([
|
return $this->success([
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
'auth_token' => $result['token'],
|
'auth_token' => $result['auth_token'],
|
||||||
'created_at' => now()->toIso8601String(),
|
'created_at' => now()->toIso8601String(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -319,6 +313,10 @@ public function generateAuthToken(int $id): JsonResponse
|
||||||
'error' => $e->getMessage(),
|
'error' => $e->getMessage(),
|
||||||
'trace' => $e->getTraceAsString(),
|
'trace' => $e->getTraceAsString(),
|
||||||
'client_id' => $id,
|
'client_id' => $id,
|
||||||
|
'client_exists' => Client::find($id) ? 'yes' : 'no',
|
||||||
|
'redis_status' => Redis::ping() ? 'connected' : 'disconnected',
|
||||||
|
'file' => $e->getFile(),
|
||||||
|
'line' => $e->getLine()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->error(
|
return $this->error(
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
use App\Http\Middleware\ValidateAccessToken;
|
use App\Http\Middleware\ValidateAccessToken;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
@ -14,7 +16,8 @@ class AppServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function register(): void
|
public function register(): void
|
||||||
{
|
{
|
||||||
//
|
Route::aliasMiddleware('auth.access_token', ValidateAccessToken::class);
|
||||||
|
Route::aliasMiddleware('auth.admin', AdminAuthenticate::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,5 +27,15 @@ public function boot(): void
|
||||||
{
|
{
|
||||||
Route::aliasMiddleware('auth.access_token', ValidateAccessToken::class);
|
Route::aliasMiddleware('auth.access_token', ValidateAccessToken::class);
|
||||||
Route::aliasMiddleware('auth.admin', AdminAuthenticate::class);
|
Route::aliasMiddleware('auth.admin', AdminAuthenticate::class);
|
||||||
|
|
||||||
|
// Redis 連接檢查
|
||||||
|
try {
|
||||||
|
Redis::ping();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Redis connection failed', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'trace' => $e->getTraceAsString()
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue