Logout.php 546 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * Created by PhpStorm
  4. * User:林志杰
  5. * Email:[email protected]
  6. * Motto:纵有疾风起,人生不言弃!
  7. * Time:2020/2/9 1:10
  8. */
  9. namespace app\api\controller;
  10. class Logout extends AuthBase
  11. {
  12. public function index()
  13. {
  14. // 删除 redis token 缓存
  15. $res = cache(config('redis.token_pre') . $this->accessToken, null);
  16. if ($res) {
  17. return show(config('status.success'), '退出登陆成功');
  18. }
  19. return show(config('status.error'), '退出登陆失败');
  20. }
  21. }