kboss/b/product_smart/get_smart.dspy
2025-07-16 14:27:17 +08:00

26 lines
795 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

async def get_smsart(ns={}):
"""客户展示智算产品"""
db = DBPools()
async with db.sqlorContext('kboss') as sor:
type_data = await sor.R('product_smart', {'del_flg': 0})
# 创建一个空字典用于按type分类数据
type_dict = {}
# 遍历原始数据
for item in type_data:
item_type = item['type']
if item_type not in type_dict:
type_dict[item_type] = []
type_dict[item_type].append(item)
# 将字典转换为指定格式的列表
formatted_result = [{k: v} for k, v in type_dict.items()]
print(formatted_result)
return {
'status': True,
'data': formatted_result
}
ret = await get_smsart(params_kw)
return ret