| | |
| | | # 数据处理 |
| | | import decimal |
| | | import json |
| | | import logging |
| | | import time as t |
| | | import random |
| | | import datetime |
| | | |
| | | import authority |
| | | import mysql |
| | | import redis_manager |
| | | import gpcode_manager |
| | |
| | | |
| | | |
| | | def parseType(str): |
| | | dict = json.loads(str) |
| | | return dict["type"] |
| | | try: |
| | | dict = json.loads(str) |
| | | return dict["type"] |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | return -1 |
| | | |
| | | |
| | | def parseGPCode(str): |
| | |
| | | redis.setex("client-active-{}".format(client_id), 10, host) |
| | | |
| | | |
| | | def getValidClients(): |
| | | def getValidL2Clients(): |
| | | redis = __redisManager.getRedis(); |
| | | keys = redis.keys("client-active-*") |
| | | client_ids = [] |
| | | for k in keys: |
| | | _id = k.split("client-active-")[1] |
| | | client_ids.append(_id) |
| | | return client_ids |
| | | l2_clients = authority.get_l2_clients() |
| | | |
| | | return list(set(client_ids).intersection(set(l2_clients))) |
| | | |
| | | |
| | | def getActiveClientIP(client_id): |