This commit is contained in:
1 parent
e8318db7c5
commit
306eb905d0
2 files changed
+2
-49
No files matched your search
+2
-7
@@ -98,9 +98,8 @@ def do_bitable_record_add(data) -> None:
|
|||||||
if not actions:
|
if not actions:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
# 根据不同 "record_edited", "record_added" 的动作执行不同的任务
|
# 如果包含 record_edited 并且判断 status 是否为已处理, 则通过任务创建应用,
|
||||||
# 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")
|
||||||
@@ -146,10 +145,6 @@ def do_bitable_record_add(data) -> None:
|
|||||||
|
|
||||||
table_id = "tblESHsFZwtiFROB"
|
table_id = "tblESHsFZwtiFROB"
|
||||||
|
|
||||||
if "record_added" in actions_name:
|
|
||||||
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"] == "optgKzdQp5":
|
if "record_edited" in actions_name and action_data["status"] == "optgKzdQp5":
|
||||||
# 映射对应的用户 id
|
# 映射对应的用户 id
|
||||||
user_name_id_map = {
|
user_name_id_map = {
|
||||||
|
|||||||
-42
@@ -9,9 +9,6 @@ from celery import Task
|
|||||||
from app.utils.utils import *
|
from app.utils.utils import *
|
||||||
from app.utils.yd_utils import get_token, get_activity_info
|
from app.utils.yd_utils import get_token, get_activity_info
|
||||||
from app.utils.feishu import (
|
from app.utils.feishu import (
|
||||||
create_doc,
|
|
||||||
get_doc_block,
|
|
||||||
create_doc_block,
|
|
||||||
get_messages,
|
get_messages,
|
||||||
send_groud_message,
|
send_groud_message,
|
||||||
)
|
)
|
||||||
@@ -326,45 +323,6 @@ def check_activity_help_link():
|
|||||||
send_groud_message(client, chat_id, message_content)
|
send_groud_message(client, chat_id, message_content)
|
||||||
|
|
||||||
|
|
||||||
@shared_task(include_result=False)
|
|
||||||
def process_new_demand(app_id, app_secret, table_id, record_id, data):
|
|
||||||
|
|
||||||
title = data.get("title")
|
|
||||||
background = data.get("background")
|
|
||||||
features = data.get("features")
|
|
||||||
category = data.get("category")
|
|
||||||
|
|
||||||
client = (
|
|
||||||
lark.Client.builder()
|
|
||||||
.app_id(app_id)
|
|
||||||
.app_secret(app_secret)
|
|
||||||
.log_level(lark.LogLevel.DEBUG)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
|
|
||||||
space_id = "7268552249415319554"
|
|
||||||
bitable_token = os.environ["OFFICE_XBOT_BITABLE_TOKEN"]
|
|
||||||
|
|
||||||
# 放官方应用下
|
|
||||||
if category == "opt5xydmUE":
|
|
||||||
parent_node_token = "F4ivwKrgyiQ4zOkuLVFcTq9Bnee"
|
|
||||||
# 放到官方指令下
|
|
||||||
if category == "optRTwYcra":
|
|
||||||
parent_node_token = "SvWCwlWJ8iuFKpkXp1rcd9u2n3c"
|
|
||||||
|
|
||||||
doc_node_token, doc_obj_token = create_doc(
|
|
||||||
client, space_id, parent_node_token, title
|
|
||||||
)
|
|
||||||
block_id = get_doc_block(client, doc_obj_token)
|
|
||||||
|
|
||||||
create_doc_block(client, doc_obj_token, block_id, background, features)
|
|
||||||
|
|
||||||
doc_node_url = f"https://ying-dao.feishu.cn/wiki/{doc_node_token}"
|
|
||||||
|
|
||||||
update_data = {"需求文档链接": doc_node_url, "状态": "待评估"}
|
|
||||||
update_record(client, bitable_token, table_id, record_id, update_data)
|
|
||||||
|
|
||||||
|
|
||||||
@shared_task(include_result=False)
|
@shared_task(include_result=False)
|
||||||
def process_new_robot(app_id, app_secret, action_data):
|
def process_new_robot(app_id, app_secret, action_data):
|
||||||
user_id = action_data["deal_person_id"]
|
user_id = action_data["deal_person_id"]
|
||||||
|
|||||||
Reference in new issue
Block a user