mirror of
https://gitee.com/ctexthuang/hyperf-micro-svc.git
synced 2026-02-08 10:20:16 +08:00
47 lines
895 B
PHP
47 lines
895 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\Common\Interface\LoginInterface;
|
|
use App\Lib\Log\Logger;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
|
|
abstract class AbstractLoginService implements LoginInterface
|
|
{
|
|
/**
|
|
* @var Logger
|
|
*/
|
|
#[Inject]
|
|
protected Logger $logger;
|
|
|
|
/**
|
|
* @param string $identifier
|
|
* @return void
|
|
*/
|
|
protected function logAttempt(string $identifier): void
|
|
{
|
|
$this->logger->request()->info(
|
|
sprintf('[%s] Login Attempt by %s',
|
|
static::class,
|
|
$identifier
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
protected function validateCredentials(array $data): bool
|
|
{
|
|
return !empty($data);
|
|
}
|
|
} |