本文整理汇总了Python中helpers.queryhelper.QueryHelper.get_tmobile_by_tid方法的典型用法代码示例。如果您正苦于以下问题:Python QueryHelper.get_tmobile_by_tid方法的具体用法?Python QueryHelper.get_tmobile_by_tid怎么用?Python QueryHelper.get_tmobile_by_tid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.queryhelper.QueryHelper
的用法示例。
在下文中一共展示了QueryHelper.get_tmobile_by_tid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: issue_cellid
# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_tmobile_by_tid [as 别名]
def issue_cellid(location, db, redis):
logging.info("[LBMPHELPER] %s Issue cellid...", location.dev_id)
location.gps = 0
location.type = 1
location.degree = random.randint(0, 360)
# 1: get latlon through cellid
cellid_info = [int(item) for item in location.cellid.split(":")]
#NOTE: Check version of terminal: If version if 2.3.x, do not issue cellid
terminal = db.get("SELECT id, tid, mobile, softversion FROM T_TERMINAL_INFO WHERE tid = %s", location.dev_id)
if terminal and str(terminal['softversion'][0:3]) == '2.3':
logging.info("[LBMPHELPER] %s softversion: %s is 2.3.x, do not issue cellid", location.dev_id, terminal['softversion'])
location.lat, location.lon = 0, 0
elif terminal and str(terminal['softversion'][0:5]) == '2.6.3':
logging.info("[LBMPHELPER] %s softversion: %s is 2.6.3, do not issue cellid", location.dev_id, terminal['softversion'])
location.lat, location.lon = 0, 0
else:
sim = QueryHelper.get_tmobile_by_tid(location.dev_id, redis, db)
location.lat, location.lon = get_latlon_from_cellid(cellid_info[0],cellid_info[1],cellid_info[2],cellid_info[3], sim)
logging.info("[LBMPHELPER] %s cellid result, lat:%s, lon:%s", location.dev_id, location.lat, location.lon)
return location