q-koa 9.5.0 → 9.5.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.
@@ -404,13 +404,9 @@ exports.verify = async (ctx) => {
404
404
  ctx.SUCCESS(result)
405
405
  }
406
406
 
407
- exports.express = async (ctx) => {
408
- const { app } = getAppByCtx(ctx)
407
+ const expressFn = async ({ app, express_number: _express_number }) => {
409
408
  const appConfig = getConfig(app)
410
409
  const { app_code, express_mobile } = await appConfig.getObject('express')
411
-
412
- const { express_number: _express_number } = ctx.request.body
413
-
414
410
  const express_number = _express_number.replace(/\t/, '').trim()
415
411
 
416
412
  const lastFour = express_mobile
@@ -431,7 +427,7 @@ exports.express = async (ctx) => {
431
427
  moment().diff(moment(history.result.updateTime), 'days') > 30
432
428
 
433
429
  if (diffNoLong || isTooLong) {
434
- return ctx.SUCCESS(history.result)
430
+ return history.result
435
431
  }
436
432
  }
437
433
  }
@@ -461,9 +457,34 @@ exports.express = async (ctx) => {
461
457
  }
462
458
  }
463
459
 
464
- ctx.SUCCESS(result)
460
+ return result
465
461
  } catch (e) {
466
- return ctx.SUCCESS(null)
462
+ return null
463
+ }
464
+ }
465
+ exports.express = async (ctx) => {
466
+ const { app } = getAppByCtx(ctx)
467
+
468
+ const { express_number } = ctx.request.body
469
+
470
+ if (Array.isArray(express_number)) {
471
+ const result = await Promise.all(
472
+ express_number.map((item) => {
473
+ return expressFn({
474
+ app,
475
+ express_number: item,
476
+ })
477
+ })
478
+ )
479
+
480
+ return ctx.SUCCESS(result)
481
+ } else {
482
+ const result = await expressFn({
483
+ app,
484
+ express_number,
485
+ })
486
+
487
+ return ctx.SUCCESS(result)
467
488
  }
468
489
  }
469
490
 
@@ -198,9 +198,13 @@ exports.showTables = async (ctx) => {
198
198
  exports.getTable = async (ctx) => {
199
199
  const { app } = getAppByCtx(ctx)
200
200
 
201
- const { model: _model, show_virtual = false } = ctx.request.body
201
+ const {
202
+ model: _model,
203
+ show_virtual = false,
204
+ is_cache = true,
205
+ } = ctx.request.body
202
206
 
203
- if (app.cache && app.cache.get(`${_model}-table`)) {
207
+ if (is_cache && app.cache && app.cache.get(`${_model}-table`)) {
204
208
  return ctx.SUCCESS(app.cache.get(`${_model}-table`))
205
209
  }
206
210
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "9.5.0",
3
+ "version": "9.5.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {