midway-fatcms 0.0.1-beta.68 → 0.0.1-beta.70
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/dist/config/config.default.js +1 -0
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +1 -0
- package/dist/controller/gateway/CrudStdGatewayController.js +7 -13
- package/dist/controller/gateway/PublicApiController.d.ts +2 -1
- package/dist/controller/gateway/PublicApiController.js +31 -37
- package/dist/controller/manage/AppMangeApi.d.ts +3 -1
- package/dist/controller/manage/AppMangeApi.js +13 -0
- package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -0
- package/dist/controller/manage/SysConfigMangeApi.js +9 -2
- package/dist/controller/manage/UserAccountManageApi.d.ts +4 -2
- package/dist/controller/manage/UserAccountManageApi.js +24 -0
- package/dist/controller/manage/WorkbenchMangeApi.js +2 -2
- package/dist/controller/render/AppRenderController.d.ts +1 -0
- package/dist/controller/render/AppRenderController.js +6 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/libs/crud-pro/interfaces.d.ts +1 -0
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +2 -2
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +2 -4
- package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.d.ts +1 -1
- package/dist/libs/crud-pro/utils/sqlConvert/convertMsSql.js +4 -1
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.d.ts +1 -1
- package/dist/libs/crud-pro/utils/sqlConvert/convertPgSql.js +4 -1
- package/dist/models/bizmodels.d.ts +4 -3
- package/dist/models/bizmodels.js +4 -3
- package/dist/service/EnumInfoService.d.ts +1 -0
- package/dist/service/EnumInfoService.js +10 -17
- package/dist/service/SysAppService.d.ts +14 -0
- package/dist/service/SysAppService.js +96 -0
- package/dist/service/SysConfigService.d.ts +3 -0
- package/dist/service/SysConfigService.js +29 -12
- package/dist/service/WorkbenchService.d.ts +10 -5
- package/dist/service/WorkbenchService.js +54 -42
- package/dist/service/base/cache/CacheServiceFactory.d.ts +5 -0
- package/dist/service/base/cache/CacheServiceFactory.js +6 -1
- package/dist/service/crudstd/CrudStdService.d.ts +2 -14
- package/dist/service/crudstd/CrudStdService.js +6 -39
- package/dist/service/curd/CrudProQuick.d.ts +9 -3
- package/dist/service/curd/CrudProQuick.js +19 -3
- package/dist/service/curd/CurdMixByAccountService.js +4 -4
- package/dist/service/curd/CurdMixBySysConfigService.js +2 -2
- package/dist/service/curd/CurdMixByWorkbenchService.js +2 -2
- package/package.json +1 -1
- package/src/config/config.default.ts +1 -0
- package/src/controller/gateway/CrudStdGatewayController.ts +7 -13
- package/src/controller/gateway/PublicApiController.ts +39 -49
- package/src/controller/manage/AppMangeApi.ts +14 -1
- package/src/controller/manage/SysConfigMangeApi.ts +16 -8
- package/src/controller/manage/UserAccountManageApi.ts +28 -0
- package/src/controller/manage/WorkbenchMangeApi.ts +2 -2
- package/src/controller/render/AppRenderController.ts +5 -14
- package/src/index.ts +1 -0
- package/src/libs/crud-pro/interfaces.ts +1 -0
- package/src/libs/crud-pro/models/SqlCfgModel.ts +1 -0
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +2 -2
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +15 -17
- package/src/libs/crud-pro/utils/sqlConvert/convertMsSql.ts +5 -1
- package/src/libs/crud-pro/utils/sqlConvert/convertPgSql.ts +6 -1
- package/src/models/bizmodels.ts +5 -3
- package/src/service/EnumInfoService.ts +9 -22
- package/src/service/SysAppService.ts +88 -0
- package/src/service/SysConfigService.ts +30 -16
- package/src/service/WorkbenchService.ts +78 -61
- package/src/service/base/cache/CacheServiceFactory.ts +12 -1
- package/src/service/crudstd/CrudStdService.ts +7 -43
- package/src/service/curd/CrudProQuick.ts +22 -3
- package/src/service/curd/CurdMixByAccountService.ts +4 -4
- package/src/service/curd/CurdMixBySysConfigService.ts +3 -2
- package/src/service/curd/CurdMixByWorkbenchService.ts +2 -2
|
@@ -156,6 +156,7 @@ exports.default = (appInfo) => {
|
|
|
156
156
|
cacheConfig: {
|
|
157
157
|
UserSessionBySessionId: { cacheLevel: 'REDIS', cacheSecond: 3600 * 24 * 30 },
|
|
158
158
|
UserSessionByAsyncTaskId: { cacheLevel: 'REDIS', cacheSecond: 3600 },
|
|
159
|
+
CurdMixByLinkToCustom: { cacheLevel: 'MEMORY', cacheSecond: 60 * 5 },
|
|
159
160
|
}
|
|
160
161
|
},
|
|
161
162
|
// 用户会话保持时间,单位秒
|
|
@@ -16,6 +16,7 @@ const CrudStdService_1 = require("../../service/crudstd/CrudStdService");
|
|
|
16
16
|
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
17
17
|
const common_dto_1 = require("../../libs/utils/common-dto");
|
|
18
18
|
const permission_middleware_1 = require("../../middleware/permission.middleware");
|
|
19
|
+
const SysAppService_1 = require("../../service/SysAppService");
|
|
19
20
|
/**
|
|
20
21
|
* 零代码配置的界面,相关的接口的执行。这里的接口都需要登录。
|
|
21
22
|
*/
|
|
@@ -28,19 +29,8 @@ let CrudStdGatewayController = class CrudStdGatewayController extends BaseApiCon
|
|
|
28
29
|
const body = decodeBody;
|
|
29
30
|
const appCode = body.stdAction.appCode;
|
|
30
31
|
const parsedAppInfo = await this.crudStdService.getParsedCrudStdAppInfo(appCode);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
delete parsedAppInfo2.created_at;
|
|
34
|
-
delete parsedAppInfo2.created_by;
|
|
35
|
-
delete parsedAppInfo2.workbench_code_array;
|
|
36
|
-
delete parsedAppInfo2.modified_at;
|
|
37
|
-
delete parsedAppInfo2.modified_by;
|
|
38
|
-
delete parsedAppInfo2.modified_desc;
|
|
39
|
-
delete parsedAppInfo2.std_crud_db;
|
|
40
|
-
delete parsedAppInfo2.std_crud_tbl;
|
|
41
|
-
return common_dto_1.CommonResult.successNotNull(parsedAppInfo2);
|
|
42
|
-
}
|
|
43
|
-
return common_dto_1.CommonResult.successNotNull(null);
|
|
32
|
+
const parsedAppInfo2 = await this.sysAppService.deletePrivateField(parsedAppInfo);
|
|
33
|
+
return common_dto_1.CommonResult.successNotNull(parsedAppInfo2);
|
|
44
34
|
}
|
|
45
35
|
/**
|
|
46
36
|
* 列表查询: 分页查询
|
|
@@ -107,6 +97,10 @@ __decorate([
|
|
|
107
97
|
(0, core_1.Inject)(),
|
|
108
98
|
__metadata("design:type", CrudStdService_1.CrudStdService)
|
|
109
99
|
], CrudStdGatewayController.prototype, "crudStdService", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, core_1.Inject)(),
|
|
102
|
+
__metadata("design:type", SysAppService_1.SysAppService)
|
|
103
|
+
], CrudStdGatewayController.prototype, "sysAppService", void 0);
|
|
110
104
|
__decorate([
|
|
111
105
|
(0, core_1.Post)('/getParsedCrudStdAppInfo'),
|
|
112
106
|
__metadata("design:type", Function),
|
|
@@ -9,6 +9,7 @@ export declare class PublicApiController extends BaseApiController {
|
|
|
9
9
|
private enumInfoService;
|
|
10
10
|
private workbenchService;
|
|
11
11
|
private cacheServiceFactory;
|
|
12
|
+
private sysAppService;
|
|
12
13
|
/**
|
|
13
14
|
* 获取所有站点列表
|
|
14
15
|
*/
|
|
@@ -28,5 +29,5 @@ export declare class PublicApiController extends BaseApiController {
|
|
|
28
29
|
/**
|
|
29
30
|
* 获取应用配置信息
|
|
30
31
|
*/
|
|
31
|
-
getSysAppInfoByAppCode(): Promise<
|
|
32
|
+
getSysAppInfoByAppCode(): Promise<CommonResult>;
|
|
32
33
|
}
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.PublicApiController = void 0;
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const _ = require("lodash");
|
|
15
|
-
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
16
15
|
const BaseApiController_1 = require("../base/BaseApiController");
|
|
17
16
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
18
17
|
const EnumInfoService_1 = require("../../service/EnumInfoService");
|
|
@@ -20,10 +19,11 @@ const common_dto_1 = require("../../libs/utils/common-dto");
|
|
|
20
19
|
const functions_1 = require("../../libs/utils/functions");
|
|
21
20
|
const WorkbenchService_1 = require("../../service/WorkbenchService");
|
|
22
21
|
const SystemPerm_1 = require("../../models/SystemPerm");
|
|
23
|
-
const
|
|
22
|
+
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
24
23
|
const CacheServiceFactory_1 = require("../../service/base/cache/CacheServiceFactory");
|
|
25
|
-
const md5 = require("md5");
|
|
26
24
|
const bizmodels_1 = require("../../models/bizmodels");
|
|
25
|
+
const permission_middleware_1 = require("../../middleware/permission.middleware");
|
|
26
|
+
const SysAppService_1 = require("../../service/SysAppService");
|
|
27
27
|
/**
|
|
28
28
|
* 公开的API,无需鉴权,所有人可以直接访问
|
|
29
29
|
*/
|
|
@@ -32,7 +32,7 @@ let PublicApiController = class PublicApiController extends BaseApiController_1.
|
|
|
32
32
|
* 获取所有站点列表
|
|
33
33
|
*/
|
|
34
34
|
async getAllWorkbenchInfoList() {
|
|
35
|
-
const entities = await this.workbenchService.getAllWorkbenchInfoList(
|
|
35
|
+
const entities = await this.workbenchService.getAllWorkbenchInfoList();
|
|
36
36
|
const entities2 = entities.map(e => {
|
|
37
37
|
return {
|
|
38
38
|
workbench_domain: e.workbench_domain,
|
|
@@ -79,7 +79,7 @@ let PublicApiController = class PublicApiController extends BaseApiController_1.
|
|
|
79
79
|
// 特殊的devops菜单
|
|
80
80
|
map['devops'] = {
|
|
81
81
|
menu_list: [],
|
|
82
|
-
hasPermission: this.ctx.userSession.isAuthPass(
|
|
82
|
+
hasPermission: this.ctx.userSession.isAuthPass(keys_1.KeysOfAuthType.byRoleCode, [SystemPerm_1.SystemRoleCode.DevOpsWriter, SystemPerm_1.SystemRoleCode.DevOpsViewer, SystemPerm_1.SystemRoleCode.SuperAdmin]),
|
|
83
83
|
};
|
|
84
84
|
return map;
|
|
85
85
|
}
|
|
@@ -92,34 +92,23 @@ let PublicApiController = class PublicApiController extends BaseApiController_1.
|
|
|
92
92
|
async getNavPageInfo() {
|
|
93
93
|
const body = this.ctx.request.body;
|
|
94
94
|
const { workbenchCode, appCode, pathname } = body;
|
|
95
|
-
const resultData = {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// 查询条件不能为空
|
|
99
|
-
if (values.length > 0) {
|
|
100
|
-
const oneData = await this.sysDBUtil.getOne({ condition }, tableName);
|
|
101
|
-
if (oneData && oneData['app_schema']) {
|
|
102
|
-
oneData['app_schema'] = (0, functions_1.parseJsonObject)(oneData['app_schema']);
|
|
103
|
-
}
|
|
104
|
-
return oneData;
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
95
|
+
const resultData = {
|
|
96
|
+
appData: null,
|
|
97
|
+
pageData: null,
|
|
107
98
|
};
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
cacheName: bizmodels_1.CacheNameEnum.GetNavPageInfo,
|
|
113
|
-
getter: async () => {
|
|
114
|
-
return await getOneImpl(condition, tableName);
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
if (oneData) {
|
|
118
|
-
resultData[key] = oneData;
|
|
99
|
+
if (appCode) {
|
|
100
|
+
const appInfo = await this.sysAppService.getSysAppOne(appCode);
|
|
101
|
+
if (appInfo && appInfo['app_schema']) {
|
|
102
|
+
appInfo['app_schema'] = (0, functions_1.parseJsonObject)(appInfo['app_schema']);
|
|
119
103
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
104
|
+
resultData.appData = await this.sysAppService.deletePrivateField(appInfo);
|
|
105
|
+
}
|
|
106
|
+
if (pathname && workbenchCode) {
|
|
107
|
+
resultData.pageData = await this.sysAppService.getSysAppPageOne({
|
|
108
|
+
page_path: pathname,
|
|
109
|
+
workbench_code: workbenchCode
|
|
110
|
+
});
|
|
111
|
+
}
|
|
123
112
|
return common_dto_1.CommonResult.successRes(resultData);
|
|
124
113
|
}
|
|
125
114
|
/**
|
|
@@ -148,11 +137,12 @@ let PublicApiController = class PublicApiController extends BaseApiController_1.
|
|
|
148
137
|
* 获取应用配置信息
|
|
149
138
|
*/
|
|
150
139
|
async getSysAppInfoByAppCode() {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
140
|
+
var _a;
|
|
141
|
+
const body = this.ctx.request.body;
|
|
142
|
+
const app_code = (_a = body === null || body === void 0 ? void 0 : body.condition) === null || _a === void 0 ? void 0 : _a.app_code;
|
|
143
|
+
const appInfo = await this.sysAppService.getSysAppOne(app_code);
|
|
144
|
+
const appInfo2 = await this.sysAppService.deletePrivateField(appInfo);
|
|
145
|
+
return common_dto_1.CommonResult.successRes({ row: appInfo2 });
|
|
156
146
|
}
|
|
157
147
|
};
|
|
158
148
|
__decorate([
|
|
@@ -171,6 +161,10 @@ __decorate([
|
|
|
171
161
|
(0, core_1.Inject)(),
|
|
172
162
|
__metadata("design:type", CacheServiceFactory_1.CacheServiceFactory)
|
|
173
163
|
], PublicApiController.prototype, "cacheServiceFactory", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, core_1.Inject)(),
|
|
166
|
+
__metadata("design:type", SysAppService_1.SysAppService)
|
|
167
|
+
], PublicApiController.prototype, "sysAppService", void 0);
|
|
174
168
|
__decorate([
|
|
175
169
|
(0, core_1.Get)('/getAllWorkbenchInfoList'),
|
|
176
170
|
__metadata("design:type", Function),
|
|
@@ -202,6 +196,6 @@ __decorate([
|
|
|
202
196
|
__metadata("design:returntype", Promise)
|
|
203
197
|
], PublicApiController.prototype, "getSysAppInfoByAppCode", null);
|
|
204
198
|
PublicApiController = __decorate([
|
|
205
|
-
(0, core_1.Controller)('/ns/gw/api/publicApi')
|
|
199
|
+
(0, core_1.Controller)('/ns/gw/api/publicApi', { middleware: [(0, permission_middleware_1.checkLogin)()] })
|
|
206
200
|
], PublicApiController);
|
|
207
201
|
exports.PublicApiController = PublicApiController;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Context } from '@midwayjs/koa';
|
|
2
2
|
import { BaseApiController } from '../base/BaseApiController';
|
|
3
|
+
import { SysAppService } from "../../service/SysAppService";
|
|
3
4
|
export declare class AppMangeApi extends BaseApiController {
|
|
4
|
-
ctx: Context;
|
|
5
|
+
protected ctx: Context;
|
|
6
|
+
protected sysAppService: SysAppService;
|
|
5
7
|
getAppList(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
6
8
|
getAppOne(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
7
9
|
createApp(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
@@ -15,6 +15,7 @@ const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
|
15
15
|
const BaseApiController_1 = require("../base/BaseApiController");
|
|
16
16
|
const permission_middleware_1 = require("../../middleware/permission.middleware");
|
|
17
17
|
const SystemPerm_1 = require("../../models/SystemPerm");
|
|
18
|
+
const SysAppService_1 = require("../../service/SysAppService");
|
|
18
19
|
let AppMangeApi = class AppMangeApi extends BaseApiController_1.BaseApiController {
|
|
19
20
|
async getAppList() {
|
|
20
21
|
return this.executeSysSimpleSQL('sys_app', keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_PAGE);
|
|
@@ -32,6 +33,10 @@ let AppMangeApi = class AppMangeApi extends BaseApiController_1.BaseApiControlle
|
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
async updateApp() {
|
|
36
|
+
var _a;
|
|
37
|
+
const body = this.ctx.request.body;
|
|
38
|
+
const appCode = (_a = body === null || body === void 0 ? void 0 : body.condition) === null || _a === void 0 ? void 0 : _a.app_code;
|
|
39
|
+
await this.sysAppService.removeSysAppOneCache(appCode);
|
|
35
40
|
return this.executeSysSimpleSQL('sys_app', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
36
41
|
validateCfg: {
|
|
37
42
|
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
@@ -40,6 +45,10 @@ let AppMangeApi = class AppMangeApi extends BaseApiController_1.BaseApiControlle
|
|
|
40
45
|
});
|
|
41
46
|
}
|
|
42
47
|
async deleteApp() {
|
|
48
|
+
var _a;
|
|
49
|
+
const body = this.ctx.request.body;
|
|
50
|
+
const appCode = (_a = body === null || body === void 0 ? void 0 : body.condition) === null || _a === void 0 ? void 0 : _a.app_code;
|
|
51
|
+
await this.sysAppService.removeSysAppOneCache(appCode);
|
|
43
52
|
return this.executeSysSimpleSQL('sys_app', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
53
|
validateCfg: {
|
|
45
54
|
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
@@ -52,6 +61,10 @@ __decorate([
|
|
|
52
61
|
(0, core_1.Inject)(),
|
|
53
62
|
__metadata("design:type", Object)
|
|
54
63
|
], AppMangeApi.prototype, "ctx", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, core_1.Inject)(),
|
|
66
|
+
__metadata("design:type", SysAppService_1.SysAppService)
|
|
67
|
+
], AppMangeApi.prototype, "sysAppService", void 0);
|
|
55
68
|
__decorate([
|
|
56
69
|
(0, core_1.Post)('/getAppList'),
|
|
57
70
|
__metadata("design:type", Function),
|
|
@@ -3,6 +3,7 @@ import { BaseApiController } from '../base/BaseApiController';
|
|
|
3
3
|
import { CommonResult } from '../../libs/utils/common-dto';
|
|
4
4
|
export declare class SysConfigMangeApi extends BaseApiController {
|
|
5
5
|
ctx: Context;
|
|
6
|
+
private sysConfigService;
|
|
6
7
|
getSysConfigList(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
7
8
|
getSysConfigOne(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
8
9
|
createSysConfig(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
@@ -19,6 +19,7 @@ const bizmodels_1 = require("../../models/bizmodels");
|
|
|
19
19
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
20
20
|
const common_dto_1 = require("../../libs/utils/common-dto");
|
|
21
21
|
const global_config_1 = require("../../libs/global-config/global-config");
|
|
22
|
+
const SysConfigService_1 = require("../../service/SysConfigService");
|
|
22
23
|
let SysConfigMangeApi = class SysConfigMangeApi extends BaseApiController_1.BaseApiController {
|
|
23
24
|
async getSysConfigList() {
|
|
24
25
|
return this.executeSysSimpleSQL('sys_configs', keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_PAGE, {
|
|
@@ -54,17 +55,19 @@ let SysConfigMangeApi = class SysConfigMangeApi extends BaseApiController_1.Base
|
|
|
54
55
|
if (!id) {
|
|
55
56
|
return common_dto_1.CommonResult.errorRes('id不能为空');
|
|
56
57
|
}
|
|
57
|
-
const sysConfig = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).
|
|
58
|
+
const sysConfig = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).getUniqueOne({ condition: body.condition }, SystemTables_1.SystemTables.sys_configs);
|
|
58
59
|
if (!sysConfig) {
|
|
59
60
|
return common_dto_1.CommonResult.errorRes('配置项不存在');
|
|
60
61
|
}
|
|
61
|
-
const { edit_auth_type, edit_auth_config } = sysConfig;
|
|
62
|
+
const { edit_auth_type, edit_auth_config, config_code } = sysConfig;
|
|
62
63
|
if (edit_auth_type) {
|
|
63
64
|
const isOK = this.ctx.userSession.isAuthPass(edit_auth_type, edit_auth_config);
|
|
64
65
|
if (!isOK) {
|
|
65
66
|
return common_dto_1.CommonResult.errorRes('编辑权限校验不通过:' + JSON.stringify({ edit_auth_type, edit_auth_config }));
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
// 移除缓存
|
|
70
|
+
await this.sysConfigService.removeSysConfigOneCache(config_code);
|
|
68
71
|
return this.executeSysSimpleSQL('sys_configs', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
69
72
|
validateCfg: {
|
|
70
73
|
'data.workbench_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING, 'length:1,64'],
|
|
@@ -90,6 +93,10 @@ __decorate([
|
|
|
90
93
|
(0, core_1.Inject)(),
|
|
91
94
|
__metadata("design:type", Object)
|
|
92
95
|
], SysConfigMangeApi.prototype, "ctx", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, core_1.Inject)(),
|
|
98
|
+
__metadata("design:type", SysConfigService_1.SysConfigService)
|
|
99
|
+
], SysConfigMangeApi.prototype, "sysConfigService", void 0);
|
|
93
100
|
__decorate([
|
|
94
101
|
(0, core_1.Post)('/getSysConfigList'),
|
|
95
102
|
__metadata("design:type", Function),
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { Context } from '@midwayjs/koa';
|
|
2
2
|
import { BaseApiController } from '../base/BaseApiController';
|
|
3
|
+
import { CommonResult } from "../../libs/utils/common-dto";
|
|
3
4
|
export declare class UserAccountManageApi extends BaseApiController {
|
|
4
5
|
protected ctx: Context;
|
|
6
|
+
private cacheServiceFactory;
|
|
5
7
|
getUserAccountList(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
6
8
|
getUserAccountOne(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
7
|
-
updateUserAccount(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
9
|
+
updateUserAccount(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext | CommonResult>;
|
|
8
10
|
createUserAccount(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
9
11
|
deleteUserAccount(): Promise<import("../../libs/crud-pro/models/ExecuteContext").ExecuteContext>;
|
|
10
12
|
/**
|
|
11
13
|
* 重置密码
|
|
12
14
|
*/
|
|
13
|
-
chgUserPassword(): Promise<
|
|
15
|
+
chgUserPassword(): Promise<CommonResult>;
|
|
14
16
|
}
|
|
@@ -19,6 +19,9 @@ const SystemPerm_1 = require("../../models/SystemPerm");
|
|
|
19
19
|
const exceptions_1 = require("../../libs/crud-pro/exceptions");
|
|
20
20
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
21
21
|
const global_config_1 = require("../../libs/global-config/global-config");
|
|
22
|
+
const CacheServiceFactory_1 = require("../../service/base/cache/CacheServiceFactory");
|
|
23
|
+
const bizmodels_1 = require("../../models/bizmodels");
|
|
24
|
+
const common_dto_1 = require("../../libs/utils/common-dto");
|
|
22
25
|
const accountNameBlacklist = new Set(['sa', 'root', 'admin', 'superadmin', 'administrator', 'sys', 'sysop', 'schedule_user']);
|
|
23
26
|
function checkAccountCreateBlacklist(value) {
|
|
24
27
|
if (!value) {
|
|
@@ -41,6 +44,23 @@ let UserAccountManageApi = class UserAccountManageApi extends BaseApiController_
|
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
46
|
async updateUserAccount() {
|
|
47
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
48
|
+
const body = this.ctx.request.body;
|
|
49
|
+
const id = body.condition.id;
|
|
50
|
+
if (!id) {
|
|
51
|
+
return common_dto_1.CommonResult.errorRes('id不能为空');
|
|
52
|
+
}
|
|
53
|
+
const userAccountInfo = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).getUniqueOne({
|
|
54
|
+
condition: body.condition
|
|
55
|
+
}, SystemTables_1.SystemTables.sys_user_account);
|
|
56
|
+
if (!userAccountInfo) {
|
|
57
|
+
return common_dto_1.CommonResult.errorRes('用户信息不存在');
|
|
58
|
+
}
|
|
59
|
+
const accountId = userAccountInfo.account_id;
|
|
60
|
+
await this.cacheServiceFactory.removeItemCache({
|
|
61
|
+
cacheName: bizmodels_1.CacheNameEnum.CurdMixByAccount,
|
|
62
|
+
cacheKey: accountId,
|
|
63
|
+
});
|
|
44
64
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_user_account, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
45
65
|
validateCfg: {
|
|
46
66
|
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
@@ -87,6 +107,10 @@ __decorate([
|
|
|
87
107
|
(0, core_1.Inject)(),
|
|
88
108
|
__metadata("design:type", Object)
|
|
89
109
|
], UserAccountManageApi.prototype, "ctx", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, core_1.Inject)(),
|
|
112
|
+
__metadata("design:type", CacheServiceFactory_1.CacheServiceFactory)
|
|
113
|
+
], UserAccountManageApi.prototype, "cacheServiceFactory", void 0);
|
|
90
114
|
__decorate([
|
|
91
115
|
(0, core_1.Post)('/getUserAccountList'),
|
|
92
116
|
__metadata("design:type", Function),
|
|
@@ -26,7 +26,7 @@ let WorkbenchMangeApi = class WorkbenchMangeApi extends BaseApiController_1.Base
|
|
|
26
26
|
}
|
|
27
27
|
async createWorkbench() {
|
|
28
28
|
// 清除运行时缓存
|
|
29
|
-
this.workbenchService.clearCache();
|
|
29
|
+
await this.workbenchService.clearCache();
|
|
30
30
|
const body = this.ctx.request.body;
|
|
31
31
|
const dataObj = body.data || {};
|
|
32
32
|
dataObj.html_content = dataObj.html_content || '<html>hello</html>';
|
|
@@ -40,7 +40,7 @@ let WorkbenchMangeApi = class WorkbenchMangeApi extends BaseApiController_1.Base
|
|
|
40
40
|
}
|
|
41
41
|
async updateWorkbench() {
|
|
42
42
|
// 清除运行时缓存
|
|
43
|
-
this.workbenchService.clearCache();
|
|
43
|
+
await this.workbenchService.clearCache();
|
|
44
44
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_workbench, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
45
45
|
validateCfg: {
|
|
46
46
|
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
@@ -6,6 +6,7 @@ import { BaseApiController } from '../base/BaseApiController';
|
|
|
6
6
|
export declare class AppRenderController extends BaseApiController {
|
|
7
7
|
protected ctx: Context;
|
|
8
8
|
private workbenchService;
|
|
9
|
+
private sysAppService;
|
|
9
10
|
home(appPath: string): Promise<string>;
|
|
10
11
|
private isSupportCurrentWorkbench;
|
|
11
12
|
}
|
|
@@ -15,27 +15,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.AppRenderController = void 0;
|
|
16
16
|
const core_1 = require("@midwayjs/core");
|
|
17
17
|
const BaseApiController_1 = require("../base/BaseApiController");
|
|
18
|
-
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
19
|
-
const SystemTables_1 = require("../../models/SystemTables");
|
|
20
18
|
const WorkbenchService_1 = require("../../service/WorkbenchService");
|
|
21
19
|
const render_utils_1 = require("../../libs/utils/render-utils");
|
|
22
20
|
const crypto_utils_1 = require("../../libs/utils/crypto-utils");
|
|
23
|
-
const
|
|
21
|
+
const SysAppService_1 = require("../../service/SysAppService");
|
|
24
22
|
/**
|
|
25
23
|
* 渲染独立外部应用
|
|
26
24
|
*/
|
|
27
25
|
let AppRenderController = class AppRenderController extends BaseApiController_1.BaseApiController {
|
|
28
26
|
async home(appPath) {
|
|
29
|
-
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
30
27
|
const appPathArr = appPath.split('/');
|
|
31
28
|
const appCode = appPathArr[0];
|
|
32
|
-
const
|
|
33
|
-
sqlTable: SystemTables_1.SystemTables.sys_app,
|
|
34
|
-
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
35
|
-
sqlDatabase: SystemDbName,
|
|
36
|
-
sqlDbType: SystemDbType,
|
|
37
|
-
});
|
|
38
|
-
const { row: appInfo } = res.getResModel();
|
|
29
|
+
const appInfo = await this.sysAppService.getSysAppOne(appCode);
|
|
39
30
|
if (!appInfo) {
|
|
40
31
|
this.ctx.status = 404;
|
|
41
32
|
return this.ctx.render('404_app', { appCode, errorMsg: ' 应用不存在' });
|
|
@@ -79,6 +70,10 @@ __decorate([
|
|
|
79
70
|
(0, core_1.Inject)(),
|
|
80
71
|
__metadata("design:type", WorkbenchService_1.WorkbenchService)
|
|
81
72
|
], AppRenderController.prototype, "workbenchService", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, core_1.Inject)(),
|
|
75
|
+
__metadata("design:type", SysAppService_1.SysAppService)
|
|
76
|
+
], AppRenderController.prototype, "sysAppService", void 0);
|
|
82
77
|
__decorate([
|
|
83
78
|
(0, core_1.Get)('/:appPath+'),
|
|
84
79
|
__param(0, (0, core_1.Param)('appPath')),
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export * from './service/AuthService';
|
|
|
46
46
|
export * from './service/EnumInfoService';
|
|
47
47
|
export * from './service/FileCenterService';
|
|
48
48
|
export * from './service/SysConfigService';
|
|
49
|
+
export * from './service/SysAppService';
|
|
49
50
|
export * from './service/UserAccountService';
|
|
50
51
|
export * from './service/UserSessionService';
|
|
51
52
|
export * from './service/VisitStatService';
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,7 @@ __exportStar(require("./service/AuthService"), exports);
|
|
|
64
64
|
__exportStar(require("./service/EnumInfoService"), exports);
|
|
65
65
|
__exportStar(require("./service/FileCenterService"), exports);
|
|
66
66
|
__exportStar(require("./service/SysConfigService"), exports);
|
|
67
|
+
__exportStar(require("./service/SysAppService"), exports);
|
|
67
68
|
__exportStar(require("./service/UserAccountService"), exports);
|
|
68
69
|
__exportStar(require("./service/UserSessionService"), exports);
|
|
69
70
|
__exportStar(require("./service/VisitStatService"), exports);
|
|
@@ -34,7 +34,7 @@ class CrudProExecuteSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
34
34
|
if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
35
35
|
// import { PoolClient } from 'pg';
|
|
36
36
|
const pgClient = connection;
|
|
37
|
-
const pgSql = (0, convertPgSql_1.replaceQuestionMarks)(sqlCfgModel.executeSql);
|
|
37
|
+
const pgSql = (0, convertPgSql_1.replaceQuestionMarks)(sqlCfgModel.executeSql, sqlCfgModel.isNativeSQL);
|
|
38
38
|
queryRes = await pgClient.query({
|
|
39
39
|
text: pgSql,
|
|
40
40
|
values: executeSqlArgs || [],
|
|
@@ -43,7 +43,7 @@ class CrudProExecuteSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
43
43
|
}
|
|
44
44
|
else if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
45
45
|
// SQLServer
|
|
46
|
-
const mssql = (0, convertMsSql_1.replaceQuestionMarksForMssql)(sqlCfgModel.executeSql);
|
|
46
|
+
const mssql = (0, convertMsSql_1.replaceQuestionMarksForMssql)(sqlCfgModel.executeSql, sqlCfgModel.isNativeSQL);
|
|
47
47
|
queryRes = await connection.query(mssql, executeSqlArgs);
|
|
48
48
|
this.logger.debug('[CrudProExecuteSqlService] executeSqlCfgModel_sqlserver', mssql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
49
49
|
}
|
|
@@ -61,12 +61,10 @@ class CrudProServiceBase {
|
|
|
61
61
|
crudType: null,
|
|
62
62
|
};
|
|
63
63
|
if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
64
|
-
|
|
65
|
-
sqlCfgModel.executeSql = pgSql;
|
|
64
|
+
sqlCfgModel.executeSql = (0, convertPgSql_1.replaceQuestionMarks)(sqlCfgModel.executeSql, false);
|
|
66
65
|
}
|
|
67
66
|
else if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
68
|
-
|
|
69
|
-
sqlCfgModel.executeSql = mssql;
|
|
67
|
+
sqlCfgModel.executeSql = (0, convertMsSql_1.replaceQuestionMarksForMssql)(sqlCfgModel.executeSql, false);
|
|
70
68
|
}
|
|
71
69
|
const connection = await this.getTxConnectionBySqlCfg(sqlCfgModel);
|
|
72
70
|
return await connection.query(sqlCfgModel.executeSql, values);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function replaceQuestionMarksForMssql(sql: string): string;
|
|
1
|
+
declare function replaceQuestionMarksForMssql(sql: string, isNativeSQL: boolean): string;
|
|
2
2
|
export { replaceQuestionMarksForMssql };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceQuestionMarksForMssql = void 0;
|
|
4
|
-
function replaceQuestionMarksForMssql(sql) {
|
|
4
|
+
function replaceQuestionMarksForMssql(sql, isNativeSQL) {
|
|
5
|
+
if (isNativeSQL === true) {
|
|
6
|
+
return sql;
|
|
7
|
+
}
|
|
5
8
|
let count = 0;
|
|
6
9
|
return sql.replace(/\?/g, () => {
|
|
7
10
|
count = count + 1;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function replaceQuestionMarks(sql: string): string;
|
|
1
|
+
declare function replaceQuestionMarks(sql: string, isNativeSQL: boolean): string;
|
|
2
2
|
export { replaceQuestionMarks };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceQuestionMarks = void 0;
|
|
4
|
-
function replaceQuestionMarks(sql) {
|
|
4
|
+
function replaceQuestionMarks(sql, isNativeSQL) {
|
|
5
|
+
if (isNativeSQL === true) {
|
|
6
|
+
return sql;
|
|
7
|
+
}
|
|
5
8
|
let count = 0;
|
|
6
9
|
return sql.replace(/\?/g, () => {
|
|
7
10
|
count = count + 1;
|
|
@@ -112,11 +112,12 @@ export declare enum CacheNameEnum {
|
|
|
112
112
|
CurdMixByAccount = "CurdMixByAccount",
|
|
113
113
|
CurdMixByDict = "CurdMixByDict",
|
|
114
114
|
CurdMixByLinkToCustom = "CurdMixByLinkToCustom",
|
|
115
|
-
CurdMixBySysConfig = "CurdMixBySysConfig",
|
|
116
115
|
CurdMixByWorkbench = "CurdMixByWorkbench",
|
|
117
|
-
|
|
116
|
+
GetSysConfigOne = "GetSysConfigOne",
|
|
117
|
+
GetWorkbenchCachedObj = "GetWorkbenchCachedObj",
|
|
118
|
+
GetSysAppOne = "GetSysAppOne",
|
|
119
|
+
GetSysAppPageOne = "GetSysAppPageOne",
|
|
118
120
|
GetWorkbenchMenu = "GetWorkbenchMenu",
|
|
119
|
-
GetNavPageInfo = "GetNavPageInfo",
|
|
120
121
|
GetEnumInfoByCode = "GetEnumInfoByCode",
|
|
121
122
|
UserSessionBySessionId = "UserSessionBySessionId",
|
|
122
123
|
UserSessionByAsyncTaskId = "UserSessionByAsyncTaskId"
|
package/dist/models/bizmodels.js
CHANGED
|
@@ -42,11 +42,12 @@ var CacheNameEnum;
|
|
|
42
42
|
CacheNameEnum["CurdMixByAccount"] = "CurdMixByAccount";
|
|
43
43
|
CacheNameEnum["CurdMixByDict"] = "CurdMixByDict";
|
|
44
44
|
CacheNameEnum["CurdMixByLinkToCustom"] = "CurdMixByLinkToCustom";
|
|
45
|
-
CacheNameEnum["CurdMixBySysConfig"] = "CurdMixBySysConfig";
|
|
46
45
|
CacheNameEnum["CurdMixByWorkbench"] = "CurdMixByWorkbench";
|
|
47
|
-
CacheNameEnum["
|
|
46
|
+
CacheNameEnum["GetSysConfigOne"] = "GetSysConfigOne";
|
|
47
|
+
CacheNameEnum["GetWorkbenchCachedObj"] = "GetWorkbenchCachedObj";
|
|
48
|
+
CacheNameEnum["GetSysAppOne"] = "GetSysAppOne";
|
|
49
|
+
CacheNameEnum["GetSysAppPageOne"] = "GetSysAppPageOne";
|
|
48
50
|
CacheNameEnum["GetWorkbenchMenu"] = "GetWorkbenchMenu";
|
|
49
|
-
CacheNameEnum["GetNavPageInfo"] = "GetNavPageInfo";
|
|
50
51
|
CacheNameEnum["GetEnumInfoByCode"] = "GetEnumInfoByCode";
|
|
51
52
|
CacheNameEnum["UserSessionBySessionId"] = "UserSessionBySessionId";
|
|
52
53
|
CacheNameEnum["UserSessionByAsyncTaskId"] = "UserSessionByAsyncTaskId";
|
|
@@ -15,6 +15,7 @@ export declare class EnumInfoService {
|
|
|
15
15
|
private curdProService;
|
|
16
16
|
private curdMixByLinkToCustomService;
|
|
17
17
|
private cacheServiceFactory;
|
|
18
|
+
private sysConfigService;
|
|
18
19
|
queryEnumInfo(codeList: IQueryEnumInfo[], refreshCache: boolean): Promise<IQueryEnumResult[]>;
|
|
19
20
|
/**
|
|
20
21
|
* code形如:fatcms~~~sys_perm_role~~~role_code,role_name,xxx_name
|