|
@@ -220,36 +220,6 @@ class CommonService:
|
|
|
val = request_dict.get(key, None)
|
|
|
return val
|
|
|
|
|
|
- @staticmethod
|
|
|
- def get_userID_byT(token):
|
|
|
- if token == 'stest':
|
|
|
- userID = '151547867345163613800138001'
|
|
|
- # var_dump(userID)
|
|
|
- return userID
|
|
|
- if token == 'sformal':
|
|
|
- userID = '151564262337939513800138001'
|
|
|
- return userID
|
|
|
- try:
|
|
|
- access_token = token[::-1]
|
|
|
- if len(access_token) < 18:
|
|
|
- return None
|
|
|
- atoken = access_token[:12] + access_token[18:]
|
|
|
- try:
|
|
|
- token_str = base64.urlsafe_b64decode(atoken).decode('utf-8')
|
|
|
- except Exception as e:
|
|
|
- print('base64 decode error: %s' % repr(e))
|
|
|
- else:
|
|
|
- token_list = token_str.split('&')
|
|
|
- if len(token_list) != 2:
|
|
|
- return None
|
|
|
- ts_str = token_list[0]
|
|
|
- jsonDict = json.loads(ts_str)
|
|
|
- userID = jsonDict.get('userID', None)
|
|
|
- except Exception as e:
|
|
|
- return None
|
|
|
- else:
|
|
|
- return userID
|
|
|
-
|
|
|
@staticmethod
|
|
|
def req_path(request, ssl=False):
|
|
|
get_host = request.get_host() # 获取请求地址
|