2020-11-04 11:57:16 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Controller\Api\V1;
|
|
|
|
|
|
|
|
use App\Controller\AbstractController;
|
2020-11-05 17:40:51 +08:00
|
|
|
use App\Support\Http\Response;
|
2020-11-04 16:47:17 +08:00
|
|
|
use Hyperf\Di\Annotation\Inject;
|
2020-11-04 22:58:49 +08:00
|
|
|
use Phper666\JWTAuth\JWT;
|
2020-11-04 11:57:16 +08:00
|
|
|
|
2020-11-04 16:47:17 +08:00
|
|
|
/**
|
|
|
|
* 基类控制器
|
|
|
|
*
|
|
|
|
* Class CController
|
|
|
|
* @package App\Controller\Api\V1
|
|
|
|
*/
|
2020-11-04 11:57:16 +08:00
|
|
|
class CController extends AbstractController
|
|
|
|
{
|
2020-11-04 16:47:17 +08:00
|
|
|
/**
|
|
|
|
* @Inject
|
|
|
|
* @var Response
|
|
|
|
*/
|
|
|
|
protected $response;
|
2020-11-04 22:58:49 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取当前登录用户ID
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function uid(){
|
|
|
|
$data = container()->get(JWT::class)->getParserData();
|
|
|
|
return $data['user_id'];
|
|
|
|
}
|
2020-11-04 11:57:16 +08:00
|
|
|
}
|