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