123456789101112131415161718192021222324252627 |
- <?php
- /**
- * Author: luzheng.liu
- * Time: 2020/8/26 14:50
- */
- namespace app\index\controller;
- use app\index\BaseController;
- use app\index\exception\ApiException;
- use app\common\until\Until;
- use Firebase\JWT\JWT;
- class Token {
- public function getToken($userId = '') {
- if (empty($userId)){
- $id = input('visitor') ?: random_int(100000,999999);
- }else{
- $id = $userId;
- }
- $tokenService = new \app\common\until\Token();
- $token = $tokenService->getToken($id,uniqid('visitor',false));
- Until::output(['token' => $token]);
- }
- }
|