Exemple #1
0
def cominfobydomain(prama):
	"""根据公司三级域名获取对应的信息	
	Args:
		prama: dict type
			domain: string type 
				example: "gbmy783"
			fields: string type table's fields  default "id,com_name,domain"
				example: "id,field1,field2,..." 
	Return:
		list type 
			[0, list datainfo]
			datainfo: table row data fetched 
				example:[{field1:value1,..},{field1,value1,...},...]
	Raises:
			[int errcode,string errinfo]	
	"""
	kw={}
	fields 			= prama.get('fields','id,com_name,domain')
	domain			= prama.get('domain','')
	if not domain :
		return -6,"parameter domain not set."
	kw['table'] 	= 'com_prod'
	kw['fields'] 	= fields
	kw['where'] = "domain='%s'" % domain
	res,cominfo=biz72_product.query(kw)
	if res == 0 and cominfo:
		desc = []
		desc.append(cominfo[0])
		return desc
	return res,cominfo
Exemple #2
0
def prodinfobycomid(prama):
	"""根据公司ID获取产品列表
	Args:
		prama: dict type
			comid: string type 
				example: "1,2,3,..."
			page: int type default 1
			pageSize: int type default 20
			fields: string type table's fields  default "id,com_name,com_id,title"
				example: "id,field1,field2,..." 
			where: string type sql where syntax
				example:  "id=1 and status=1 ..."
			order: string type sql order by syntax
				example: "field desc/asc"
	Return:
		list type 
			[0, list datainfo]
			datainfo: table row data fetched 
				example:[{field1:value1,..},{field1,value1,...},...]
	Raises:
			[int errcode,string errinfo]
	"""
	kw={}
	fields 			= prama.get('fields','id,com_name,com_id,title')
	comid			= prama.get('comid','')
	where			= prama.get('where')
	order			= prama.get('order','')
	if not comid :	return -6,"parameter comid not set."
	kw['table'] 	= 'pro_info'
	kw['order']		= order
	kw['fields'] 	= fields
	kw['where'] 	= "com_name='%s'" % comid
	if where: kw['where'] = "%s and %s" %(kw['where'],where)
	return biz72_product.query(kw)
Exemple #3
0
def prodinfobyid(prama):
	"""根据id取产品记录
	Args:
		prama: dict type
			id: string type 
				example: "1,2,3 ....."
			fields: string type table's fields  default "id,com_name"
				example: "id,field1,field2,..." 
	Return:
		list type 
			[0, list datainfo]
			datainfo: table row data fetched 
				example:[{field1:value1,..},{field1,value1,...},...]
	Raises:
			[int errcode,string errinfo]
	"""
	fields	= prama.get('fields','id,com_name')
	id		= prama.get('id','')
	if not id :
		return -6,"parameter id not set."
	kw		={}
	kw['table'] = 'com_prod'
	kw['fields'] = fields
	kw['where'] = 'id in (%s)' % id
	return biz72_product.query(kw)
Exemple #4
0
def cominfobyuseridone(prama):
	"""根据用户id获取公司的信息(单条信息)
	Args:
		prama: dict type
			userid: int type 
			fields: string type table's fields  default "id,com_name,domain,user_id"
				example: "id,field1,field2,..." 
	Return:
		list type 
			[0, list datainfo]
			datainfo: table row data fetched 
				example:[{field1:value1,..},{field1,value1,...},...]
	Raises:
			[int errcode,string errinfo]
	"""
	kw={}
	fields 			= prama.get('fields','id,com_name,domain,user_id')
	userid			= prama.get('userid',0)
	if not userid :
		return -6,"parameter userid not set."
	kw['table'] 	= 'com_prod'
	kw['fields'] 	= fields
	kw['where'] = "user_id=%s" % userid
	res,cominfo=biz72_product.query(kw)
	if res == 0 and cominfo:
		desc = []
		desc.append(cominfo[0])
		return desc
	return res,cominfo
Exemple #5
0
def commaxid(prama):
	"""获取公司的最大ID
	Args:
	Return:
		list type 
			[0, int maxid]
	Raises:
			[int errcode,string errinfo]	
	"""
	kw={}
	fields 			= "max(id) as mid"
	if not userid :
		return -6,"parameter userid not set."
	kw['table'] 	= 'com_prod'
	kw['fields'] 	= fields
	res, desc = biz72_product.query(kw)
	if res == 0 and desc:
		return 0,desc[0]['mid']
	return res,desc