增加/jingrow/get-module-app路由
This commit is contained in:
parent
55371ca42d
commit
31824cfbea
@ -189,7 +189,7 @@ async function onPagetypeChange() {
|
||||
moduleName.value = ''
|
||||
if (!form.value.pagetype) return
|
||||
try {
|
||||
const res = await axios.get(`/api/action/jingrow.ai.utils.jlocal.get_pagetype_module_app`, {
|
||||
const res = await axios.get(`/jingrow/get-module-app`, {
|
||||
params: { pagetype: form.value.pagetype },
|
||||
headers: get_session_api_headers(),
|
||||
withCredentials: true
|
||||
|
||||
@ -235,3 +235,32 @@ async def upload_file_api(
|
||||
raise
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@router.get("/jingrow/get-module-app")
|
||||
async def get_module_app_api(request: Request, pagetype: str):
|
||||
"""获取指定 pagetype 的模块应用信息"""
|
||||
try:
|
||||
result = jingrow.get_module_app(pagetype)
|
||||
|
||||
# 检查结果格式
|
||||
if not isinstance(result, dict):
|
||||
raise HTTPException(status_code=500, detail='获取模块应用信息失败:返回格式错误')
|
||||
|
||||
if result.get('success'):
|
||||
return JSONResponse(content={
|
||||
"message": {
|
||||
"success": True,
|
||||
"module": result.get('module'),
|
||||
"app": result.get('app'),
|
||||
"pagetype": pagetype
|
||||
}
|
||||
})
|
||||
else:
|
||||
error_msg = result.get('error', '获取模块应用信息失败')
|
||||
raise HTTPException(status_code=400, detail=error_msg)
|
||||
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user