def add_qbuy_order(order_num, user_id): # 抢单成功 # 将用户ID和订单号存入到redis缓存中 # 抢单如果限制时间,存的时间 # rd.set(order_num, user_id) # 限量或限时间 if not rd.exists('qbuy_order') or rd.hlen('qbuy_order') < 100: rd.hset('qbuy_order', order_num, user_id)
def check_token(token): # 验证token return rd.exists(token)