Index.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\api\controller;
  4. use app\api\validate\IndexValidate;
  5. use app\common\BaseController;
  6. use app\common\Redis;
  7. use app\common\Request;
  8. use app\common\Token;
  9. use Curl\Curl;
  10. use GuzzleHttp\Client;
  11. use think\App;
  12. use think\facade\Db;
  13. class Index extends BaseController
  14. {
  15. public function __construct()
  16. {
  17. parent::__construct();
  18. $this->client = new Client();
  19. $this->curl = new Curl();
  20. }
  21. public function hello(Request $request)
  22. {
  23. (new IndexValidate())->goCheck($request->param(),'phone');
  24. return '123';
  25. }
  26. public function test()
  27. {
  28. $user = [
  29. 'id' => 1,
  30. 'phone' => '12345678910'
  31. ];
  32. //$re = \app\common\Token::getToken($user);
  33. //$re = \app\common\Token::getClientToken($user);
  34. //$re = \app\common\Token::refreshToken($user);
  35. // $re = Token::getTokenValue($token);
  36. $token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0cDYiLCJpYXQiOjE2MjAzNjk5NDcsImV4cCI6MTYyMDM3NzE0NywidXNlciI6eyJpZCI6MSwicGhvbmUiOiIxMjM0NTY3ODkxMCJ9fQ.err2aBVOeqTLnrpQ8p59BRNjKg95UJ-kAs7ktYP-VJI';
  37. //$re = $this->redis->hSet('check_token_phone',$user['phone'],$token);
  38. $re = $this->redis->hDel('check_token_phone',$user['phone']);
  39. dd($re);
  40. }
  41. }