初始化提交
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Request\CodeRequest;
|
||||
use App\Services\CodeService;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class CodeController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* 获取手机号验证码
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getPhoneCode(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(CodeRequest::class);
|
||||
$request->scene('getPhoneCode')->validateResolved();
|
||||
|
||||
$CodeService = new CodeService();
|
||||
|
||||
$data = fail();
|
||||
|
||||
$scene = $this->request->input('scene');
|
||||
switch ($scene) {
|
||||
case 1:
|
||||
// 登陆
|
||||
$data = $CodeService->getLoginPhoneCode();
|
||||
break;
|
||||
|
||||
default:
|
||||
// code...
|
||||
break;
|
||||
}
|
||||
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user