diff --git a/app/task.py b/app/task.py index 919a248..dca942a 100644 --- a/app/task.py +++ b/app/task.py @@ -145,9 +145,9 @@ def process_new_demand(app_id, app_secret, data): space_id = "7268552249415319554" if category == "opt5xydmUE": - parent_node_token = "BfyPdfzuyoIg7exaCZycnYoBnIf" + parent_node_token = "SvWCwlWJ8iuFKpkXp1rcd9u2n3c" if category == "optRTwYcra": - parent_node_token = "FVAJdZ9cDoK7MHxGNMcccP37nch" + parent_node_token = "F4ivwKrgyiQ4zOkuLVFcTq9Bnee" doc_id = create_doc(client, space_id, parent_node_token, title) block_id = get_doc_block(client, doc_id) diff --git a/app/utils/feishu.py b/app/utils/feishu.py index 99e2591..c79ae93 100644 --- a/app/utils/feishu.py +++ b/app/utils/feishu.py @@ -3,6 +3,7 @@ import os import http import requests import lark_oapi as lark +from dotenv import load_dotenv import lark_oapi as lark from lark_oapi.api.docx.v1 import * @@ -223,6 +224,34 @@ def create_doc_block( .build() ) .build(), + Block.builder() + .block_type(4) + .heading2( + Text.builder() + .elements( + [ + TextElement.builder() + .text_run(TextRun.builder().content("需求实现").build()) + .build(), + ] + ) + .build() + ) + .build(), + Block.builder() + .block_type(4) + .heading2( + Text.builder() + .elements( + [ + TextElement.builder() + .text_run(TextRun.builder().content("常见问题").build()) + .build(), + ] + ) + .build() + ) + .build(), ] ) .index(0) @@ -253,7 +282,40 @@ def create_doc_block( if __name__ == "__main__": - + load_dotenv() + + app_id = os.environ["APP_ID"] + app_secret = os.environ["APP_SECRET"] + + data = { + "title": "测试", + "features": "测试", + "background": "测试", + "category": "opt5xydmUE", + } + + 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" + + # 官方应用 + if category == "opt5xydmUE": + parent_node_token = "SvWCwlWJ8iuFKpkXp1rcd9u2n3c" + if category == "optRTwYcra": + parent_node_token = "F4ivwKrgyiQ4zOkuLVFcTq9Bnee" + + doc_id = create_doc(client, space_id, parent_node_token, title) pass