From 9859f0667226aae7191279efb7c0fc7dff1bbf06 Mon Sep 17 00:00:00 2001 From: gcd Date: Sat, 29 Mar 2025 14:19:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/WorkerApi.php | 9 +++++++++ application/worker/controller/Worker.php | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/application/common/controller/WorkerApi.php b/application/common/controller/WorkerApi.php index da77245..939f90f 100644 --- a/application/common/controller/WorkerApi.php +++ b/application/common/controller/WorkerApi.php @@ -207,6 +207,15 @@ class WorkerApi extends BaseService return true; } + public function workerLogout(): bool + { + if ($this->token) { + Token::delete($this->token); + } + + return true; + } + /** * 验证数据 * @access protected diff --git a/application/worker/controller/Worker.php b/application/worker/controller/Worker.php index feab2f5..c112d64 100644 --- a/application/worker/controller/Worker.php +++ b/application/worker/controller/Worker.php @@ -46,4 +46,10 @@ class Worker extends WorkerApi $this->workerLogin(1); $this->success('登录成功', $this->user); } + + public function logout() + { + $this->workerLogout(); + $this->success('操作成功'); + } }