36 lines
851 B
PHP
36 lines
851 B
PHP
<?php
|
|
/**
|
|
* This service file is part of item.
|
|
*
|
|
* @author ctexthuang
|
|
* @contact ctexthuang@qq.com
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Service\Api\Login;
|
|
|
|
use App\Exception\ErrException;
|
|
use App\Service\Api\BaseService;
|
|
|
|
class LoginService extends BaseService
|
|
{
|
|
protected string $loginType = '';
|
|
|
|
public function handle(): array
|
|
{
|
|
$this->loginType = $this->request->input('login_type','');
|
|
|
|
$factory = new LoginTypeFactory();
|
|
$service = match ($this->request->input('login_type',''))
|
|
{
|
|
'wx_login' => $factory->wxFastLogin(),
|
|
'mobile_code' => $factory->mobileCodeLogin(),
|
|
default => throw new ErrException('登录类型错误'),
|
|
};
|
|
|
|
$loginInfo = $service->handle();
|
|
|
|
return $this->return->success('登录成功',$loginInfo);
|
|
}
|
|
} |