重构condition_check.py
This commit is contained in:
parent
f5068b3859
commit
f7f5b8e63d
@ -1,6 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
from jingrow.utils.jingrow_api import get_field_mapping_from_jingrow
|
import jingrow
|
||||||
from jingrow.utils.jingrow_api import get_record_list
|
|
||||||
|
|
||||||
def execute(context=None, inputs=None, config=None, **kwargs):
|
def execute(context=None, inputs=None, config=None, **kwargs):
|
||||||
"""条件判断节点:检查指定pagetype的记录是否满足条件"""
|
"""条件判断节点:检查指定pagetype的记录是否满足条件"""
|
||||||
@ -53,7 +52,7 @@ def execute(context=None, inputs=None, config=None, **kwargs):
|
|||||||
if k not in available_fields or not available_fields.get(k):
|
if k not in available_fields or not available_fields.get(k):
|
||||||
available_fields[k] = v
|
available_fields[k] = v
|
||||||
|
|
||||||
label2field = get_field_mapping_from_jingrow(pagetype) or {}
|
label2field = jingrow.get_field_mapping_from_jingrow(pagetype) or {}
|
||||||
|
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|
||||||
@ -114,15 +113,9 @@ def execute(context=None, inputs=None, config=None, **kwargs):
|
|||||||
else:
|
else:
|
||||||
filter_array.append([k, "=", v])
|
filter_array.append([k, "=", v])
|
||||||
|
|
||||||
api_res = get_record_list(pagetype, filters=filter_array, fields=["name"], limit=1000)
|
records = jingrow.get_list(pagetype, filters=filter_array, fields=["name"], limit=1000)
|
||||||
if api_res.get("success"):
|
record_count = len(records)
|
||||||
records = api_res.get("data") or []
|
condition_met = record_count > 0
|
||||||
record_count = len(records)
|
|
||||||
condition_met = record_count > 0
|
|
||||||
else:
|
|
||||||
records = []
|
|
||||||
record_count = 0
|
|
||||||
condition_met = False
|
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
"success": True,
|
"success": True,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user