q-koa 13.1.5 → 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.
@@ -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
- appConfig.update()
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
- appConfig.update()
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.1.5",
3
+ "version": "13.1.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {