This commit is contained in:
hrx 2025-12-12 17:32:15 +08:00
commit 1f9057a38a
2 changed files with 15 additions and 0 deletions

View File

@ -705,6 +705,18 @@ async def get_firstpage_product_tree(ns={}):
key=lambda x: (priority.get(x['thrTitle'], 4), result.index(x)) key=lambda x: (priority.get(x['thrTitle'], 4), result.index(x))
) )
data['product_service'][0]['secMenu'][0]['thrMenu'] = sorted_data data['product_service'][0]['secMenu'][0]['thrMenu'] = sorted_data
# 使用jsonpath 查找data下所有value下name包含'用'的对象
if ns.get('keyword'):
jsonpath_result = jsonpath.jsonpath(data, '$..value')
data = []
jsonpath_result = jsonpath_result if jsonpath_result else []
for item in jsonpath_result:
for sub_item in item:
if ns['keyword'] in sub_item.get('name', ''):
data.append(sub_item)
return { return {
'status': True, 'status': True,
'msg': 'get product list success', 'msg': 'get product list success',

View File

@ -111,6 +111,8 @@ from KaiYyEnDecryptUtil import KaiYyEnDecryptUtil
from async_container import async_post from async_container import async_post
import jsonpath
if __name__ == '__main__': if __name__ == '__main__':
p = ProgramPath() p = ProgramPath()
parser = argparse.ArgumentParser(prog='Kaiyuan cloud Bussiness Operation Support System') parser = argparse.ArgumentParser(prog='Kaiyuan cloud Bussiness Operation Support System')
@ -214,6 +216,7 @@ if __name__ == '__main__':
g.BaiduKafKaConsumer = BaiduKafKaConsumer g.BaiduKafKaConsumer = BaiduKafKaConsumer
g.KaiYyEnDecryptUtil = KaiYyEnDecryptUtil g.KaiYyEnDecryptUtil = KaiYyEnDecryptUtil
g.async_post = async_post g.async_post = async_post
g.jsonpath = jsonpath
i18n = getI18N(path=workdir) i18n = getI18N(path=workdir)
info(f'gadget version={__version__}') info(f'gadget version={__version__}')