|
|
@@ -11,26 +11,7 @@ class MysqlAdapter
|
|
|
{
|
|
|
private UserToken $usertoken;
|
|
|
|
|
|
- public function ddddd()
|
|
|
- {
|
|
|
-
|
|
|
- $time=time();
|
|
|
- $usertoken=UserToken::where(function ($query) use ($token,$time){
|
|
|
- $token=md5($token);
|
|
|
- $query->where('token','=',$token);
|
|
|
- $query->where('expire','>',$time);
|
|
|
- })->withJoin('user','right')->find();
|
|
|
- if($usertoken){
|
|
|
- $auth=Config::get('site.auth');
|
|
|
- //当登陆时间小于保持登陆时间的一半时,自动续时
|
|
|
- if($auth['keepalive'] && $usertoken->expire-$time<$auth['keepalive_time']/2){
|
|
|
- $usertoken->expire=$time+$auth['keepalive_time'];
|
|
|
- $usertoken->save();
|
|
|
- }
|
|
|
- $usertoken->token=$token;
|
|
|
- $this->usertoken=$usertoken;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public static function userinfo(string $token):int
|
|
|
{
|