q-koa 12.4.6 → 12.5.0

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.
package/core/config.js CHANGED
@@ -142,7 +142,7 @@ module.exports = {
142
142
  router.get('/cache/clear', app.controller.cache.clear)
143
143
  router.get('/cache/getAll', app.controller.cache.getAll)
144
144
  }
145
- if (app.model.weixin) {
145
+ if (app.controller.weixin) {
146
146
  router.get('/weixin/h5_login', app.controller.weixin.h5_login)
147
147
  router.get(
148
148
  '/weixin/h5_login_callback',
@@ -6,9 +6,37 @@ const is_dev = process.env.NODE_ENV !== 'production'
6
6
  exports.push = async ({ app, appName = '通知', url, message }) => {
7
7
  const log_push_url = lodash.get(
8
8
  app,
9
- 'appConfig.log_push_url',
9
+ 'appConfig.log.url',
10
10
  'https://api.day.app/ieaRfoE3LiPveGbY5qmUwk'
11
11
  )
12
+
13
+ const log_push_excludes = lodash.get(app, 'appConfig.log.excludes', {
14
+ url: [],
15
+ message: [
16
+ '账号密码错误',
17
+ 'read ETIMEDOUT',
18
+ 'Parse Error',
19
+ 'request aborted',
20
+ '没有权限或登录失效,请重新登录',
21
+ 'request aborted',
22
+ 'Parse Error',
23
+ ],
24
+ })
25
+ if (
26
+ url &&
27
+ log_push_excludes.url &&
28
+ log_push_excludes.url.some((i) => i.includes(url))
29
+ ) {
30
+ return
31
+ }
32
+
33
+ if (
34
+ message &&
35
+ log_push_excludes.message &&
36
+ log_push_excludes.message.some((i) => i.includes(message))
37
+ ) {
38
+ return
39
+ }
12
40
  if (log_push_url) {
13
41
  const appConfig = getConfig(app)
14
42
  const { site_name, logo_image, logo_img } = await appConfig.getObject(
@@ -61,7 +61,7 @@ module.exports = class Singleton {
61
61
  if (data.message === '查询无结果') {
62
62
  throw new Error(`找不到【${name}】,可能需要更详细一点(省市区)`)
63
63
  } else {
64
- throw new Error(`${this.key.split('-')[0]}${data.message}`)
64
+ throw new Error(`${this.key.split('-')[0]} ${name} ${data.message}`)
65
65
  }
66
66
  }
67
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "12.4.6",
3
+ "version": "12.5.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {