本文整理汇总了Python中helpers.queryhelper.QueryHelper.get_corp_by_oid方法的典型用法代码示例。如果您正苦于以下问题:Python QueryHelper.get_corp_by_oid方法的具体用法?Python QueryHelper.get_corp_by_oid怎么用?Python QueryHelper.get_corp_by_oid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.queryhelper.QueryHelper
的用法示例。
在下文中一共展示了QueryHelper.get_corp_by_oid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_corp_by_oid [as 别名]
def get(self):
status=ErrorCode.SUCCESS
# from_ = self.get_argument('from', '').lower()
index_html = "index.html"
bizcode = None
name = ''
if self.current_user.oid != UWEB.DUMMY_OID: # operator
index_html = "index_corp.html"
umobile=self.current_user.oid
user_info = QueryHelper.get_operator_by_oid(self.current_user.oid, self.db)
corp_info = QueryHelper.get_corp_by_oid(self.current_user.oid, self.db)
if user_info:
name = user_info.name if user_info.name else user_info.mobile
user_type = UWEB.USER_TYPE.OPERATOR
bizcode = corp_info.bizcode
elif self.current_user.cid != UWEB.DUMMY_CID: # corp
index_html = "index_corp.html"
umobile=self.current_user.cid
user_info = QueryHelper.get_corp_by_cid(self.current_user.cid, self.db)
if user_info:
name = user_info.c_linkman if user_info.c_linkman else user_info.c_mobile
user_type = UWEB.USER_TYPE.CORP
bizcode = user_info.bizcode
else: # user
umobile=self.current_user.uid
user_info = QueryHelper.get_user_by_uid(self.current_user.uid, self.db)
if user_info:
name = user_info.name if user_info.name else user_info.mobile
user_type = UWEB.USER_TYPE.PERSON
if not user_info:
status = ErrorCode.LOGIN_AGAIN
logging.error("The user with uid: %s does not exist, redirect to login.html", self.current_user.uid)
self.render("login.html",
username='',
password='',
user_type=UWEB.USER_TYPE.PERSON,
message=None,
message_captcha=None)
return
static_hash = self.redis.get('static_hash')
static_hash = static_hash if static_hash else u'dummy_hash'
wspush = dict(id='',
key='')
json_data = WSPushHelper.register_wspush(umobile, self.redis)
if json_data:
data = json_data['data']
id = data.get('push_id', '')
key = data.get('psd', '')
wspush['id'] = id
wspush['key'] = key
self.render(index_html,
map_type=ConfHelper.LBMP_CONF.map_type,
user_type=user_type,
bizcode=bizcode,
status=status,
name=name,
umobile=umobile,
static_hash=static_hash,
wspush=wspush,)