1 parent
67ab43b85a
commit
163614a87d
1 file changed
+13
-16
+13
-16
@@ -79,15 +79,13 @@ def do_bitable_record_add(data) -> None:
|
|||||||
|
|
||||||
actions_name = [action.get("action") for action in action_list]
|
actions_name = [action.get("action") for action in action_list]
|
||||||
|
|
||||||
target_actions = ["record_edited", "record_added"]
|
|
||||||
|
|
||||||
actions = [
|
actions = [
|
||||||
action for action in action_list if action.get("action") == "record_edited"
|
action for action in action_list if action.get("action") == "record_edited"
|
||||||
]
|
]
|
||||||
print(actions)
|
print(actions)
|
||||||
|
|
||||||
if not (set(target_actions) <= set(actions_name)):
|
# if not (set(target_actions) <= set(actions_name)):
|
||||||
return data
|
# return data
|
||||||
|
|
||||||
if table_id != "tblESHsFZwtiFROB":
|
if table_id != "tblESHsFZwtiFROB":
|
||||||
return data
|
return data
|
||||||
@@ -95,6 +93,10 @@ def do_bitable_record_add(data) -> None:
|
|||||||
if not actions:
|
if not actions:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
# 根据不同 "record_edited", "record_added" 的动作执行不同的任务
|
||||||
|
# 1. 如果包含 record_added 则创建需求文档
|
||||||
|
# 2. 如果包含 record_edited 并且判断 status 是否为已处理, 如果已处理则通过任务创建应用, 并在分类管理中添加一条记录, 在开发管理添加一条记录
|
||||||
|
|
||||||
target_action = actions[0]
|
target_action = actions[0]
|
||||||
record_id = target_action.get("record_id")
|
record_id = target_action.get("record_id")
|
||||||
after_value: list = target_action.get("after_value")
|
after_value: list = target_action.get("after_value")
|
||||||
@@ -121,13 +123,13 @@ def do_bitable_record_add(data) -> None:
|
|||||||
action_data["features"] = tmp
|
action_data["features"] = tmp
|
||||||
|
|
||||||
if field.get("field_id") == "fld9QkmcS1":
|
if field.get("field_id") == "fld9QkmcS1":
|
||||||
|
|
||||||
action_data["category"] = field.get("field_value")
|
action_data["category"] = field.get("field_value")
|
||||||
|
|
||||||
if field.get("field_id") == "fldopqyyCG":
|
if field.get("field_id") == "fldopqyyCG":
|
||||||
action_data["status"] = field.get("field_value")
|
action_data["status"] = field.get("field_value")
|
||||||
|
|
||||||
if field.get("field_id") == "fldaxMbywh":
|
if field.get("field_id") == "fldaxMbywh":
|
||||||
|
# 有可能值为空
|
||||||
|
|
||||||
print(field)
|
print(field)
|
||||||
# action_data["deal_person"] = (
|
# action_data["deal_person"] = (
|
||||||
@@ -137,21 +139,16 @@ def do_bitable_record_add(data) -> None:
|
|||||||
print(f"table_id: {table_id}")
|
print(f"table_id: {table_id}")
|
||||||
print(f"record_id: {record_id}")
|
print(f"record_id: {record_id}")
|
||||||
print(f"target_action: {target_action.get('action')}")
|
print(f"target_action: {target_action.get('action')}")
|
||||||
print(action_data)
|
|
||||||
|
|
||||||
table_id = "tblESHsFZwtiFROB"
|
table_id = "tblESHsFZwtiFROB"
|
||||||
|
|
||||||
# 如果确定开发就创建应用, 根据不同的状态执行不同的任务
|
if "record_added" in actions_name:
|
||||||
if action_data["status"] == "optQgHmA8z":
|
process_new_demand.delay(app_id, app_secret, table_id, record_id, action_data)
|
||||||
|
return
|
||||||
|
|
||||||
|
if "record_edited" in actions_name and action_data["status"] == "xxxxxxx":
|
||||||
process_new_robot.delay()
|
process_new_robot.delay()
|
||||||
else:
|
return
|
||||||
process_new_demand.delay(
|
|
||||||
app_id,
|
|
||||||
app_secret,
|
|
||||||
table_id,
|
|
||||||
record_id,
|
|
||||||
action_data,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
handler = (
|
handler = (
|
||||||
|
|||||||
Reference in new issue
Block a user