diff --git a/catch/login/controller/Index.php b/catch/login/controller/Index.php index 37cb745..62f93ff 100644 --- a/catch/login/controller/Index.php +++ b/catch/login/controller/Index.php @@ -7,6 +7,7 @@ use catcher\base\CatchController; use catcher\CatchAuth; use catcher\CatchResponse; use catcher\exceptions\LoginFailedException; +use thans\jwt\facade\JWTAuth; class Index extends CatchController { @@ -55,4 +56,19 @@ class Index extends CatchController { return CatchResponse::success(); } + + /** + * refresh token + * + * @author JaguarJack + * @email njphper@gmail.com + * @time 2020/5/18 + * @return \think\response\Json + */ + public function refreshToken() + { + return CatchResponse::success([ + 'token' => JWTAuth::refresh() + ]); + } } diff --git a/catch/login/route.php b/catch/login/route.php index 3a7237e..70e623b 100644 --- a/catch/login/route.php +++ b/catch/login/route.php @@ -2,4 +2,5 @@ # 登入 $router->post('login', '\catchAdmin\login\controller\Index@login'); $router->post('logout', '\catchAdmin\login\controller\Index@logout'); +$router->post('refresh/token', '\catchAdmin\login\controller\Index@refreshToken');