From 2eb366c25dfe2dae8fd278415210b79fb6d5fd63 Mon Sep 17 00:00:00 2001 From: woni <320753691@qq.com> Date: Thu, 6 Jun 2024 12:51:41 +0800 Subject: [PATCH] add create new robot --- app/__init__.py | 24 ++++++++++++++++-------- app/task.py | 6 ++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 9fab9ca..537daa7 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -124,8 +124,12 @@ def do_bitable_record_add(data) -> None: action_data["category"] = field.get("field_value") if field.get("field_id") == "fldopqyyCG": - pass + action_data["status"] = field.get("field_value") + if field.get("field_id") == "fldaxMbywh": + action_data["deal_person"] = ( + field.get("field_identity_value").get("users")[0].get("name") + ) print(f"table_id: {table_id}") print(f"record_id: {record_id}") @@ -134,13 +138,17 @@ def do_bitable_record_add(data) -> None: table_id = "tblESHsFZwtiFROB" - process_new_demand.delay( - app_id, - app_secret, - table_id, - record_id, - action_data, - ) + # 如果确定开发就创建应用, 根据不同的状态执行不同的任务 + if action_data["status"] == "optQgHmA8z": + process_new_robot.delay() + else: + process_new_demand.delay( + app_id, + app_secret, + table_id, + record_id, + action_data, + ) handler = ( diff --git a/app/task.py b/app/task.py index 87f0574..717e593 100644 --- a/app/task.py +++ b/app/task.py @@ -10,6 +10,7 @@ from app.utils.utils import * from app.utils.yd_utils import get_token, get_activity_info from app.utils.feishu import create_doc, get_doc_block, create_doc_block, get_messages from app.utils.utils import update_record +from app.utils.yd_utils import new_blank_robot def parse_history_message(data): @@ -271,3 +272,8 @@ def process_new_demand(app_id, app_secret, table_id, record_id, data): update_data = {"需求文档链接": doc_node_url, "状态": "待评估"} update_record(client, bitable_token, table_id, record_id, update_data) + + +@shared_task(include_result=False) +def process_new_robot(): + new_blank_robot(name="测试-需求创建机器人")