luhaowen 1 týždeň pred
rodič
commit
7741a45af9
1 zmenil súbory, kde vykonal 10 pridanie a 19 odobranie
  1. 10 19
      src/com/example/FeishuNotifier.groovy

+ 10 - 19
src/com/example/FeishuNotifier.groovy

@@ -1,7 +1,6 @@
 package com.example
 
 import groovy.json.JsonOutput
-import jenkins.model.Jenkins
 
 class FeishuNotifier implements Serializable {
     def script
@@ -13,28 +12,20 @@ class FeishuNotifier implements Serializable {
     }
 
     void send(String status, String jobName, String buildNumber, String buildUrl, String duration) {
-        def colorMap = [
-            'SUCCESS' : 'green',
-            'FAILURE' : 'red',
-            'UNSTABLE': 'yellow',
-            'ABORTED' : 'gray'
-        ]
         def payload = [
             msg_type: 'post',
             content: [
                 post: [
-                    zh_cn: [
-                        title: "Jenkins 构建通知",
-                        content: [[
-                            tag : 'text',
-                            text: """
-                            构建状态 : ${status}
-                            任务名称 : ${jobName}
-                            构建编号 : #${buildNumber}
-                            持续时间 : ${duration}
-                            查看详情 : ${buildUrl}
-                            """.stripIndent()
-                        ]]
+                    title: "Jenkins 构建通知",
+                    content: [   // ← 一维数组
+                        [
+                            tag : "text",
+                            text: """状态:${status}
+任务:${jobName}
+编号:#${buildNumber}
+耗时:${duration}
+链接:${buildUrl}""".stripIndent()
+                        ]
                     ]
                 ]
             ]