當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。