1 parent
e8e058abb8
commit
2beb23a1d5
3 files changed
+23
-6
No files matched your search
+9
-1
@@ -124,7 +124,15 @@ def do_bitable_record_add(data) -> None:
|
|||||||
print(f"target_action: {target_action.get('action')}")
|
print(f"target_action: {target_action.get('action')}")
|
||||||
print(action_data)
|
print(action_data)
|
||||||
|
|
||||||
process_new_demand.delay(app_id, app_secret, action_data)
|
table_id = "tblESHsFZwtiFROB"
|
||||||
|
|
||||||
|
process_new_demand.delay(
|
||||||
|
app_id,
|
||||||
|
app_secret,
|
||||||
|
table_id,
|
||||||
|
record_id,
|
||||||
|
action_data,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
handler = (
|
handler = (
|
||||||
|
|||||||
+12
-4
@@ -9,6 +9,7 @@ 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 create_doc, get_doc_block, create_doc_block
|
from app.utils.feishu import create_doc, get_doc_block, create_doc_block
|
||||||
|
from app.utils.utils import update_record
|
||||||
|
|
||||||
|
|
||||||
@shared_task(include_result=False)
|
@shared_task(include_result=False)
|
||||||
@@ -127,7 +128,7 @@ def sync_xbot_activity_info():
|
|||||||
|
|
||||||
|
|
||||||
@shared_task(include_result=False)
|
@shared_task(include_result=False)
|
||||||
def process_new_demand(app_id, app_secret, data):
|
def process_new_demand(app_id, app_secret, table_id, record_id, data):
|
||||||
|
|
||||||
title = data.get("title")
|
title = data.get("title")
|
||||||
background = data.get("background")
|
background = data.get("background")
|
||||||
@@ -143,6 +144,7 @@ def process_new_demand(app_id, app_secret, data):
|
|||||||
)
|
)
|
||||||
|
|
||||||
space_id = "7268552249415319554"
|
space_id = "7268552249415319554"
|
||||||
|
bitable_token = os.environ["OFFICE_XBOT_BITABLE_TOKEN"]
|
||||||
|
|
||||||
# 放官方应用下
|
# 放官方应用下
|
||||||
if category == "opt5xydmUE":
|
if category == "opt5xydmUE":
|
||||||
@@ -151,7 +153,13 @@ def process_new_demand(app_id, app_secret, data):
|
|||||||
if category == "optRTwYcra":
|
if category == "optRTwYcra":
|
||||||
parent_node_token = "SvWCwlWJ8iuFKpkXp1rcd9u2n3c"
|
parent_node_token = "SvWCwlWJ8iuFKpkXp1rcd9u2n3c"
|
||||||
|
|
||||||
doc_id = create_doc(client, space_id, parent_node_token, title)
|
doc_node_toke = create_doc(client, space_id, parent_node_token, title)
|
||||||
block_id = get_doc_block(client, doc_id)
|
block_id = get_doc_block(client, doc_node_toke)
|
||||||
|
|
||||||
create_doc_block(client, doc_id, block_id, background, features)
|
create_doc_block(client, doc_node_toke, block_id, background, features)
|
||||||
|
|
||||||
|
doc_node_url = f"https://ying-dao.feishu.cn/wiki/{doc_node_toke}"
|
||||||
|
|
||||||
|
update_record(
|
||||||
|
client, bitable_token, table_id, record_id, {"需求文档链接": doc_node_url}
|
||||||
|
)
|
||||||
+2
-1
@@ -112,7 +112,8 @@ def create_doc(client, space_id, parent_node_token, title):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
return response.data.node.obj_token
|
print(lark.JSON.marshal(response.data))
|
||||||
|
return response.data.node.node_token
|
||||||
|
|
||||||
|
|
||||||
def get_doc_block(client, document_id):
|
def get_doc_block(client, document_id):
|
||||||
|
|||||||
Reference in new issue
Block a user