UserService.php 572 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Services\api;
  3. use App\Authority;
  4. use App\Owner;
  5. use App\User;
  6. use Firebase\JWT\JWT;
  7. use Illuminate\Support\Facades\Cache;
  8. use Illuminate\Support\Facades\Gate;
  9. use App\Traits\ServiceAppAop;
  10. class UserService
  11. {
  12. public function getUser($jwt)
  13. {
  14. $alg =
  15. [
  16. "typ" => "JWT", //声明类型为jwt
  17. "alg" => "HS256" //声明签名算法为SHA256
  18. ];
  19. // $key = env('JWT_SECRET');
  20. $key = config('weiXin.jwt.JWT_SECRET');
  21. return JWT::decode($jwt,$key,$alg);
  22. }
  23. }