feat: 退出登录接口

This commit is contained in:
gcd 2025-03-29 14:19:40 +08:00
parent 578e38b99a
commit 9859f06672
2 changed files with 15 additions and 0 deletions

View File

@ -207,6 +207,15 @@ class WorkerApi extends BaseService
return true; return true;
} }
public function workerLogout(): bool
{
if ($this->token) {
Token::delete($this->token);
}
return true;
}
/** /**
* 验证数据 * 验证数据
* @access protected * @access protected

View File

@ -46,4 +46,10 @@ class Worker extends WorkerApi
$this->workerLogin(1); $this->workerLogin(1);
$this->success('登录成功', $this->user); $this->success('登录成功', $this->user);
} }
public function logout()
{
$this->workerLogout();
$this->success('操作成功');
}
} }