diff --git a/app/task.py b/app/task.py index 59c439b..69d4791 100644 --- a/app/task.py +++ b/app/task.py @@ -173,8 +173,10 @@ def process_message_callback( # 表格触发器会自动设置 "创建人-售后专用" 为创建者, 使用接口调整 for _ in range(100): - creator_names = get_record_creator_name_by_id(client, bitable_token, table_id, record_id) - if "官方应用指令" in creator_names: + creator_names = get_record_creator_name_by_id( + client, bitable_token, table_id, record_id + ) + if "官方应用指令" in creator_names: break time.sleep(2) @@ -280,7 +282,7 @@ def process_new_robot(app_id, app_secret, action_data): name = action_data["title"] category = action_data.get("category") - robot_uuid = "" + robot_uuid = "" catagory_table_record = {"UUID": robot_uuid, "名称": name, "分类": "官方指令"} if category == "optRTwYcra": @@ -288,16 +290,19 @@ def process_new_robot(app_id, app_secret, action_data): catagory_table_record["分类"] = "官方应用" catagory_table_record["UUID"] = robot_uuid - if category == "opt5xydmUE": + elif category == "opt5xydmUE": robot_uuid = new_blank_activity(name, user_id) catagory_table_record["分类"] = "官方指令" catagory_table_record["UUID"] = robot_uuid + else: + # 其他选项不创建记录 + return + # 更新多维表格分类管理 table_id = "tbl2GcBvkvMtOBnl" bitable_token = os.environ["OFFICE_XBOT_BITABLE_TOKEN"] - # 在开发计划中创建记录 client = ( lark.Client.builder() .app_id(app_id) @@ -306,3 +311,5 @@ def process_new_robot(app_id, app_secret, action_data): .build() ) add_record(client, bitable_token, table_id, catagory_table_record) + + # 在开发计划中创建记录