q-koa 8.6.2 → 8.6.5
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.
|
@@ -219,7 +219,7 @@ exports.getTable = async (ctx) => {
|
|
|
219
219
|
).forEach((attr) => {
|
|
220
220
|
obj[attr] = lodash.merge(
|
|
221
221
|
app.attributes[model][attr],
|
|
222
|
-
result[attr],
|
|
222
|
+
lodash.omitBy(result[attr], lodash.isNull),
|
|
223
223
|
app.config[_model].comment && app.config[_model].comment
|
|
224
224
|
? app.config[_model].comment[attr]
|
|
225
225
|
: {}
|
|
@@ -229,7 +229,7 @@ exports.getTable = async (ctx) => {
|
|
|
229
229
|
Object.keys(result).forEach((attr) => {
|
|
230
230
|
obj[attr] = lodash.merge(
|
|
231
231
|
app.attributes[model][attr],
|
|
232
|
-
result[attr],
|
|
232
|
+
lodash.omitBy(result[attr], lodash.isNull),
|
|
233
233
|
app.config[_model].comment && app.config[_model].comment
|
|
234
234
|
? app.config[_model].comment[attr]
|
|
235
235
|
: {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const md5 = require('js-md5')
|
|
2
2
|
const { getAppByCtx, getConfig, lodash } = require('q-koa')
|
|
3
|
-
|
|
3
|
+
const { getAppConfig } = require('../../utils')
|
|
4
4
|
exports.login = async (ctx) => {
|
|
5
5
|
const { app, appName } = getAppByCtx(ctx)
|
|
6
6
|
const { mobile, password, ...rest } = ctx.request.body
|
|
@@ -259,11 +259,20 @@ exports.checkLogin = async (ctx) => {
|
|
|
259
259
|
return app.model[m] !== i.model
|
|
260
260
|
})
|
|
261
261
|
})
|
|
262
|
+
const { exclude_list = [] } = await getAppConfig({ app, config })
|
|
263
|
+
const attributes = {
|
|
264
|
+
exclude: Array.from(
|
|
265
|
+
new Set([
|
|
266
|
+
...app.appConfig.loginData.attributes.exclude,
|
|
267
|
+
...(Array.isArray(exclude_list) ? exclude_list : []),
|
|
268
|
+
])
|
|
269
|
+
),
|
|
270
|
+
}
|
|
262
271
|
result = await app.model.user.findOne({
|
|
263
272
|
where: {
|
|
264
273
|
id: ctx.request[`${appName}-user`].id,
|
|
265
274
|
},
|
|
266
|
-
attributes
|
|
275
|
+
attributes,
|
|
267
276
|
include,
|
|
268
277
|
})
|
|
269
278
|
} else {
|
package/core/file/utils/index.js
CHANGED
|
@@ -140,3 +140,13 @@ exports.getImageType = (fileBuffer) => {
|
|
|
140
140
|
// 未能识别到该文件类型
|
|
141
141
|
return ''
|
|
142
142
|
}
|
|
143
|
+
|
|
144
|
+
exports.getAppConfig = async ({ app, config }) => {
|
|
145
|
+
if (!config || !app) return null
|
|
146
|
+
const application =
|
|
147
|
+
app.cache.get('application') || (await app.model.application.findAll())
|
|
148
|
+
|
|
149
|
+
const target = application.find((a) => a.config === config)
|
|
150
|
+
|
|
151
|
+
return target
|
|
152
|
+
}
|