ee-core 2.7.0 → 2.7.1

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.
@@ -23,7 +23,7 @@ class ForkProcess {
23
23
  processOptions: {
24
24
  cwd: cwd,
25
25
  env: Ps.allEnv(),
26
- stdio: 'pipe'
26
+ stdio: 'ignore' // pipe
27
27
  }
28
28
  }, opt);
29
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-core",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
4
4
  "description": "ee core",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/ps/index.js CHANGED
@@ -5,7 +5,7 @@ const eis = require('../utils/is');
5
5
  * 初始化模式
6
6
  */
7
7
  exports.initMode = function(mode) {
8
- // process.env.EE_MODE === undefined
8
+ if(process.env.EE_MODE !== undefined)return
9
9
  return process.env.EE_MODE = mode ? mode : 'framework';
10
10
  }
11
11
 
@@ -29,13 +29,13 @@ class HttpServer {
29
29
  throw new Error('[ee-core] [socket/HttpServer] http port required, and must be a number !');
30
30
  }
31
31
 
32
- this.create();
32
+ this._create();
33
33
  }
34
34
 
35
35
  /**
36
36
  * 创建服务
37
37
  */
38
- create () {
38
+ _create () {
39
39
  const app = this.app;
40
40
  const httpServer = this.options;
41
41
  const isHttps = httpServer?.https?.enable ?? false;
@@ -62,7 +62,7 @@ class HttpServer {
62
62
  ctx.eeApp = app;
63
63
  await next();
64
64
  })
65
- .use(this.dispatch);
65
+ .use(this._dispatch);
66
66
 
67
67
  let msg = '[ee-core] [socket/http] server is: ' + url;
68
68
 
@@ -86,13 +86,14 @@ class HttpServer {
86
86
  /**
87
87
  * 路由分发
88
88
  */
89
- async dispatch (ctx, next) {
89
+ async _dispatch (ctx, next) {
90
90
  const config = ctx.eeApp.config.httpServer;
91
91
  let uriPath = ctx.request.path;
92
92
  const method = ctx.request.method;
93
93
  let params = ctx.request.query;
94
94
  params = is.object(params) ? JSON.parse(JSON.stringify(params)) : {};
95
95
  const body = ctx.request.body;
96
+ const files = ctx.request.files;
96
97
 
97
98
  // 默认
98
99
  ctx.response.status = 200;
@@ -117,7 +118,10 @@ class HttpServer {
117
118
  uriPath = 'controller/' + uriPath;
118
119
  }
119
120
  const cmd = uriPath.split('/').join('.');
120
- const args = (method == 'POST') ? body : params;
121
+ const args = (method == 'POST') ? (ctx.request.header['content-type'] && ctx.request.header['content-type'].startsWith('multipart/form-data;') ? files : body) : params;
122
+ args.files = ctx.request.files;
123
+ args.body = ctx.request.body;
124
+ args.query = ctx.request.query;
121
125
  let fn = null;
122
126
  if (is.string(cmd)) {
123
127
  const actions = cmd.split('.');
@@ -140,4 +144,4 @@ class HttpServer {
140
144
  }
141
145
  }
142
146
 
143
- module.exports = HttpServer;
147
+ module.exports = HttpServer;