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

43 lines
1.6 KiB
Plaintext

async def add_smart(ns):
"""运营添加智算产品"""
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
uuids = str(uuid())
uuid_digits = 21
uuid_gen = uuids[:uuid_digits].replace('-', '')
# print(uuid_gen)
data = {
'id': uuid_gen,
'product_model': ns['product_model'],
'location': ns['location'],
'scale': ns['scale'],
'leadtime': ns['leadtime'],
'brand': ns['brand'],
'resource_type': ns['resource_type'],
'card_type': ns['card_type'],
'card_interface': ns['card_interface'],
'cpu': ns['cpu'],
'memory': ns['memory'],
'system_disk': ns['system_disk'],
'data_disk': ns['data_disk'],
'data_network': ns['data_network'],
'card_network': ns['card_network'],
'outer_bandwidth': ns['outer_bandwidth'],
'shared_storage': ns['shared_storage'],
'address': ns['address'],
'test_claim': ns['test_claim'],
'yearly_rant': ns['yearly_rant'],
'quarterly_rent': ns['quarterly_rent'],
'monthly_rent': ns['monthly_rent'],
'remark': ns['remark'],
'type': ns['type'],
}
await sor.C('product_smart', data)
return {'status': True, 'msg': '添加成功'}
except Exception as e:
return {'status': False, 'msg': {e}}
ret = await add_smart(params_kw)
return ret