doomiwork 2.6.5 → 2.8.0
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/configuration/appsetting.js +2 -1
- package/core/controller.js +17 -5
- package/core/database/daoBase.js +3 -2
- package/core/doomiwork.js +10 -6
- package/package.json +2 -2
|
@@ -27,7 +27,8 @@ class appsetting{
|
|
|
27
27
|
* @param {*} defaultValue
|
|
28
28
|
*/
|
|
29
29
|
getSetting (settingKey,defaultValue) {
|
|
30
|
-
|
|
30
|
+
if (!this.settingjson || !this.settingjson.appsetting) return defaultValue;
|
|
31
|
+
const item= this.settingjson.appsetting[settingKey];
|
|
31
32
|
return utility.ifNull(item,defaultValue);
|
|
32
33
|
}
|
|
33
34
|
getSection(sectionName){
|
package/core/controller.js
CHANGED
|
@@ -261,8 +261,14 @@ class controller {
|
|
|
261
261
|
///提交的权限设置
|
|
262
262
|
if (this._daoModel.hasPermissionControl){
|
|
263
263
|
let param = {}
|
|
264
|
-
if (req.body.managepermission)
|
|
265
|
-
|
|
264
|
+
if (req.body.managepermission)
|
|
265
|
+
param.managepermission = JSON.parse(req.body.managepermission);
|
|
266
|
+
else
|
|
267
|
+
param.managepermission= {};
|
|
268
|
+
if (req.body.consumepermission)
|
|
269
|
+
param.consumepermission = JSON.parse(req.body.consumepermission);
|
|
270
|
+
else
|
|
271
|
+
param.consumepermission = {}
|
|
266
272
|
this._daoModel.saveDataPermissionSetting(primaryKey, param)
|
|
267
273
|
}
|
|
268
274
|
this.logUserAction(req,this._daoModel.getBusiness(),1,0);
|
|
@@ -301,8 +307,14 @@ class controller {
|
|
|
301
307
|
///提交的权限设置
|
|
302
308
|
if (this._daoModel.hasPermissionControl) {
|
|
303
309
|
let param = {}
|
|
304
|
-
if (req.body.managepermission)
|
|
305
|
-
|
|
310
|
+
if (req.body.managepermission)
|
|
311
|
+
param.managepermission = JSON.parse(req.body.managepermission);
|
|
312
|
+
else
|
|
313
|
+
param.managepermission = {}
|
|
314
|
+
if (req.body.consumepermission)
|
|
315
|
+
param.consumepermission = JSON.parse(req.body.consumepermission);
|
|
316
|
+
else
|
|
317
|
+
param.consumepermission = {}
|
|
306
318
|
this._daoModel.saveDataPermissionSetting(id, param)
|
|
307
319
|
}
|
|
308
320
|
this.logUserAction(req,this._daoModel.getBusiness(),3,0);
|
|
@@ -329,7 +341,7 @@ class controller {
|
|
|
329
341
|
return result;
|
|
330
342
|
}
|
|
331
343
|
this.logUserAction(req,this._daoModel.getBusiness(),2,0);
|
|
332
|
-
return { successed: true, id: id };
|
|
344
|
+
return { successed: true, id: id, count: result.rows.affectedRows };
|
|
333
345
|
}
|
|
334
346
|
}
|
|
335
347
|
exports = module.exports = controller;
|
package/core/database/daoBase.js
CHANGED
|
@@ -191,7 +191,9 @@ class mysqlDao extends dao{
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
async saveDataPermissionSetting(id,permissionParam){
|
|
194
|
-
if (!this.hasPermissionControl || !permissionParam) {
|
|
194
|
+
if (!this.hasPermissionControl || !permissionParam) {
|
|
195
|
+
return Promise.resolve({successed:true})
|
|
196
|
+
};
|
|
195
197
|
const sqlCommand = `
|
|
196
198
|
replace into vmv3_data_permission(
|
|
197
199
|
data_type,
|
|
@@ -242,7 +244,6 @@ class mysqlDao extends dao{
|
|
|
242
244
|
'${mItem.usertext || ''}'
|
|
243
245
|
)`)
|
|
244
246
|
}
|
|
245
|
-
console.log('permission sql', subItem.join(','))
|
|
246
247
|
return this.executeSql(sqlCommand+subItem.join(','));
|
|
247
248
|
}
|
|
248
249
|
/**
|
package/core/doomiwork.js
CHANGED
|
@@ -10,7 +10,7 @@ const path = require('path')
|
|
|
10
10
|
const {redisHelper,logHelper} = require('doomi-helper');
|
|
11
11
|
class Doomiwork {
|
|
12
12
|
static startWork(application) {
|
|
13
|
-
|
|
13
|
+
const startupRoot = process.cwd();
|
|
14
14
|
///将configuration对象放置于app对象中.所有的controller都可以使用
|
|
15
15
|
application.config = config;
|
|
16
16
|
///启动redis进行缓存
|
|
@@ -19,11 +19,15 @@ class Doomiwork {
|
|
|
19
19
|
application.redis = redisHelper.getInstance();
|
|
20
20
|
}
|
|
21
21
|
////记录用户行为的日志记录器
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const logHandler = config.getSetting("logaction", null)
|
|
23
|
+
if (logHandler){
|
|
24
|
+
let actionLogger = path.join(startupRoot, logHandler);
|
|
25
|
+
if (actionLogger && fs.existsSync(actionLogger)) {
|
|
26
|
+
const logInstance = require(actionLogger);
|
|
27
|
+
application.actionLogger = new logInstance();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
27
31
|
application.logger = logHelper.getInstance().getLogger("framework");
|
|
28
32
|
|
|
29
33
|
/**全局所有请求拦截器 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doomiwork",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "doomisoft nodejs web framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "stephen.shen",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"doomi-helper": "^2.1
|
|
16
|
+
"doomi-helper": "^2.3.1",
|
|
17
17
|
"express": "^4.17.1",
|
|
18
18
|
"moment": "^2.29.1",
|
|
19
19
|
"mysql": "^2.18.1",
|