代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
"""
__author__ = 'peter'
__mtime__ = '2019-07-30'
# Follow the master,become a master.
┏┓ ┏┓
┏┛┻━━━━━━━┛┻┓
┃ ☃ ┃
┃ ┳┛ ┗┳ ┃
┃ ┻ ┃
┗━┓ ┏━┛
┃ ┗━━━━┓
┃ 神兽保佑 ┣┓
┃ 永无BUG! ┏┛
┗┓┓┏━━━┳┓┏━━━┛
┃┫┫ ┃┫┫
┗┻┛ ┗┻┛
"""
import redis
def get_uid_token(user_type, user_id):
"""
# 连接redis方法
:param user_id:
:param user_type:
:return:
"""
global redis_server
if user_type == 'f': # 前台app用户
db = 2
elif user_type == 'b': # 后台商铺用户
db = 4
elif user_type == 'a': # 主后台管理用户
db = 7
else:
return None
redis_server = redis.Redis(host=conf.rd_host, port=conf.rd_port, password=conf.rd_pwd, db=db)
if redis_server.get(user_id) is not None: # 判断是否有uid(登陆是否过期)
token = redis_server.get(user_id).decode() # 未过期将uid解码
else:
token = None
return token
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。