36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
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 |