本文整理汇总了Python中helpers.queryhelper.QueryHelper.get_sms_option方法的典型用法代码示例。如果您正苦于以下问题:Python QueryHelper.get_sms_option方法的具体用法?Python QueryHelper.get_sms_option怎么用?Python QueryHelper.get_sms_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.queryhelper.QueryHelper
的用法示例。
在下文中一共展示了QueryHelper.get_sms_option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_sms_option [as 别名]
def get(self):
"""Display smsoption of current user.
"""
status = ErrorCode.SUCCESS
try:
terminals = self.db.query("SELECT tt.mobile, tt.owner_mobile"
" FROM T_TERMINAL_INFO as tt, "
" T_GROUP as tg, T_CORP as tc"
" WHERE tt.service_status = 1 AND tc.cid = %s "
" AND tc.cid = tg.corp_id AND tt.group_id = tg.id",
self.current_user.cid)
mobiles = []
for terminal in terminals:
if terminal.owner_mobile not in mobiles:
mobiles.append(terminal.owner_mobile)
sms_options = {}
for mobile in mobiles:
sms_option = QueryHelper.get_sms_option(mobile, self.db)
sms_options[mobile] = sms_option
self.write_ret(status,
dict_=dict(sms_options=sms_options))
except Exception as e:
logging.exception("[UWEB] uid:%s tid:%s get SMS Options failed. Exception: %s", e.args)
status = ErrorCode.SERVER_BUSY
self.write_ret(status)
示例2: get
# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_sms_option [as 别名]
def get(self):
"""Get terminal info.
"""
status = ErrorCode.SUCCESS
try:
tid = self.get_argument('tid', None)
# check tid whether exist in request and update current_user
self.check_tid(tid)
# part 1: terminal
tracker = DotDict()
# 1: terminal
# NOTE: static_val, move_val are deprecated
terminal = QueryHelper.get_available_terminal(
self.current_user.tid, self.db)
if not terminal:
status = ErrorCode.LOGIN_AGAIN
logging.error("The terminal with tid: %s does not exist, redirect to login.html",
self.current_user.tid)
self.write_ret(status)
return
# 撤防,智能设防
if terminal['mannual_status'] != UWEB.DEFEND_STATUS.YES:
terminal['parking_defend'] = 1
else: # 强力设防
terminal['parking_defend'] = 0
# 2: sos is deprecatd
user = QueryHelper.get_user_by_uid(self.current_user.uid, self.db)
if not user:
status = ErrorCode.LOGIN_AGAIN
logging.error("The user with uid: %s does not exist, redirect to login.html",
self.current_user.uid)
self.write_ret(status)
return
sos = dict(mobile='')
tracker.update(sos)
tracker.update(dict(push_status=terminal.push_status))
tracker.update(dict(sos_pop=terminal.white_pop))
tracker.update(dict(vibl=terminal.vibl))
tracker.update(dict(static_val=terminal.static_val))
tracker.update(dict(parking_defend=terminal.parking_defend))
tracker.update(dict(owner_mobile=terminal.owner_mobile))
tracker.update(dict(speed_limit=terminal.speed_limit))
# part 2: profile
profile = DotDict()
car = QueryHelper.get_car_by_tid(self.current_user.tid, self.db)
profile.update(dict(name=user.name,
mobile=user.mobile,
email=user.email,
cnum=car.cnum))
# part 3: sms option
sms_options = QueryHelper.get_sms_option(user.mobile, self.db)
# part 5: corp info
corp = DotDict()
corp = QueryHelper.get_corp_by_cid(self.current_user.cid, self.db)
self.write_ret(status,
dict_=dict(tracker=tracker,
sms_options=sms_options,
profile=profile,
corp=corp))
except Exception as e:
status = ErrorCode.SERVER_BUSY
logging.exception("[UWEB] Get appsetting failed. uid: %s tid: %s, Exception: %s",
self.current_user.uid, self.current_user.tid, e.args)
self.write_ret(status)