From 2e6fcdbea5ce5d390cd91e8a8d1af9ff8cbbbc4e Mon Sep 17 00:00:00 2001 From: 3y Date: Tue, 28 Jun 2022 20:43:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=20=E9=A3=9E=E4=B9=A6?= =?UTF-8?q?=E7=BE=A4=E6=9C=BA=E5=99=A8=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/crud-edit.json | 85 +++++++++++++++++++++++++++++++++++++++++++- pages/crud-list.json | 17 +++++++-- pages/crud-new.json | 85 +++++++++++++++++++++++++++++++++++++++++++- pages/crud-view.json | 83 ++++++++++++++++++++++++++++++++++++++++++ requestHandler.md | 13 +++++++ 5 files changed, 278 insertions(+), 5 deletions(-) diff --git a/pages/crud-edit.json b/pages/crud-edit.json index 264c997..5453b8f 100644 --- a/pages/crud-edit.json +++ b/pages/crud-edit.json @@ -67,6 +67,10 @@ { "label": "推送通知栏cid", "value": "80" + }, + { + "label": "飞书userId", + "value": "90" } ], "required": true @@ -199,6 +203,14 @@ { "label": "钉钉工作消息", "value": "90" + }, + { + "label": "企业微信机器人", + "value": "100" + }, + { + "label": "飞书机器人", + "value": "110" } ], "required": true @@ -236,6 +248,77 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$url}" }, + { + "type": "select", + "label": "飞书机器人", + "name": "sendAccount", + "options": [ + { + "label": "austin", + "value": "10" + }, + { + "label": "athena", + "value": "20" + } + ], + "visibleOn": "this.sendChannel == 110", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本", + "value": "10" + }, + + { + "label": "图片", + "value": "100" + }, + { + "label": "跳转卡片", + "value": "120" + }, + { + "label": "富文本", + "value": "150" + }, + { + "label": "群卡片", + "value": "160" + } + ], + "visibleOn": "this.sendChannel == 110", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "type": "input-text", + "label": "飞书内容", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 110 && this.sendType ==10 ", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "图片标识", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 110 && this.sendType ==100 ", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, { "type": "select", "label": "推送账号", @@ -766,7 +849,7 @@ "api": { "url": "http://localhost:8080/messageTemplate/save", "method": "post", - "requestAdaptor": "let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// push通知栏\nif(api.data.sendChannel == '20'){\n jsonObj.content = content\n jsonObj.url = url\n jsonObj.title = title\n}\n// 短信\nif(api.data.sendChannel == '30'){\n jsonObj.url = url\n jsonObj.content = content\n}\n// 邮件\nif(api.data.sendChannel == '40'){\n jsonObj.content = content\n jsonObj.title = title\n}\n// 企业微信\nif (api.data.sendChannel == '70') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 文本类型(text)\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.sendType = sendType\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 链接类型(link)\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.picUrl = picUrl\n jsonObj.url = url\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n}\n// 钉钉工作消息\nif (api.data.sendChannel == '90') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 语音类型\n if (sendType == '20') {\n jsonObj.sendType = sendType\n jsonObj.duration = api.data.duration\n jsonObj.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\n jsonObj.url = url\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n \n // OA(actionCard)\n if (sendType == '130') {\n \n // 头部\n var head = {}\n head.bgcolor = api.data.dingDingOaHeadBgColor\n head.text = api.data.dingDingOaHeadTitle\n jsonObj.dingDingOaHead = head\n \n // body\n var body = {}\n body.title = api.data.dingDingOaTitle\n body.content = api.data.dingDingOaContent\n body.image = api.data.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)", + "requestAdaptor": "let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// push通知栏\nif(api.data.sendChannel == '20'){\n jsonObj.content = content\n jsonObj.url = url\n jsonObj.title = title\n}\n// 短信\nif(api.data.sendChannel == '30'){\n jsonObj.url = url\n jsonObj.content = content\n}\n// 邮件\nif(api.data.sendChannel == '40'){\n jsonObj.content = content\n jsonObj.title = title\n}\n// 企业微信\nif (api.data.sendChannel == '70') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 文本类型(text)\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.sendType = sendType\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 链接类型(link)\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.picUrl = picUrl\n jsonObj.url = url\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n}\n// 钉钉工作消息\nif (api.data.sendChannel == '90') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 语音类型\n if (sendType == '20') {\n jsonObj.sendType = sendType\n jsonObj.duration = api.data.duration\n jsonObj.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\n jsonObj.url = url\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n \n // OA(actionCard)\n if (sendType == '130') {\n \n // 头部\n var head = {}\n head.bgcolor = api.data.dingDingOaHeadBgColor\n head.text = api.data.dingDingOaHeadTitle\n jsonObj.dingDingOaHead = head\n \n // body\n var body = {}\n body.title = api.data.dingDingOaTitle\n body.content = api.data.dingDingOaContent\n body.image = api.data.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\n// 飞书群机器人\nif (api.data.sendChannel == '110') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n\n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)\nreturn api;", "data": { "name": "${name}", "idType": "${idType}", diff --git a/pages/crud-list.json b/pages/crud-list.json index 93fc842..bcc06ce 100644 --- a/pages/crud-list.json +++ b/pages/crud-list.json @@ -62,7 +62,9 @@ "60": "小程序", "70": "企业微信应用消息", "80": "钉钉群机器人", - "90": "钉钉工作消息" + "90": "钉钉工作消息", + "100": "企业微信机器人", + "110": "飞书机器人" } }, { @@ -100,7 +102,8 @@ "50": "邮箱地址", "60": "企业微信userId", "70": "钉钉userId", - "80": "推送通知栏cid" + "80": "推送通知栏cid", + "90": "飞书userId" } }, { @@ -124,7 +127,7 @@ "api": { "url": "http://localhost:8080/messageTemplate/test", "method": "post", - "requestAdaptor": "let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// push通知栏\nif(api.data.sendChannel == '20'){\n jsonObj.content = content\n jsonObj.url = url\n jsonObj.title = title\n}\n// 短信\nif(api.data.sendChannel == '30'){\n jsonObj.url = url\n jsonObj.content = content\n}\n// 邮件\nif(api.data.sendChannel == '40'){\n jsonObj.content = content\n jsonObj.title = title\n}\n// 企业微信\nif (api.data.sendChannel == '70') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 文本类型(text)\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.sendType = sendType\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 链接类型(link)\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.picUrl = picUrl\n jsonObj.url = url\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n}\n// 钉钉工作消息\nif (api.data.sendChannel == '90') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 语音类型\n if (sendType == '20') {\n jsonObj.sendType = sendType\n jsonObj.duration = api.data.duration\n jsonObj.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\n jsonObj.url = url\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n \n // OA(actionCard)\n if (sendType == '130') {\n \n // 头部\n var head = {}\n head.bgcolor = api.data.dingDingOaHeadBgColor\n head.text = api.data.dingDingOaHeadTitle\n jsonObj.dingDingOaHead = head\n \n // body\n var body = {}\n body.title = api.data.dingDingOaTitle\n body.content = api.data.dingDingOaContent\n body.image = api.data.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)\nreturn api;", + "requestAdaptor": "let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n api.data.msgContent = JSON.stringify(jsonObj)\n }\n}\n\n\n\nreturn api;", "data": { "id": "${id}", "name": "${name}", @@ -157,6 +160,14 @@ "label": "接收者", "description": "存在占位符{$var}请替换占位符文案测试下发!" }, + { + "type": "input-text", + "label": "飞书内容", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 110", + "clearValueOnHidden": false + }, { "type": "input-text", "label": "短信内容", diff --git a/pages/crud-new.json b/pages/crud-new.json index 8ab782c..1897e98 100644 --- a/pages/crud-new.json +++ b/pages/crud-new.json @@ -67,6 +67,10 @@ { "label": "推送通知栏cid", "value": "80" + }, + { + "label": "飞书userId", + "value": "90" } ], "required": true @@ -215,6 +219,14 @@ { "label": "钉钉工作消息", "value": "90" + }, + { + "label": "企业微信机器人", + "value": "100" + }, + { + "label": "飞书机器人", + "value": "110" } ], "required": true @@ -338,6 +350,77 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$content},可输入HTML" }, + { + "type": "select", + "label": "飞书机器人", + "name": "sendAccount", + "options": [ + { + "label": "austin", + "value": "10" + }, + { + "label": "athena", + "value": "20" + } + ], + "visibleOn": "this.sendChannel == 110", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本", + "value": "10" + }, + + { + "label": "图片", + "value": "100" + }, + { + "label": "跳转卡片", + "value": "120" + }, + { + "label": "富文本", + "value": "150" + }, + { + "label": "群卡片", + "value": "160" + } + ], + "visibleOn": "this.sendChannel == 110", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "type": "input-text", + "label": "飞书内容", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 110 && this.sendType ==10 ", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "图片标识", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 110 && this.sendType ==100 ", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, { "type": "select", "label": "企业微信应用", @@ -792,7 +875,7 @@ "api": { "url": "http://localhost:8080/messageTemplate/save", "method": "post", - "requestAdaptor": "let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// push通知栏\nif(api.data.sendChannel == '20'){\n jsonObj.content = content\n jsonObj.url = url\n jsonObj.title = title\n}\n// 短信\nif(api.data.sendChannel == '30'){\n jsonObj.url = url\n jsonObj.content = content\n}\n// 邮件\nif(api.data.sendChannel == '40'){\n jsonObj.content = content\n jsonObj.title = title\n}\n// 企业微信\nif (api.data.sendChannel == '70') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 文本类型(text)\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.sendType = sendType\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 链接类型(link)\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.picUrl = picUrl\n jsonObj.url = url\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n}\n// 钉钉工作消息\nif (api.data.sendChannel == '90') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 语音类型\n if (sendType == '20') {\n jsonObj.sendType = sendType\n jsonObj.duration = api.data.duration\n jsonObj.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\n jsonObj.url = url\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n \n // OA(actionCard)\n if (sendType == '130') {\n \n // 头部\n var head = {}\n head.bgcolor = api.data.dingDingOaHeadBgColor\n head.text = api.data.dingDingOaHeadTitle\n jsonObj.dingDingOaHead = head\n \n // body\n var body = {}\n body.title = api.data.dingDingOaTitle\n body.content = api.data.dingDingOaContent\n body.image = api.data.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)", + "requestAdaptor": "\nlet jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// push通知栏\nif(api.data.sendChannel == '20'){\n jsonObj.content = content\n jsonObj.url = url\n jsonObj.title = title\n}\n// 短信\nif(api.data.sendChannel == '30'){\n jsonObj.url = url\n jsonObj.content = content\n}\n// 邮件\nif(api.data.sendChannel == '40'){\n jsonObj.content = content\n jsonObj.title = title\n}\n// 企业微信\nif (api.data.sendChannel == '70') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 文本类型(text)\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.sendType = sendType\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 链接类型(link)\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.picUrl = picUrl\n jsonObj.url = url\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n}\n// 钉钉工作消息\nif (api.data.sendChannel == '90') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 语音类型\n if (sendType == '20') {\n jsonObj.sendType = sendType\n jsonObj.duration = api.data.duration\n jsonObj.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\n jsonObj.url = url\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n \n // OA(actionCard)\n if (sendType == '130') {\n \n // 头部\n var head = {}\n head.bgcolor = api.data.dingDingOaHeadBgColor\n head.text = api.data.dingDingOaHeadTitle\n jsonObj.dingDingOaHead = head\n \n // body\n var body = {}\n body.title = api.data.dingDingOaTitle\n body.content = api.data.dingDingOaContent\n body.image = api.data.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\n// 飞书群机器人\nif (api.data.sendChannel == '110') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n\n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)\nreturn api;", "data": { "name": "${name}", "idType": "${idType}", diff --git a/pages/crud-view.json b/pages/crud-view.json index f1bc43f..ef1da47 100644 --- a/pages/crud-view.json +++ b/pages/crud-view.json @@ -61,6 +61,10 @@ { "label": "推送通知栏cid", "value": "80" + }, + { + "label": "飞书userId", + "value": "90" } ], "required": true @@ -193,6 +197,14 @@ { "label": "钉钉应用消息", "value": "90" + }, + { + "label": "企业微信机器人", + "value": "100" + }, + { + "label": "飞书机器人", + "value": "110" } ], "required": true @@ -230,6 +242,77 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$url}" }, + { + "type": "select", + "label": "飞书机器人", + "name": "sendAccount", + "options": [ + { + "label": "austin", + "value": "10" + }, + { + "label": "athena", + "value": "20" + } + ], + "visibleOn": "this.sendChannel == 110", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本", + "value": "10" + }, + + { + "label": "图片", + "value": "100" + }, + { + "label": "跳转卡片", + "value": "120" + }, + { + "label": "富文本", + "value": "150" + }, + { + "label": "群卡片", + "value": "160" + } + ], + "visibleOn": "this.sendChannel == 110", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "type": "input-text", + "label": "飞书内容", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 110 && this.sendType ==10 ", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "图片标识", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 110 && this.sendType ==100 ", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, { "type": "select", "label": "推送账号", diff --git a/requestHandler.md b/requestHandler.md index 15cfc5f..8d72015 100644 --- a/requestHandler.md +++ b/requestHandler.md @@ -136,6 +136,19 @@ if (api.data.sendChannel == '90') { } } +// 飞书群机器人 +if (api.data.sendChannel == '110') { + // 文本类型 + if (sendType == '10') { + jsonObj.content = content + jsonObj.sendType = sendType + } + + // 通用 + jsonObj.sendType = sendType + jsonObj.url = url +} + api.data.msgContent = JSON.stringify(jsonObj) return api;