q-koa 13.1.4 → 13.1.6
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/app.js
CHANGED
|
@@ -1207,6 +1207,19 @@ class APP {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
return target
|
|
1209
1209
|
}
|
|
1210
|
+
|
|
1211
|
+
if (
|
|
1212
|
+
where.hasOwnProperty('id') &&
|
|
1213
|
+
typeof where.id === 'string' &&
|
|
1214
|
+
where.id.includes('/')
|
|
1215
|
+
) {
|
|
1216
|
+
const _result = await _.get(
|
|
1217
|
+
app[appName].controller,
|
|
1218
|
+
where.id.replace('/', '.')
|
|
1219
|
+
)(ctx)
|
|
1220
|
+
where.id = _result
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1210
1223
|
const formatWhere = _.mapValues(where, (item) => {
|
|
1211
1224
|
if (!_.isObject(item)) return item
|
|
1212
1225
|
return formatObj(item)
|
|
@@ -1,14 +1,40 @@
|
|
|
1
|
-
const { getAppByCtx, getConfig } = require('q-koa')
|
|
1
|
+
const { getAppByCtx, getConfig, lodash, is_dev } = require('q-koa')
|
|
2
2
|
|
|
3
3
|
exports.upsert = async (ctx) => {
|
|
4
4
|
const { app } = getAppByCtx(ctx)
|
|
5
5
|
const appConfig = getConfig(app)
|
|
6
|
-
|
|
6
|
+
const { id } = ctx.request.body
|
|
7
|
+
if (!id) return
|
|
8
|
+
const current_list = await app.model.setting.findAll({
|
|
9
|
+
where: {
|
|
10
|
+
id,
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
if (
|
|
14
|
+
current_list.some(
|
|
15
|
+
(o) => (o.extra && !lodash.isEmpty(o.extra)) || o.is_front || o.is_cache
|
|
16
|
+
)
|
|
17
|
+
) {
|
|
18
|
+
appConfig.update()
|
|
19
|
+
}
|
|
7
20
|
}
|
|
8
21
|
|
|
9
22
|
exports.bulkUpdate = async (ctx) => {
|
|
10
23
|
const { app } = getAppByCtx(ctx)
|
|
11
|
-
|
|
12
24
|
const appConfig = getConfig(app)
|
|
13
|
-
|
|
25
|
+
const { list = [] } = ctx.request.body
|
|
26
|
+
|
|
27
|
+
if (list.length === 0) return
|
|
28
|
+
const current_list = await app.model.setting.findAll({
|
|
29
|
+
where: {
|
|
30
|
+
id: list.map((item) => item.id),
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
if (
|
|
34
|
+
current_list.some(
|
|
35
|
+
(o) => (o.extra && !lodash.isEmpty(o.extra)) || o.is_front || o.is_cache
|
|
36
|
+
)
|
|
37
|
+
) {
|
|
38
|
+
appConfig.update()
|
|
39
|
+
}
|
|
14
40
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
name: '设置',
|
|
3
|
+
belongs: 'page',
|
|
4
|
+
multiple: false,
|
|
5
|
+
model: 'setting',
|
|
6
|
+
availableSort: false,
|
|
7
|
+
order: [],
|
|
8
|
+
referenceSelect: [],
|
|
9
|
+
select: ['id', 'code', 'name', 'is_front', 'is_cache', 'is_control', 'extra'],
|
|
10
|
+
excludes: [],
|
|
11
|
+
limit: 20,
|
|
12
|
+
defaultOrder: [],
|
|
13
|
+
comment: {},
|
|
14
|
+
sortOrder: 1,
|
|
15
|
+
reference: [],
|
|
16
|
+
excludeAuth: [],
|
|
17
|
+
initList: [],
|
|
18
|
+
initTableList: [],
|
|
19
|
+
editInline: {},
|
|
20
|
+
autoData: {},
|
|
21
|
+
is_split: false,
|
|
22
|
+
is_split_count: false,
|
|
23
|
+
show_virtual: true,
|
|
24
|
+
modelQuery: {},
|
|
25
|
+
modelUpsert: {},
|
|
26
|
+
modelDelete: {},
|
|
27
|
+
deleteCheckList: [],
|
|
28
|
+
bulkCreateList: [],
|
|
29
|
+
indexList: [],
|
|
30
|
+
}
|