feat: 升级依赖;文件结构优化;异常处理优化;

This commit is contained in:
guanhongfu
2022-04-27 10:20:40 +08:00
parent f99560aa94
commit 46370aa1f7
14 changed files with 2319 additions and 21475 deletions

View File

@@ -2,7 +2,7 @@
通过企业微信机器人发送消息。
![WeChat Work Logo](wechat-work-logo.png "WeChat Work Logo")
![WeChat Work Logo](./docs/wechat-work-logo.png "WeChat Work Logo")
<hr/>
@@ -10,7 +10,7 @@
### 纯文本格式消息
![WeChat Work message](wechat-work-msg-text.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-text.png "WeChat Work message")
```yaml
- name: WeChat Work notification by text
@@ -24,16 +24,16 @@
mentioned_mobile_list: '["13800001111","@all"]'
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 text
content | true | 文本内容,最长不超过 2048 个字节,必须是 utf8 编码
mentioned_list | false | userid 的列表,提醒群中的指定成员(@某个成员)@all表示提醒所有人,如果开发者获取不到 userid可以使用 mentioned_mobile_list必须是序列化后的 JSON 字符串
mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成员(@某个成员)@all表示提醒所有人,必须是序列化后的 JSON 字符串
| 参数 | 必须 | 说明 |
|-----------------------|-------|-------------------------------------------------------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 text |
| content | true | 文本内容,最长不超过 2048 个字节,必须是 utf8 编码 |
| mentioned_list | false | userid 的列表,提醒群中的指定成员(@某个成员)@all表示提醒所有人,如果开发者获取不到 userid可以使用 mentioned_mobile_list必须是序列化后的 JSON 字符串 |
| mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成员(@某个成员)@all表示提醒所有人,必须是序列化后的 JSON 字符串 |
### Markdown 格式消息
![WeChat Work message](wechat-work-msg-markdown.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-markdown.png "WeChat Work message")
```yaml
- name: WeChat Work notification by markdown
@@ -48,14 +48,14 @@ mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成
> VIP用户反馈:<font color=\"comment\">15例</font>"
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 markdown
content | true | markdown 内容,最长不超过 4096 个字节,必须是 utf8 编码 支持的格式详见 https://work.weixin.qq.com/api/doc/90000/90136/91770
| 参数 | 必须 | 说明 |
|---------|------|-----------------------------------------------------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 markdown |
| content | true | markdown 内容,最长不超过 4096 个字节,必须是 utf8 编码 支持的格式详见 https://work.weixin.qq.com/api/doc/90000/90136/91770 |
### 图片格式消息
![WeChat Work message](wechat-work-msg-image.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-image.png "WeChat Work message")
```yaml
- name: WeChat Work notification by image
@@ -68,15 +68,15 @@ content | true | markdown 内容,最长不超过 4096 个字节,必须是 ut
md5: 0582d8564cdee3187207666898f75205
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 image
base64 | true | 图片内容的 base64 编码 注图片base64 编码前)最大不能超过 2 M支持 JPG、PNG 格式
md5 | true | 图片内容base64 编码前)的 md5 值
| 参数 | 必须 | 说明 |
|---------|------|----------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 image |
| base64 | true | 图片内容的 base64 编码 注图片base64 编码前)最大不能超过 2 M支持 JPG、PNG 格式 |
| md5 | true | 图片内容base64 编码前)的 md5 值 |
### 图文格式消息
![WeChat Work message](wechat-work-msg-news.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-news.png "WeChat Work message")
```yaml
- name: WeChat Work notification by news
@@ -85,20 +85,20 @@ md5 | true | 图片内容base64 编码前)的 md5 值
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with:
msgtype: news
articles: '[{"title":"中秋节礼品领取","description":"今年中秋节公司有豪礼相送","url":"URL","picurl":"http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png"}]'
articles: '[{"title":"中秋节礼品领取","description":"今年中秋节公司有豪礼相送","url":"URL","picurl":"https://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png"}]'
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 news
articles | true | 图文消息,一个图文消息支持 1 到 8 条图文,必须是序列化后的 JSON 字符串
articles.title | true | 标题,不超过 128 个字节,超过会自动截断
articles.description | false | 描述,不超过 512 个字节,超过会自动截断
articles.url | false | 点击后跳转的链接。
articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式,较好的效果为大图 1068*455小图 150*150。
| 参数 | 必须 | 说明 |
|----------------------|-------|-------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 news |
| articles | true | 图文消息,一个图文消息支持 1 到 8 条图文,必须是序列化后的 JSON 字符串 |
| articles.title | true | 标题,不超过 128 个字节,超过会自动截断 |
| articles.description | false | 描述,不超过 512 个字节,超过会自动截断 |
| articles.url | false | 点击后跳转的链接。 |
| articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式,较好的效果为大图 1068*455小图 150*150。 |
### 文件格式消息
![WeChat Work message](wechat-work-msg-file.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-file.png "WeChat Work message")
```yaml
- name: WeChat Work notification by file
@@ -110,10 +110,10 @@ articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式
media_id: 3a8asd892asd8asd
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 file
media_id | true | 文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取
| 参数 | 必须 | 说明 |
|----------|------|----------------------------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 file |
| media_id | true | 文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取 |
### WECHAT_WORK_BOT_WEBHOOK