q-koa 13.8.9 → 13.8.10
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.
|
@@ -29,13 +29,6 @@ exports.copyOther = async (ctx) => {
|
|
|
29
29
|
const list = await app.model.setting.findAll()
|
|
30
30
|
|
|
31
31
|
const findType = list.find((item) => item.code === type)
|
|
32
|
-
if (findType && findType.parent_id) {
|
|
33
|
-
await app.model.setting.upsert({
|
|
34
|
-
id: findType.id,
|
|
35
|
-
value: copyType.value,
|
|
36
|
-
})
|
|
37
|
-
return ctx.SUCCESS('ok')
|
|
38
|
-
}
|
|
39
32
|
const copyList = data.filter((item) => item.parent_id === copyType.id)
|
|
40
33
|
|
|
41
34
|
if (!findType) {
|
|
@@ -52,24 +45,33 @@ exports.copyOther = async (ctx) => {
|
|
|
52
45
|
}
|
|
53
46
|
})
|
|
54
47
|
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
where: {
|
|
58
|
-
parent_id: findType.id,
|
|
59
|
-
},
|
|
60
|
-
})
|
|
48
|
+
return ctx.SUCCESS('ok')
|
|
49
|
+
}
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
)
|
|
51
|
+
if (findType.parent_id) {
|
|
52
|
+
await app.model.setting.upsert({
|
|
53
|
+
id: findType.id,
|
|
54
|
+
value: copyType.value,
|
|
55
|
+
})
|
|
56
|
+
return ctx.SUCCESS('ok')
|
|
71
57
|
}
|
|
72
58
|
|
|
59
|
+
await app.model.setting.destroy({
|
|
60
|
+
where: {
|
|
61
|
+
parent_id: findType.id,
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
await app.model.setting.bulkCreate(
|
|
66
|
+
copyList.map((item) => {
|
|
67
|
+
const { parent, id, ...rest } = item
|
|
68
|
+
return {
|
|
69
|
+
...rest,
|
|
70
|
+
parent_id: findType.id,
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
)
|
|
74
|
+
|
|
73
75
|
ctx.SUCCESS('ok')
|
|
74
76
|
}
|
|
75
77
|
|