本文整理汇总了Python中helpers.queryhelper.QueryHelper.get_corp_by_gid方法的典型用法代码示例。如果您正苦于以下问题:Python QueryHelper.get_corp_by_gid方法的具体用法?Python QueryHelper.get_corp_by_gid怎么用?Python QueryHelper.get_corp_by_gid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.queryhelper.QueryHelper
的用法示例。
在下文中一共展示了QueryHelper.get_corp_by_gid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_terminal_new
# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_corp_by_gid [as 别名]
def delete_terminal_new(tid, db, redis, del_user=True):
"""Delete terminal from platform and clear the associated info.
"""
terminal = db.get("SELECT mobile, owner_mobile, group_id FROM T_TERMINAL_INFO"
" WHERE tid = %s", tid)
if not terminal:
logging.info("Terminal: %s already does not exist, do nothing.", tid)
return
else:
t_info = QueryHelper.get_terminal_basic_info(tid, db)
# NOTE: record the del action.
corp = QueryHelper.get_corp_by_gid(terminal.group_id, db)
bind_info = dict(tid=tid,
tmobile=terminal.mobile,
umobile=terminal.owner_mobile,
group_id=terminal.group_id,
cid=corp.get('cid', '') if corp else '',
del_time=int(time.time()))
record_del_action(bind_info, db)
WSPushHelper.pushS3(tid, db, redis, t_info)
clear_data(tid, db, redis)
logging.info("[PUBLIC] Delete Terminal: %s, tmobile: %s, umobile: %s",
tid, terminal.mobile, terminal.owner_mobile)
示例2: handle_new_login
# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_corp_by_gid [as 别名]
#.........这里部分代码省略.........
terminal_info = dict(tid=t_info['dev_id'],
group_id=group_id,
dev_type=t_info['dev_type'],
tmobile=t_info['t_msisdn'],
owner_mobile=t_info['u_msisdn'],
imsi=t_info['imsi'],
imei=t_info['imei'],
factory_name=t_info['factory_name'],
softversion=t_info['softversion'],
keys_num=t_info['keys_num'],
login=GATEWAY.TERMINAL_LOGIN.ONLINE,
service_status=UWEB.SERVICE_STATUS.ON,
mannual_status=mannual_status,
push_status=push_status,
icon_type=icon_type,
begintime=int(time.mktime(begintime.timetuple())),
endtime=4733481600,
offline_time=int(time.mktime(begintime.timetuple())),
cnum=cnum,
login_permit=login_permit,
bt_mac=t_info['bt_mac'],
bt_name=t_info['bt_name'],
vibl=vibl,
use_scene=use_scene,
biz_type=UWEB.BIZ_TYPE.YDWS,
alias=alias,
speed_limit=speed_limit,
stop_interval=stop_interval,
distance_current=distance_current)
add_terminal(terminal_info, db, redis)
# record the add action, enterprise or individual
corp = QueryHelper.get_corp_by_gid(group_id, db)
bind_info = dict(tid=t_info['dev_id'],
tmobile=t_info['t_msisdn'],
umobile=t_info['u_msisdn'],
group_id=group_id,
cid=corp.get('cid', '') if corp else '',
add_time=int(time.time()))
record_add_action(bind_info, db)
logging.info("[GW] Terminal JH success! tid: %s, mobile: %s.",
t_info['dev_id'], t_info['t_msisdn'])
# subscription LE for new sim
thread.start_new_thread(subscription_lbmp, (t_info,))
if args.success == GATEWAY.LOGIN_STATUS.SUCCESS:
# get SessionID
if resend_flag:
logging.warn("[GW] Recv resend login packet and use old sessionID! packet: %s, tid: %s, mobile: %s.",
t_info, t_info['dev_id'], t_info['t_msisdn'])
args.sessionID = QueryHelper.get_terminal_sessionID(t_info['dev_id'], redis)
if not args.sessionID:
args.sessionID = get_sessionID()
else:
#NOTE: generate a sessionid and keep it in redis.
args.sessionID = get_sessionID()
terminal_sessionID_key = get_terminal_sessionID_key(t_info['dev_id'])
redis.setvalue(terminal_sessionID_key, args.sessionID)
redis.setvalue(resend_key, True, GATEWAY.RESEND_EXPIRY)
# record terminal address
update_terminal_status(redis, t_info["dev_id"], address)
#NOTE: When termianl is normal login, update some properties to platform.
info = DotDict(login=GATEWAY.TERMINAL_LOGIN.ONLINE,
mobile=t_info['t_msisdn'],