mirror of
https://gitee.com/ctexthuang/hyperf-micro-svc.git
synced 2026-02-08 10:20:16 +08:00
feat : login first
This commit is contained in:
43
app/Service/Api/Login/LoginService.php
Normal file
43
app/Service/Api/Login/LoginService.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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\Service\Api\BaseApiService;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class LoginService extends BaseApiService
|
||||
{
|
||||
/**
|
||||
* @var LoginFactory
|
||||
*/
|
||||
#[Inject]
|
||||
protected LoginFactory $loginFactory;
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function handle(): array
|
||||
{
|
||||
try {
|
||||
$type = '1';
|
||||
$username= '1';
|
||||
$password = '1';
|
||||
$res = $this->loginFactory->get($type)->authenticate($username, $password);
|
||||
return ['success'];
|
||||
} catch (\Exception $e) {
|
||||
return ['error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user