aozhiwei ea36ad4705 1
2020-03-06 13:00:52 +08:00

35 lines
838 B
Python

# -*- coding: utf-8 -*-
#!/usr/bin/python
import os
from .app import instance as i_app
from .timer import instance as i_timer
from .udplog import instance as i_udplog
app = i_app()
udplog = i_udplog()
timer = i_timer()
def isOnlineEnv():
return not os.getenv("SERVER_ENV");
def scanRedisKey(conn, pattern):
result = {}
cursor, keys = conn.scan(0, pattern, 1000)
while cursor != 0 or len(keys) > 0:
for key in keys:
if key in result:
result[key] += result[key]
else:
result[key] = 0
keys = []
if cursor != 0:
cursor, keys = conn.scan(cursor, pattern, 1000)
return result
def getChannelByAccountId(account_id):
tmp_strings = account_id.split('_')
if len(tmp_strings) < 3:
return 0
return tmp_strings[0]