1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-29 05:41:37 +08:00
xiaochong0302 43adee9ceb 1.重写view provider,数组赋值自动转对象
2.重写response provider,优化json输出格式
2020-04-25 18:36:32 +08:00

45 lines
784 B
PHP

<?php
namespace App\Services\Auth;
use App\Models\User as UserModel;
use App\Services\Auth as AuthService;
class Html5 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 'h5_auth_info';
}
}