40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
async def get_hotshow(ns):
|
|
"""
|
|
展示热门产品
|
|
"""
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
list1 = []
|
|
product = await sor.R('product', {'hotshow': '0'})
|
|
for i in product:
|
|
ditc1 = {}
|
|
if i['providerpid'][:2] == 'jd':
|
|
ditc1['type'] = 'jd'
|
|
elif i['providerpid'][:2] == 'ba':
|
|
ditc1['type'] = 'bd'
|
|
ditc1['product_name'] = i['name']
|
|
ditc1['description'] = i['description']
|
|
if i['label'] != None:
|
|
str2 = i['label'].split(',')
|
|
ditc1['tags'] = str2
|
|
else:
|
|
ditc1['tags'] = i['label']
|
|
list1.append(ditc1)
|
|
list1[0]['discount'] = '7.8'
|
|
list1[1]['discount'] = '8'
|
|
list1[2]['discount'] = '8.5'
|
|
list1[3]['discount'] = '7.8'
|
|
list1[4]['discount'] = '6.5'
|
|
list1[5]['discount'] = '7'
|
|
list1[6]['discount'] = '8.5'
|
|
list1[7]['discount'] = '9'
|
|
list1[8]['discount'] = '7.5'
|
|
|
|
return {'status': True, 'data': list1}
|
|
|
|
except Exception as error:
|
|
raise error
|
|
|
|
ret = await get_hotshow(params_kw)
|
|
return ret |