zhangwei 3 år sedan
förälder
incheckning
055e6ae65a
1 ändrade filer med 16 tillägg och 5 borttagningar
  1. 16 5
      server/main.py

+ 16 - 5
server/main.py

@@ -127,7 +127,7 @@ def tenant_access_token_by_feishu():
         res_json["code"] = 4
         res_json["msg"] = "获取飞书签名失败"
 
-def send_msg_by_feishu(chat_id,project_name,mode_name):
+def send_msg_by_feishu(chat_id,project_name,mode_name,branch):
     token = global_params["token"]
     img_key = global_params["img_key"]
     url ="https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id"
@@ -140,10 +140,21 @@ def send_msg_by_feishu(chat_id,project_name,mode_name):
         "msg_type": "post",
         "content": json.dumps({
             "zh_cn": {
-                "title": mode_name+':'+project_name+"小程序预览码",
+                "title": "小程序预览码",
                 "content": [
-                    [
-                        {
+                    [{
+                        "tag":"text",
+                        "text":"项目:"+project_name
+                    }],
+                    [{
+                        "tag":"text",
+                        "text":"环境:"+mode_name
+                    }],
+                    [{
+                        "tag":"text",
+                        "text":"分支:"+branch
+                    }],
+                    [{
                             "tag": "img",
                             "image_key": img_key,
                             "width": 500,
@@ -234,7 +245,7 @@ def send():
             tenant_access_token_by_feishu(),
 
             upload_img_by_feishu(),
-            send_msg_by_feishu(chat_id,project_name,mode_name)
+            send_msg_by_feishu(chat_id,project_name,mode_name,branch)
         ]
 
         # 循环方法判断