增加global_search后端api端点
This commit is contained in:
parent
484c116c4a
commit
87c38c8502
27
apps/jingrow/jingrow/utils/global_search.py
Normal file
27
apps/jingrow/jingrow/utils/global_search.py
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (c) 2025, JINGROW and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
"""
|
||||
Global search - Forward to SaaS using unified HTTP client
|
||||
"""
|
||||
|
||||
import jingrow
|
||||
import logging
|
||||
from jingrow.utils.auth import saas_post
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
def search(text, start=0, limit=20, pagetype=""):
|
||||
"""Global search - Forward to SaaS"""
|
||||
resp = saas_post('/api/action/jingrow.utils.global_search.search', json={
|
||||
'text': text,
|
||||
'start': start,
|
||||
'limit': limit,
|
||||
'pagetype': pagetype
|
||||
})
|
||||
if resp.status_code == 200:
|
||||
return resp.json().get("message", {})
|
||||
logger.error(f"[global_search.search] SaaS error: {resp.status_code}")
|
||||
return {}
|
||||
Loading…
x
Reference in New Issue
Block a user