mali-applet-ui 1.1.44 → 1.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/env/index.js +28 -8
  2. package/package.json +1 -1
package/env/index.js CHANGED
@@ -267,18 +267,38 @@ function sendMail ({ receivedBy, subject, html }) {
267
267
  })
268
268
  }
269
269
 
270
- function sendQyWechatMsg (webhook, params) {
270
+ function sendQyWechatMsg (webhook, opts) {
271
271
  if (!webhook) {
272
272
  throw new Error('企微机器人 webhook 地址不能为空')
273
273
  }
274
- return axios.post(webhook, {
275
- msgtype: params.msgtype || 'markdown',
276
- [params.msgtype || 'markdown']: {
277
- content: params.content || '',
278
- mentioned_list: params.mentionedList || [],
279
- mentioned_mobile_list: params.mentionedMobileList || []
274
+ let params = {
275
+ msgtype: 'markdown',
276
+ markdown: {
277
+ content: opts.content || ''
280
278
  }
281
- }).then(res => {
279
+ }
280
+ switch (opts.msgType) {
281
+ case 'text':
282
+ params = {
283
+ msgtype: 'text',
284
+ image: {
285
+ content: opts.content || '',
286
+ mentioned_list: opts.mentionedList || [],
287
+ mentioned_mobile_list: opts.mentionedMobileList || []
288
+ }
289
+ }
290
+ break
291
+ case 'image':
292
+ params = {
293
+ msgtype: 'image',
294
+ image: {
295
+ base64: opts.base64 || '',
296
+ md5: opts.md5 || ''
297
+ }
298
+ }
299
+ break
300
+ }
301
+ return axios.post(webhook, params).then(res => {
282
302
  return res.data
283
303
  })
284
304
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.44",
3
+ "version": "1.1.45",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",