37 lines
806 B
PHP
37 lines
806 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Wx;
|
|
|
|
use App\BaseApp\BaseController;
|
|
use App\Service\wx\WxAuthService;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
/**
|
|
* 小程序登录(免鉴权)
|
|
*/
|
|
class AuthController extends BaseController
|
|
{
|
|
/**
|
|
* 继承的 CRUD 会被 autoRouteRegister 反射成路由,登录组里绝不能白送这些
|
|
*/
|
|
protected array $exceptRoute = ['list', 'option', 'detail', 'create', 'update', 'delete'];
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->service = WxAuthService::getInstance();
|
|
}
|
|
|
|
/**
|
|
* 微信 code 登录
|
|
* @Method POST
|
|
*/
|
|
public function login(): JsonResponse
|
|
{
|
|
return jok(
|
|
$this->service->login(request()->post()),
|
|
'登录成功'
|
|
);
|
|
}
|
|
}
|