feat : login wx
This commit is contained in:
36
app/Service/Api/Login/LoginService.php
Normal file
36
app/Service/Api/Login/LoginService.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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\AdminException;
|
||||
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 AdminException('登录类型错误'),
|
||||
};
|
||||
|
||||
$loginInfo = $service->handle();
|
||||
|
||||
return $this->return->success('登录成功',$loginInfo);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user