ee-core 1.3.2 → 1.3.3

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.
@@ -222,6 +222,10 @@ module.exports = appInfo => {
222
222
  },
223
223
  body: {
224
224
  multipart: true, // 文件类型
225
+ },
226
+ filterRequest: {
227
+ uris: [],
228
+ returnData: ''
225
229
  }
226
230
  };
227
231
 
@@ -8,6 +8,7 @@ const koaBody = require('koa-body');
8
8
  const https = require('https');
9
9
  const fs = require('fs');
10
10
  const path = require('path');
11
+ const _ = require('lodash');
11
12
 
12
13
  /**
13
14
  * http server
@@ -77,6 +78,7 @@ class HttpServer {
77
78
  * 路由分发
78
79
  */
79
80
  async dispatch (ctx, next) {
81
+ const config = ctx.eeApp.config.httpServer;
80
82
  let uriPath = ctx.request.path;
81
83
  const method = ctx.request.method;
82
84
  let params = ctx.request.query;
@@ -96,6 +98,12 @@ class HttpServer {
96
98
  if (uriPath.indexOf('/') == 0) {
97
99
  uriPath = uriPath.substring(1);
98
100
  }
101
+ // 过滤
102
+ if (_.includes(config.filterRequest.uris, uriPath)) {
103
+ ctx.response.body = config.filterRequest.returnData;
104
+ await next();
105
+ return
106
+ }
99
107
  if (uriPath.slice(0, 10) != 'controller') {
100
108
  uriPath = 'controller/' + uriPath;
101
109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-core",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "ee core",
5
5
  "main": "index.js",
6
6
  "scripts": {