mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 12:23:06 +08:00
45 lines
789 B
PHP
45 lines
789 B
PHP
<?php
|
|
|
|
namespace App\Services\Auth;
|
|
|
|
use App\Models\User as UserModel;
|
|
use App\Services\Auth as AuthService;
|
|
|
|
class Mobile extends AuthService
|
|
{
|
|
|
|
public function saveAuthInfo(UserModel $user)
|
|
{
|
|
$authKey = $this->getAuthKey();
|
|
|
|
$authInfo = [
|
|
'id' => $user->id,
|
|
'name' => $user->name,
|
|
];
|
|
|
|
$this->session->set($authKey, $authInfo);
|
|
}
|
|
|
|
public function clearAuthInfo()
|
|
{
|
|
$authKey = $this->getAuthKey();
|
|
|
|
$this->session->remove($authKey);
|
|
}
|
|
|
|
public function getAuthInfo()
|
|
{
|
|
$authKey = $this->getAuthKey();
|
|
|
|
$authInfo = $this->session->get($authKey);
|
|
|
|
return $authInfo ?: null;
|
|
}
|
|
|
|
public function getAuthKey()
|
|
{
|
|
return 'mobile_auth_info';
|
|
}
|
|
|
|
}
|