重构input_record.py

This commit is contained in:
jingrow 2025-11-01 02:09:47 +08:00
parent 68b4357670
commit ae56a73c5e

View File

@ -1,10 +1,7 @@
import json
import sys
import os
#import jingrow
# 导入utils
from jingrow.utils.jingrow_api import get_record
import jingrow
def execute(context=None, inputs=None, config=None, **kwargs):
if context is None:
@ -24,10 +21,9 @@ def execute(context=None, inputs=None, config=None, **kwargs):
if not pagetype or not name:
return {"success": False, "error": "缺少pagetype或name"}
try:
api_res = get_record(pagetype, name)
if not api_res.get("success"):
return {"success": False, "error": api_res.get("error", "获取记录失败")}
data = api_res.get("data") or {}
data = jingrow.get_pg(pagetype, name)
if not data:
return {"success": False, "error": "获取记录失败"}
if isinstance(data, dict):
data["success"] = True
return data