q-koa 8.7.0 → 8.7.1

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.
@@ -17,17 +17,21 @@ exports.getList = (config) => (type) => {
17
17
 
18
18
  exports.getObject = (config, app) => async (type) => {
19
19
  const obj = config.find((i) => i.code === type)
20
- if (!obj) throw new Error(`找不到${type}相关设置`)
21
- const list = config.filter((i) => i.parent_id === obj.id)
20
+ let flag = false
22
21
  const temObj = {}
23
- for (let i = 0; i < list.length; i++) {
24
- if (list[i].type === 'decimal') {
25
- temObj[list[i].code] = Number(list[i].value)
26
- } else if (list[i].type === 'switch') {
27
- temObj[list[i].code] = Boolean(Number(list[i].value))
28
- } else {
29
- temObj[list[i].code] = list[i].value
22
+ if (obj) {
23
+ const list = config.filter((i) => i.parent_id === obj.id)
24
+
25
+ for (let i = 0; i < list.length; i++) {
26
+ if (list[i].type === 'decimal') {
27
+ temObj[list[i].code] = Number(list[i].value)
28
+ } else if (list[i].type === 'switch') {
29
+ temObj[list[i].code] = Boolean(Number(list[i].value))
30
+ } else {
31
+ temObj[list[i].code] = list[i].value
32
+ }
30
33
  }
34
+ flag = true
31
35
  }
32
36
 
33
37
  const findConfig = (item) => item.config === type || item.pay_config === type
@@ -38,6 +42,7 @@ exports.getObject = (config, app) => async (type) => {
38
42
  applicationList.find(findConfig) &&
39
43
  applicationList.find(findConfig)
40
44
  ) {
45
+ flag = true
41
46
  return {
42
47
  ...applicationList.find(findConfig),
43
48
  ...temObj,
@@ -53,6 +58,7 @@ exports.getObject = (config, app) => async (type) => {
53
58
 
54
59
  const target = result.find(findConfig)
55
60
  if (target) {
61
+ flag = true
56
62
  return {
57
63
  ...target,
58
64
  ...temObj,
@@ -62,7 +68,7 @@ exports.getObject = (config, app) => async (type) => {
62
68
  }
63
69
  }
64
70
  }
65
-
71
+ if (!flag) throw new Error(`找不到${type}相关设置`)
66
72
  return temObj
67
73
  }
68
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "8.7.0",
3
+ "version": "8.7.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {