mm_os 1.4.5 → 1.4.7
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.
- package/index.js +7 -4
- package/middleware/web_base/index.js +10 -11
- package/package.json +2 -3
- package/update.bat +1 -0
package/index.js
CHANGED
|
@@ -26,7 +26,8 @@ class Soa {
|
|
|
26
26
|
"name": "mm",
|
|
27
27
|
"title": "超级美眉",
|
|
28
28
|
"cache": "memory",
|
|
29
|
-
"lang": "zh_CN"
|
|
29
|
+
"lang": "zh_CN",
|
|
30
|
+
"game": false,
|
|
30
31
|
},
|
|
31
32
|
"web": {
|
|
32
33
|
"state": true,
|
|
@@ -119,10 +120,12 @@ Soa.prototype.initData = function(config) {
|
|
|
119
120
|
Soa.prototype.loadModule = function(config) {
|
|
120
121
|
$.com = new Com();
|
|
121
122
|
$.app = new App();
|
|
122
|
-
$.game = new Game();
|
|
123
123
|
this.com = $.com;
|
|
124
124
|
this.app = $.app;
|
|
125
|
-
|
|
125
|
+
if (conf.sys.game) {
|
|
126
|
+
$.game = new Game();
|
|
127
|
+
this.game = $.game;
|
|
128
|
+
}
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
/**
|
|
@@ -184,7 +187,7 @@ Soa.prototype.initBase = function(cg) {
|
|
|
184
187
|
$.cache = mongodb;
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
|
-
|
|
190
|
+
|
|
188
191
|
if (cg.mysql) {
|
|
189
192
|
$.sql = $.mysql_admin('sys', $.runPath);
|
|
190
193
|
$.sql.setConfig(cg.mysql);
|
|
@@ -13,13 +13,13 @@ module.exports = function(server, config) {
|
|
|
13
13
|
/**
|
|
14
14
|
* 发送文件
|
|
15
15
|
*/
|
|
16
|
-
server.use(async(ctx, next) => {
|
|
17
|
-
ctx.send = async function(src){
|
|
16
|
+
server.use(async (ctx, next) => {
|
|
17
|
+
ctx.send = async function(src) {
|
|
18
18
|
await send(ctx, src);
|
|
19
19
|
}
|
|
20
20
|
await next();
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
// 设置session 保存时长2小时
|
|
24
24
|
server.use(session({
|
|
25
25
|
maxAge: 7200
|
|
@@ -40,10 +40,10 @@ module.exports = function(server, config) {
|
|
|
40
40
|
})
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
// 解析 text/xml
|
|
45
45
|
server.use(xmlParser());
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
var func = koaBody({
|
|
48
48
|
jsonLimit: config.jsonLimit || '20mb',
|
|
49
49
|
multipart: true,
|
|
@@ -52,16 +52,15 @@ module.exports = function(server, config) {
|
|
|
52
52
|
maxFileSize: 2000 * 1024 * 1024
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
// 解析 application/json、application/x-www-form-urlencoded、text/plain
|
|
57
57
|
// 接收主体
|
|
58
|
-
server.use(async(ctx, next) => {
|
|
59
|
-
if(!ctx.request.body){
|
|
58
|
+
server.use(async (ctx, next) => {
|
|
59
|
+
if (!ctx.request.body && ctx.request.method == "POST") {
|
|
60
60
|
await func(ctx, next);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
61
|
+
} else {
|
|
63
62
|
await next();
|
|
64
63
|
}
|
|
65
64
|
});
|
|
66
65
|
return server;
|
|
67
|
-
};
|
|
66
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_os",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"description": "这是超级美眉服务端框架,用于快速构建应用程序。",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -44,12 +44,11 @@
|
|
|
44
44
|
"mm_mongodb": "^1.3.9",
|
|
45
45
|
"mm_mqtt": "^1.0.5",
|
|
46
46
|
"mm_mysql": "^1.7.1",
|
|
47
|
-
"mm_os": "^1.4.4",
|
|
48
47
|
"mm_redis": "^1.3.9",
|
|
49
48
|
"mm_ret": "^1.3.7",
|
|
50
49
|
"mm_session": "^1.4.1",
|
|
51
50
|
"mm_statics": "^1.4.0",
|
|
52
|
-
"mm_tpl": "^2.2.
|
|
51
|
+
"mm_tpl": "^2.2.5",
|
|
53
52
|
"mm_xml": "^1.1.3",
|
|
54
53
|
"mosca": "^2.8.3",
|
|
55
54
|
"mqtt": "^4.3.7"
|
package/update.bat
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm i mm_check mm_excel mm_expand mm_html mm_koa_proxy mm_logs mm_machine mm_mongodb mm_mqtt mm_mysql mm_redis mm_ret mm_session mm_statics mm_tpl mm_xml
|