You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
1.0 KiB

<?php
namespace App\Service\v3\Implementations;
use App\Constants\v3\ErrorCode;
use App\Exception\ErrorCodeException;
use App\Model\v3\StoreUsers;
use App\Service\v3\Interfaces\StoreLoginServiceInterface;
class StoreLoginService implements StoreLoginServiceInterface
{
public function do($account,$password)
{
$storeUsersModel = StoreUsers::query()->where('username',$account)->first();
$password = $this->stringHash($password,$storeUsersModel->salt);
if($storeUsersModel->password === $password){
return $storeUsersModel;
}else{
throw new ErrorCodeException(ErrorCode::STORE_LOGIN_ERROR);
}
}
public function check()
{
// TODO: Implement check() method.
}
public function undo()
{
// TODO: Implement undo() method.
}
function stringHash($password,$salt)
{
$authkey = config('lgoin.authkey');
$password = "{$password}-{$salt}-{$authkey}";
return sha1($password);
}
}