kboss/b/product/home_page_content_search.dspy
2025-11-27 18:00:11 +08:00

36 lines
1.1 KiB
Plaintext
Raw 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 home_page_content_search(ns={}):
"""
查找内容项支持按内容类型、父级ID等条件查询
:param ns: 查询条件字典
:return: 查询结果
"""
# 构建查询条件
conditions = {"del_flg": "0"}
if ns.get('content_type'):
conditions['content_type'] = ns.get('content_type')
if ns.get('parent_id'):
conditions['parent_id'] = ns.get('parent_id')
if ns.get('menu_product_id'):
conditions['menu_product_id'] = ns.get('menu_product_id')
if ns.get('id'):
conditions['id'] = ns.get('id')
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
result = await sor.R('home_page_content_items', conditions)
return {
'status': True,
'msg': 'search home page content success',
'data': result
}
except Exception as e:
await sor.rollback()
return {
'status': False,
'msg': 'search home page content failed, %s' % str(e)
}
ret = await home_page_content_search(params_kw)
return ret