q-koa 11.2.4 → 11.3.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.
|
@@ -161,6 +161,13 @@ exports.modelQuery = {
|
|
|
161
161
|
defaultValue: {},
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
exports.modelUpsert = {
|
|
165
|
+
type: Sequelize.JSON,
|
|
166
|
+
comment: '默认插入值',
|
|
167
|
+
allowNull: false,
|
|
168
|
+
defaultValue: {},
|
|
169
|
+
}
|
|
170
|
+
|
|
164
171
|
exports.editInline = {
|
|
165
172
|
type: Sequelize.JSON,
|
|
166
173
|
comment: '局部更新',
|
|
@@ -101,6 +101,7 @@ exports.loadModel = async ({ app, appName }) => {
|
|
|
101
101
|
is_split_count: config.is_split_count,
|
|
102
102
|
show_virtual: config.show_virtual,
|
|
103
103
|
modelQuery: config.modelQuery,
|
|
104
|
+
modelUpsert: config.modelUpsert,
|
|
104
105
|
editInline: config.editInline,
|
|
105
106
|
deleteCheckList: config.deleteCheckList,
|
|
106
107
|
bulkCreateList: config.bulkCreateList,
|
|
@@ -181,6 +181,8 @@ exports.showTables = async (ctx) => {
|
|
|
181
181
|
comment: lodash.get(target, 'comment', {}),
|
|
182
182
|
// 默认查询,覆盖之前
|
|
183
183
|
modelQuery: lodash.get(target, 'modelQuery', {}),
|
|
184
|
+
// 插入字段,覆盖之前
|
|
185
|
+
modelUpsert: lodash.get(target, 'modelUpsert', {}),
|
|
184
186
|
// 删除时检查是不是含有
|
|
185
187
|
deleteCheckList: lodash.get(target, 'deleteCheckList', []),
|
|
186
188
|
// 批量更新字段
|
package/core/file/utils/index.js
CHANGED
|
@@ -6,7 +6,8 @@ const findConfig = (type) => (item) =>
|
|
|
6
6
|
item.config === type ||
|
|
7
7
|
item.pay_config === type ||
|
|
8
8
|
(item.ToUserName && item.ToUserName === type) ||
|
|
9
|
-
(item.appId && item.appId === type)
|
|
9
|
+
(item.appId && item.appId === type) ||
|
|
10
|
+
(item.id && item.id === type)
|
|
10
11
|
|
|
11
12
|
exports.getSetting = (config) => (type) =>
|
|
12
13
|
config.find((i) => i.key === type).value
|
|
@@ -176,12 +177,11 @@ exports.getImageType = (fileBuffer) => {
|
|
|
176
177
|
return ''
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
exports.getAppConfig = async ({ app, config, key, app_id }) => {
|
|
180
|
-
if (!(app && (config || key || app_id))) return null
|
|
180
|
+
exports.getAppConfig = async ({ app, config, key, app_id, id }) => {
|
|
181
|
+
if (!(app && (config || key || app_id || id))) return null
|
|
181
182
|
const application =
|
|
182
183
|
app.cache.get('application') || (await app.model.application.findAll())
|
|
183
|
-
|
|
184
|
-
const target = application.find(findConfig(config || key || app_id))
|
|
184
|
+
const target = application.find(findConfig(config || key || app_id || id))
|
|
185
185
|
|
|
186
186
|
return target || null
|
|
187
187
|
}
|