q-koa 13.0.1 → 13.0.2

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.
@@ -150,19 +150,29 @@ exports.login = async (ctx) => {
150
150
  ].filter((item) => item.model)
151
151
  : []
152
152
  if (app.appConfig.loginData) {
153
+ const application = await getAppConfig({ app, config })
154
+
155
+ const loginData = lodash.mergeWith(
156
+ app.appConfig.loginData,
157
+ lodash.get(application, 'loginData', {}),
158
+ (objValue, srcValue) => {
159
+ if (lodash.isArray(objValue)) {
160
+ return objValue.concat(srcValue)
161
+ }
162
+ }
163
+ )
153
164
  const include = includeDefault.filter((i) => {
154
- return app.appConfig.loginData.excludeInclude.every((m) => {
165
+ return loginData.excludeInclude.every((m) => {
155
166
  return app.model[m] !== i.model
156
167
  })
157
168
  })
158
169
 
159
- const application = await getAppConfig({ app, config })
160
170
  const exclude_list = lodash.get(application, 'exclude_list', [])
161
171
 
162
172
  const attributes = {
163
173
  exclude: Array.from(
164
174
  new Set([
165
- ...app.appConfig.loginData.attributes.exclude,
175
+ ...loginData.attributes.exclude,
166
176
  ...(Array.isArray(exclude_list) ? exclude_list : []),
167
177
  ])
168
178
  ),
@@ -342,20 +352,31 @@ exports.checkLogin = async (ctx) => {
342
352
  },
343
353
  ...app.include.user,
344
354
  ].filter((item) => item.model)
355
+
345
356
  if (app.appConfig.loginData) {
357
+ const application = await getAppConfig({ app, config })
358
+
359
+ const loginData = lodash.mergeWith(
360
+ app.appConfig.loginData,
361
+ lodash.get(application, 'loginData', {}),
362
+ (objValue, srcValue) => {
363
+ if (lodash.isArray(objValue)) {
364
+ return objValue.concat(srcValue)
365
+ }
366
+ }
367
+ )
346
368
  const include = includeDefault.filter((i) => {
347
- return app.appConfig.loginData.excludeInclude.every((m) => {
369
+ return loginData.excludeInclude.every((m) => {
348
370
  return app.model[m] !== i.model
349
371
  })
350
372
  })
351
373
 
352
- const application = await getAppConfig({ app, config })
353
374
  const exclude_list = lodash.get(application, 'exclude_list', [])
354
375
 
355
376
  const attributes = {
356
377
  exclude: Array.from(
357
378
  new Set([
358
- ...app.appConfig.loginData.attributes.exclude,
379
+ ...loginData.attributes.exclude,
359
380
  ...(Array.isArray(exclude_list) ? exclude_list : []),
360
381
  ])
361
382
  ),
@@ -442,12 +442,24 @@ exports.mp_login = async (ctx) => {
442
442
  ].filter((item) => item.model)
443
443
 
444
444
  if (app.appConfig.loginData) {
445
+ const application = await getAppConfig({ app, config })
446
+ const loginData = lodash.mergeWith(
447
+ app.appConfig.loginData,
448
+ lodash.get(application, 'loginData', {}),
449
+ (objValue, srcValue) => {
450
+ if (lodash.isArray(objValue)) {
451
+ return objValue.concat(srcValue)
452
+ }
453
+ }
454
+ )
445
455
  const include = includeDefault.filter((i) => {
446
- return app.appConfig.loginData.excludeInclude.every((m) => {
456
+ return loginData.excludeInclude.every((m) => {
447
457
  return app.model[m] !== i.model
448
458
  })
449
459
  })
450
- const { exclude_list = [] } = await getAppConfig({ app, config })
460
+
461
+ const exclude_list = lodash.get(application, 'exclude_list', [])
462
+
451
463
  const attributes = {
452
464
  exclude: Array.from(
453
465
  new Set([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.0.1",
3
+ "version": "13.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {