chenjunkai 6 years ago
parent
commit
b86ee439e3
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Object/TokenObject.py

+ 5 - 1
Object/TokenObject.py

@@ -14,7 +14,7 @@
 from Ansjer.config import OAUTH_ACCESS_TOKEN_SECRET, OAUTH_REFRESH_TOKEN_SECRET, OAUTH_ACCESS_TOKEN_TIME, \
     OAUTH_REFRESH_TOKEN_TIME
 import jwt, time
-
+from Model.models import Device_User
 
 class TokenObject:
 
@@ -33,6 +33,10 @@ class TokenObject:
             res = jwt.decode(self.token, OAUTH_ACCESS_TOKEN_SECRET, algorithms='HS256')
             self.userID = res.get('userID', 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:
             print('过期')
             print(repr(e))