Token.php 813 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace app\common\facade;
  3. use think\Facade;
  4. use app\common\library\token\Driver;
  5. /**
  6. * Token 门面类
  7. * @see Driver
  8. * @method array get(string $token) static 获取 token 的数据
  9. * @method bool set(string $token, string $type, int $userId, int $expire = null) static 设置 token
  10. * @method bool check(string $token, string $type, int $userId) static 检查token是否有效
  11. * @method bool delete(string $token) static 删除一个token
  12. * @method bool clear(string $type, int $userId) static 清理一个用户的所有token
  13. * @method void tokenExpirationCheck(array $token) static 检查一个token是否过期,过期则抛出token过期异常
  14. */
  15. class Token extends Facade
  16. {
  17. protected static function getFacadeClass(): string
  18. {
  19. return 'app\common\library\Token';
  20. }
  21. }