重构input_record.py
This commit is contained in:
parent
68b4357670
commit
ae56a73c5e
@ -1,10 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
#import jingrow
|
import jingrow
|
||||||
|
|
||||||
# 导入utils
|
|
||||||
from jingrow.utils.jingrow_api import get_record
|
|
||||||
|
|
||||||
def execute(context=None, inputs=None, config=None, **kwargs):
|
def execute(context=None, inputs=None, config=None, **kwargs):
|
||||||
if context is None:
|
if context is None:
|
||||||
@ -24,10 +21,9 @@ def execute(context=None, inputs=None, config=None, **kwargs):
|
|||||||
if not pagetype or not name:
|
if not pagetype or not name:
|
||||||
return {"success": False, "error": "缺少pagetype或name"}
|
return {"success": False, "error": "缺少pagetype或name"}
|
||||||
try:
|
try:
|
||||||
api_res = get_record(pagetype, name)
|
data = jingrow.get_pg(pagetype, name)
|
||||||
if not api_res.get("success"):
|
if not data:
|
||||||
return {"success": False, "error": api_res.get("error", "获取记录失败")}
|
return {"success": False, "error": "获取记录失败"}
|
||||||
data = api_res.get("data") or {}
|
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
data["success"] = True
|
data["success"] = True
|
||||||
return data
|
return data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user