|
@@ -14,7 +14,7 @@
|
|
from Ansjer.config import OAUTH_ACCESS_TOKEN_SECRET, OAUTH_REFRESH_TOKEN_SECRET, OAUTH_ACCESS_TOKEN_TIME, \
|
|
from Ansjer.config import OAUTH_ACCESS_TOKEN_SECRET, OAUTH_REFRESH_TOKEN_SECRET, OAUTH_ACCESS_TOKEN_TIME, \
|
|
OAUTH_REFRESH_TOKEN_TIME
|
|
OAUTH_REFRESH_TOKEN_TIME
|
|
import jwt, time
|
|
import jwt, time
|
|
-
|
|
|
|
|
|
+from Model.models import Device_User
|
|
|
|
|
|
class TokenObject:
|
|
class TokenObject:
|
|
|
|
|
|
@@ -33,6 +33,10 @@ class TokenObject:
|
|
res = jwt.decode(self.token, OAUTH_ACCESS_TOKEN_SECRET, algorithms='HS256')
|
|
res = jwt.decode(self.token, OAUTH_ACCESS_TOKEN_SECRET, algorithms='HS256')
|
|
self.userID = res.get('userID', None)
|
|
self.userID = res.get('userID', None)
|
|
self.lang = res.get('lang', None)
|
|
self.lang = res.get('lang', None)
|
|
|
|
+ # 刷新登录时间
|
|
|
|
+ device_user = Device_User.objects.get(userID=self.userID)
|
|
|
|
+ device_user.online = True
|
|
|
|
+ device_user.save()
|
|
except jwt.ExpiredSignatureError as e:
|
|
except jwt.ExpiredSignatureError as e:
|
|
print('过期')
|
|
print('过期')
|
|
print(repr(e))
|
|
print(repr(e))
|