From 19941ec5bb9454f611a699dc5ccc8f7182cd9265 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Wed, 11 Feb 2026 16:48:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BF=BB=E8=AF=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/AuthController.php | 2 ++ app/Models/AdminTranslation.php | 3 ++- app/Services/OperationLogService.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/AuthController.php b/app/Http/Controllers/Admin/AuthController.php index 6a59d97..3c6cdbe 100644 --- a/app/Http/Controllers/Admin/AuthController.php +++ b/app/Http/Controllers/Admin/AuthController.php @@ -106,6 +106,8 @@ class AuthController extends Controller if ($user) { // 删除所有token $user->tokens()->delete(); + // 清除所有会话数据 + session()->flush(); $this->logService->log('logout', $user['name'] . '退出系统'); } diff --git a/app/Models/AdminTranslation.php b/app/Models/AdminTranslation.php index e7ed665..15b689d 100644 --- a/app/Models/AdminTranslation.php +++ b/app/Models/AdminTranslation.php @@ -4,10 +4,11 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\SoftDeletes; class AdminTranslation extends Model { - use HasFactory; + use HasFactory, SoftDeletes; protected $table = 'admin_translation'; diff --git a/app/Services/OperationLogService.php b/app/Services/OperationLogService.php index 2714033..83b0302 100644 --- a/app/Services/OperationLogService.php +++ b/app/Services/OperationLogService.php @@ -27,7 +27,7 @@ final class OperationLogService ?array $newValues = null ): AdminOperationLog { $data = [ - 'user_id' => Auth::id() ?? 0, + 'user_id' => Auth::guard('sanctum')->user()['id'] ?? 0, 'action' => $action, 'description' => $description, 'ip' => Request::ip(),