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

31 lines
1.4 KiB
Plaintext

async def cpccom_pricing_search(ns={}):
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
if ns.get('center_id'):
search_sql = """ SELECT * from cpccom_pricing WHERE center_id = '%s' and del_flg = '0'; """ % ns.get('center_id')
res = await sor.sqlExe(search_sql, {})
if ns.get('component_id'):
search_sql = """ SELECT * from cpccom_pricing WHERE component_id = '%s' and del_flg = '0'; """ % ns.get('component_id')
res = await sor.sqlExe(search_sql, {})
if ns.get('start_date') and ns.get('end_date'):
search_sql = """ SELECT * from cpccom_pricing WHERE start_date >= '%s' and end_date <= '%s' and del_flg = '0'; """ % (ns.get('start_date'), ns.get('end_date'))
res = await sor.sqlExe(search_sql, {})
else:
search_sql = """ SELECT * from cpccom_pricing WHERE del_flg = '0'; """
res = await sor.sqlExe(search_sql, {})
return {
'status': True,
'msg': '算力中心节点实例价格查找成功',
'data': res
}
except Exception as e:
return {
'status': False,
'msg': '算力中心节点实例价格查找错误, %s' % str(e)
}
ret = await cpccom_pricing_search(params_kw)
return ret