Files
hyperf_service/app/Service/Api/Login/LoginService.php
2024-11-12 11:02:38 +08:00

36 lines
844 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()
{
$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);
}
}