44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Request\LoginRequest;
|
|
use App\Services\LoginService;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
/**
|
|
* 登陆
|
|
*/
|
|
class LoginController extends AbstractController
|
|
{
|
|
/**
|
|
* 微信手机号登陆
|
|
* @return ResponseInterface
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
public function wechatMobileLogin(): ResponseInterface
|
|
{
|
|
// 验证参数
|
|
$request = $this->container->get(LoginRequest::class);
|
|
$request->scene('wechatMobileLogin')->validateResolved();
|
|
|
|
$LoginService = new LoginService();
|
|
$data = $LoginService->wechatMobileLogin();
|
|
return $this->response->json($data);
|
|
}
|
|
|
|
// 手机号登陆
|
|
public function mobileLogin(): ResponseInterface
|
|
{
|
|
// 验证参数
|
|
$request = $this->container->get(LoginRequest::class);
|
|
$request->scene('mobileLogin')->validateResolved();
|
|
|
|
$LoginService = new LoginService();
|
|
$data = $LoginService->mobileLogin();
|
|
return $this->response->json($data);
|
|
}
|
|
} |