当前位置: 首页>>代码示例>>Python>>正文


Python UserDao.get_user_by_token方法代码示例

本文整理汇总了Python中dao.UserDao.get_user_by_token方法的典型用法代码示例。如果您正苦于以下问题:Python UserDao.get_user_by_token方法的具体用法?Python UserDao.get_user_by_token怎么用?Python UserDao.get_user_by_token使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dao.UserDao的用法示例。


在下文中一共展示了UserDao.get_user_by_token方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: resp

# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_user_by_token [as 别名]
def resp(token, did):
	user = UserDao.get_user_by_token(token)
	if not user: return RESPONSE.WRONG_TOKEN
	devices = DeviceDao.get_devices_by_user(user)
	for device in devices:
		if device['did'] == did:
			#TODO 需要进行一些数据清理工作
			return RESPONSE.SUCCESS
	return RESPONSE.WRONG_DID
开发者ID:wh1100717,项目名称:poly_emm,代码行数:11,代码来源:AndroidDao.py

示例2: update

# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_user_by_token [as 别名]
def update(token,did,loc_info):
	user = UserDao.get_user_by_token(token)
	if not user: return {'status':0, 'desc':'wrong token'}
	device_loc = LocCollection.find_one({'did':did})
	if device_loc:
		device_loc['loc_info'].append(loc_info)
	else:
		device_loc = {
			'did':did,
			'loc_info': loc_info
		}
	LocCollection.update({'did':did}, device_loc, upsert=True)
	return {'status':1}
开发者ID:wh1100717,项目名称:poly_emm,代码行数:15,代码来源:LocDao.py

示例3: pull

# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_user_by_token [as 别名]
def pull(token, did):
	user = UserDao.get_user_by_token(token)
	if not user: return RESPONSE.WRONG_TOKEN
	devices = DeviceDao.get_devices_by_user(user)
	for device in devices:
		if device['did'] == did:

			#TODO 需要将具体的信息返回回去
			RESPONSE.PULL_SUCCESS['data'] = device['pull_info']
			device['pull_info']=[]
			UserCollection.update({'token':user['token']},user)
			return RESPONSE.PULL_SUCCESS
	return RESPONSE.WRONG_DID
开发者ID:wh1100717,项目名称:poly_emm,代码行数:15,代码来源:AndroidDao.py

示例4: initial

# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_user_by_token [as 别名]
def initial(token,phone,did,cid,imei):
	user = UserDao.get_user_by_token(token)
	if not user: return RESPONSE.WRONG_TOKEN
	devices = DeviceDao.get_devices_by_user(user)
	for device in devices:
		if device['phone'] == phone:
			device['did'] = did
			device['cid'] = cid
			device['imei'] = imei
			UserCollection.update({'tid':user['tid']},user)
			#TODO 需要增加client对初始化配置信息
			RESPONSE.INITIAL_SUCCESS['initial'] = {}
			return RESPONSE.INITIAL_SUCCESS
	return RESPONSE.WRONG_PHONE
开发者ID:wh1100717,项目名称:poly_emm,代码行数:16,代码来源:AndroidDao.py

示例5: test_get_user_by_token

# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_user_by_token [as 别名]
def test_get_user_by_token():
	user = UserDao.get_user_by_email(email)
	user2 = UserDao.get_user_by_token(user['token'])
	assert user2['email'] == email
开发者ID:wh1100717,项目名称:poly_emm,代码行数:6,代码来源:TestDao.py


注:本文中的dao.UserDao.get_user_by_token方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。