midway-fatcms 0.0.1-beta.2 → 0.0.1-beta.22
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/.eslintrc.json +12 -0
- package/.prettierrc.js +4 -0
- package/README.md +7 -0
- package/dist/config/config.default.js +52 -15
- package/dist/configuration.d.ts +1 -0
- package/dist/configuration.js +33 -8
- package/dist/controller/base/BaseApiController.d.ts +1 -1
- package/dist/controller/base/BaseApiController.js +14 -6
- package/dist/controller/gateway/AsyncTaskController.d.ts +14 -0
- package/dist/controller/gateway/AsyncTaskController.js +108 -0
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +3 -3
- package/dist/controller/gateway/CrudMtdGatewayController.js +9 -6
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +5 -5
- package/dist/controller/gateway/DocGatewayController.js +14 -9
- package/dist/controller/gateway/PublicApiController.js +4 -6
- package/dist/controller/gateway/StaticController.d.ts +2 -0
- package/dist/controller/gateway/StaticController.js +59 -40
- package/dist/controller/helpers.controller.d.ts +1 -1
- package/dist/controller/home.controller.js +2 -2
- package/dist/controller/manage/AnyApiMangeApi.js +2 -2
- package/dist/controller/manage/AppLogMangeApi.js +2 -2
- package/dist/controller/manage/AppMangeApi.js +2 -2
- package/dist/controller/manage/AppPageMangeApi.js +2 -2
- package/dist/controller/manage/AppSchemaHistoryApi.js +2 -2
- package/dist/controller/manage/CrudMethodsMangeApi.js +2 -2
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +1 -1
- package/dist/controller/manage/CrudStandardDesignApi.js +78 -75
- package/dist/controller/manage/DataDictManageApi.d.ts +1 -1
- package/dist/controller/manage/DataDictManageApi.js +1 -1
- package/dist/controller/manage/DeployManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.js +38 -34
- package/dist/controller/manage/DocLibManageApi.js +2 -2
- package/dist/controller/manage/DocManageApi.js +2 -2
- package/dist/controller/manage/FileManageApi.js +1 -1
- package/dist/controller/manage/LowCodeTplManageApi.js +2 -2
- package/dist/controller/manage/MenuManageApi.js +2 -2
- package/dist/controller/manage/ProxyApiMangeApi.js +2 -2
- package/dist/controller/manage/SuperAdminManageApi.d.ts +2 -2
- package/dist/controller/manage/SuperAdminManageApi.js +12 -8
- package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -1
- package/dist/controller/manage/SysConfigMangeApi.js +8 -6
- package/dist/controller/manage/SystemInfoManageApi.d.ts +1 -1
- package/dist/controller/manage/SystemInfoManageApi.js +7 -1
- package/dist/controller/manage/UserAccountManageApi.d.ts +2 -2
- package/dist/controller/manage/UserAccountManageApi.js +7 -2
- package/dist/controller/manage/WorkbenchMangeApi.js +3 -3
- package/dist/controller/myinfo/AuthController.d.ts +0 -4
- package/dist/controller/myinfo/AuthController.js +1 -54
- package/dist/controller/render/AppRenderController.js +10 -4
- package/dist/controller/test.controller.d.ts +1 -1
- package/dist/controller/test.controller.js +5 -5
- package/dist/index.d.ts +34 -4
- package/dist/index.js +34 -4
- package/dist/libs/crud-pro/CrudPro.d.ts +1 -0
- package/dist/libs/crud-pro/CrudPro.js +5 -0
- package/dist/libs/crud-pro/defaultConfigs.js +2 -0
- package/dist/libs/crud-pro/interfaces.d.ts +7 -1
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +2 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +8 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.js +8 -0
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/ResModel.d.ts +16 -0
- package/dist/libs/crud-pro/models/ResModel.js +2 -0
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +1 -1
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +27 -15
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +13 -17
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +1 -1
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +10 -12
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +14 -23
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +7 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +2 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +3 -2
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +32 -7
- package/dist/libs/crud-pro/utils/DatabaseName.js +24 -3
- package/dist/libs/crud-pro/utils/MixinUtils.js +1 -1
- package/dist/libs/crud-pro/utils/ValidateUtils.js +1 -1
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.d.ts +3 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.js +22 -0
- package/dist/libs/global-config/global-config.d.ts +45 -0
- package/dist/libs/global-config/global-config.js +33 -0
- package/dist/libs/utils/errorToString.d.ts +2 -0
- package/dist/libs/utils/errorToString.js +57 -0
- package/dist/libs/utils/fatcms-request.js +2 -2
- package/dist/middleware/forbidden.middleware.js +4 -20
- package/dist/middleware/global.middleware.js +8 -1
- package/dist/models/AsyncTaskModel.d.ts +69 -0
- package/dist/models/AsyncTaskModel.js +26 -0
- package/dist/models/RedisKeys.d.ts +8 -0
- package/dist/models/RedisKeys.js +11 -0
- package/dist/models/SystemTables.d.ts +1 -3
- package/dist/models/SystemTables.js +2 -4
- package/dist/schedule/anonymousContext.d.ts +13 -0
- package/dist/schedule/anonymousContext.js +59 -0
- package/dist/schedule/index.d.ts +4 -3
- package/dist/schedule/index.js +8 -67
- package/dist/schedule/runSchedule.d.ts +15 -0
- package/dist/schedule/runSchedule.js +68 -0
- package/dist/schedule/scheduleNames.d.ts +13 -0
- package/dist/schedule/scheduleNames.js +17 -0
- package/dist/service/AuthService.js +8 -5
- package/dist/service/EnumInfoService.js +7 -4
- package/dist/service/FileCenterService.js +13 -9
- package/dist/service/SysConfigService.js +4 -2
- package/dist/service/UserAccountService.js +10 -6
- package/dist/service/UserSessionService.js +2 -1
- package/dist/service/VisitStatService.d.ts +1 -1
- package/dist/service/VisitStatService.js +20 -27
- package/dist/service/WorkbenchService.js +4 -2
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +37 -0
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +232 -0
- package/dist/service/asyncTask/AsyncTaskService.d.ts +7 -0
- package/dist/service/asyncTask/AsyncTaskService.js +34 -0
- package/dist/service/crudstd/CrudStdService.d.ts +2 -1
- package/dist/service/crudstd/CrudStdService.js +48 -3
- package/dist/service/curd/CrudProQuick.d.ts +24 -0
- package/dist/service/curd/CrudProQuick.js +105 -0
- package/dist/service/curd/CurdMixByAccountService.js +12 -6
- package/dist/service/curd/CurdMixByDictService.js +4 -2
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +10 -1
- package/dist/service/curd/CurdMixByLinkToCustomService.js +72 -24
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/curd/CurdMixService.d.ts +1 -1
- package/dist/service/curd/CurdMixService.js +2 -2
- package/dist/service/curd/CurdMixUtils.d.ts +7 -0
- package/dist/service/curd/CurdMixUtils.js +65 -28
- package/dist/service/curd/CurdProService.d.ts +2 -10
- package/dist/service/curd/CurdProService.js +31 -146
- package/dist/service/curd/fixCfgModel.d.ts +3 -0
- package/dist/service/curd/fixCfgModel.js +107 -0
- package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
- package/dist/views/404_app.html +31 -0
- package/dist/views/404_workbench.html +34 -0
- package/dist/views/static/favicon.ico +0 -0
- package/package.json +9 -2
- package/src/config/config.default.ts +58 -27
- package/src/configuration.ts +42 -9
- package/src/controller/base/BaseApiController.ts +26 -19
- package/src/controller/gateway/AnyApiGatewayController.ts +1 -1
- package/src/controller/gateway/AsyncTaskController.ts +83 -0
- package/src/controller/gateway/CrudMtdGatewayController.ts +17 -13
- package/src/controller/gateway/CrudStdGatewayController.ts +4 -4
- package/src/controller/gateway/DocGatewayController.ts +25 -17
- package/src/controller/gateway/FileController.ts +8 -9
- package/src/controller/gateway/ProxyApiGatewayController.ts +4 -4
- package/src/controller/gateway/PublicApiController.ts +19 -22
- package/src/controller/gateway/StaticController.ts +234 -242
- package/src/controller/helpers.controller.ts +1 -1
- package/src/controller/home.controller.ts +8 -15
- package/src/controller/manage/AnyApiMangeApi.ts +11 -11
- package/src/controller/manage/AppLogMangeApi.ts +5 -5
- package/src/controller/manage/AppMangeApi.ts +7 -7
- package/src/controller/manage/AppPageMangeApi.ts +5 -5
- package/src/controller/manage/AppSchemaHistoryApi.ts +3 -3
- package/src/controller/manage/CrudMethodsMangeApi.ts +5 -5
- package/src/controller/manage/CrudStandardDesignApi.ts +106 -113
- package/src/controller/manage/DataDictManageApi.ts +5 -5
- package/src/controller/manage/DeployManageApi.ts +85 -89
- package/src/controller/manage/DocLibManageApi.ts +5 -5
- package/src/controller/manage/DocManageApi.ts +10 -10
- package/src/controller/manage/FileManageApi.ts +1 -1
- package/src/controller/manage/LowCodeTplManageApi.ts +2 -2
- package/src/controller/manage/MenuManageApi.ts +10 -15
- package/src/controller/manage/ProxyApiMangeApi.ts +2 -2
- package/src/controller/manage/SuperAdminManageApi.ts +14 -13
- package/src/controller/manage/SysConfigMangeApi.ts +11 -11
- package/src/controller/manage/SystemInfoManageApi.ts +11 -6
- package/src/controller/manage/UserAccountManageApi.ts +10 -4
- package/src/controller/manage/WorkbenchMangeApi.ts +8 -8
- package/src/controller/myinfo/AuthController.ts +6 -72
- package/src/controller/render/AppRenderController.ts +24 -21
- package/src/controller/test.controller.ts +18 -18
- package/src/index.ts +38 -4
- package/src/libs/crud-pro/CrudPro.ts +7 -0
- package/src/libs/crud-pro/defaultConfigs.ts +2 -0
- package/src/libs/crud-pro/interfaces.ts +10 -3
- package/src/libs/crud-pro/models/ExecuteContext.ts +3 -3
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +11 -1
- package/src/libs/crud-pro/models/RequestCfgModel.ts +1 -1
- package/src/libs/crud-pro/models/RequestModel.ts +1 -1
- package/src/libs/crud-pro/models/ResModel.ts +19 -0
- package/src/libs/crud-pro/models/SqlCfgModel.ts +2 -2
- package/src/libs/crud-pro/models/Transaction.ts +8 -9
- package/src/libs/crud-pro/models/TransactionPostgres.ts +1 -1
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +8 -13
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +32 -23
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +38 -54
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +26 -45
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +23 -40
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +25 -29
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +5 -9
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +36 -9
- package/src/libs/crud-pro/utils/DatabaseName.ts +35 -15
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +2 -2
- package/src/libs/crud-pro/utils/MixinUtils.ts +1 -1
- package/src/libs/crud-pro/utils/ValidateUtils.ts +1 -3
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +1 -1
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +3 -3
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +3 -3
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +2 -2
- package/src/libs/crud-pro/utils/sqlConvert/convertMix.ts +26 -0
- package/src/libs/global-config/global-config.ts +78 -0
- package/src/libs/utils/crypto-utils.ts +2 -4
- package/src/libs/utils/errorToString.ts +61 -0
- package/src/libs/utils/fatcms-request.ts +9 -21
- package/src/libs/utils/ordernum-utils.ts +2 -6
- package/src/libs/utils/parseConfig.ts +7 -15
- package/src/middleware/forbidden.middleware.ts +6 -25
- package/src/middleware/global.middleware.ts +18 -16
- package/src/models/AsyncTaskModel.ts +79 -0
- package/src/models/RedisKeys.ts +13 -0
- package/src/models/SystemTables.ts +1 -4
- package/src/models/bizmodels.ts +1 -2
- package/src/schedule/anonymousContext.ts +79 -0
- package/src/schedule/index.ts +11 -72
- package/src/schedule/runSchedule.ts +83 -0
- package/src/schedule/scheduleNames.ts +21 -0
- package/src/service/AuthService.ts +13 -8
- package/src/service/EnumInfoService.ts +8 -3
- package/src/service/FileCenterService.ts +12 -6
- package/src/service/SysConfigService.ts +10 -6
- package/src/service/UserAccountService.ts +14 -4
- package/src/service/UserSessionService.ts +5 -4
- package/src/service/VisitStatService.ts +57 -70
- package/src/service/WorkbenchService.ts +7 -2
- package/src/service/anyapi/AnyApiService.ts +11 -8
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +255 -0
- package/src/service/asyncTask/AsyncTaskService.ts +21 -0
- package/src/service/base/BaseService.ts +2 -2
- package/src/service/crudstd/CrudStdService.ts +60 -5
- package/src/service/curd/CrudProQuick.ts +137 -0
- package/src/service/curd/CurdMixByAccountService.ts +14 -6
- package/src/service/curd/CurdMixByDictService.ts +8 -2
- package/src/service/curd/CurdMixByLinkToCustomService.ts +101 -50
- package/src/service/curd/CurdMixBySysConfigService.ts +7 -2
- package/src/service/curd/CurdMixByWorkbenchService.ts +6 -2
- package/src/service/curd/CurdMixService.ts +3 -3
- package/src/service/curd/CurdMixUtils.ts +82 -39
- package/src/service/curd/CurdProService.ts +45 -189
- package/src/service/curd/fixCfgModel.ts +139 -0
- package/src/service/proxyapi/ProxyApiLoadService.ts +12 -3
- package/src/views/404_app.html +31 -0
- package/src/views/404_workbench.html +34 -0
- package/src/views/static/favicon.ico +0 -0
- package/tsconfig.json +32 -0
- package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
- package/dist/controller/medstatistic/MedAdminController.js +0 -205
- package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
- package/dist/controller/medstatistic/MedClientController.js +0 -188
- package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
- package/dist/controller/medstatistic/MedMessageService.js +0 -95
- package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
- package/dist/controller/medstatistic/MedScoreService.js +0 -107
- package/dist/controller/medstatistic/constants.d.ts +0 -32
- package/dist/controller/medstatistic/constants.js +0 -43
- package/src/controller/medstatistic/MedAdminController.ts +0 -221
- package/src/controller/medstatistic/MedClientController.ts +0 -188
- package/src/controller/medstatistic/MedMessageService.ts +0 -89
- package/src/controller/medstatistic/MedScoreService.ts +0 -108
- package/src/controller/medstatistic/constants.ts +0 -63
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
import {Controller, Fields, Files, Inject, Post, Query} from '@midwayjs/core';
|
|
2
|
-
import {Context} from '@midwayjs/koa';
|
|
3
|
-
import {BaseApiController} from '../base/BaseApiController';
|
|
4
|
-
import {checkPermission} from '../../middleware/permission.middleware';
|
|
5
|
-
import {SystemFuncCode} from '../../models/SystemPerm';
|
|
6
|
-
import {CommonResult} from
|
|
7
|
-
import {AccessType, UploadCategoryType} from
|
|
8
|
-
import {BizException} from
|
|
9
|
-
import {FileCenterService, toDownloadPaths} from '../../service/FileCenterService';
|
|
10
|
-
import {
|
|
11
|
-
import {KeysOfSimpleSQL} from
|
|
12
|
-
import {WorkbenchService} from
|
|
13
|
-
|
|
1
|
+
import { Controller, Fields, Files, Inject, Post, Query } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import { BaseApiController } from '../base/BaseApiController';
|
|
4
|
+
import { checkPermission } from '../../middleware/permission.middleware';
|
|
5
|
+
import { SystemFuncCode } from '../../models/SystemPerm';
|
|
6
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
7
|
+
import { AccessType, UploadCategoryType } from '../../models/bizmodels';
|
|
8
|
+
import { BizException } from '../../models/devops';
|
|
9
|
+
import { FileCenterService, toDownloadPaths } from '../../service/FileCenterService';
|
|
10
|
+
import { SystemTables } from '../../models/SystemTables';
|
|
11
|
+
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
12
|
+
import { WorkbenchService } from '../../service/WorkbenchService';
|
|
13
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
14
|
|
|
15
15
|
interface IReleaseAssetsParams {
|
|
16
|
-
cdnResources: any[]
|
|
17
|
-
packageName: string
|
|
18
|
-
packageVersion: string
|
|
16
|
+
cdnResources: any[];
|
|
17
|
+
packageName: string;
|
|
18
|
+
packageVersion: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
function toAssetsSchema(fileList: any) {
|
|
23
22
|
for (let i = 0; i < fileList.length; i++) {
|
|
24
23
|
const fileListElement = fileList[i];
|
|
25
|
-
fileListElement.settingKey =
|
|
24
|
+
fileListElement.settingKey = 'assets' + i;
|
|
26
25
|
}
|
|
27
26
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
schema: [
|
|
28
|
+
{
|
|
29
|
+
title: '资源配置',
|
|
30
|
+
name: 'fileList',
|
|
31
|
+
type: 'array',
|
|
32
|
+
properties: {
|
|
33
|
+
fileUrl: { label: '文件URL', component: 'Input', xProps: { hasClear: true }, width: 500 },
|
|
34
|
+
fileType: {
|
|
35
|
+
label: '文件类型',
|
|
36
|
+
component: 'Select',
|
|
37
|
+
enums: [
|
|
38
|
+
{ label: 'js', value: 'js' },
|
|
39
|
+
{ label: 'css', value: 'css' },
|
|
40
|
+
],
|
|
41
|
+
xProps: {
|
|
42
|
+
hasClear: true,
|
|
43
|
+
},
|
|
44
|
+
width: 500,
|
|
43
45
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
isModule: {
|
|
47
|
+
label: 'isModule',
|
|
48
|
+
component: 'Select',
|
|
49
|
+
enums: [
|
|
50
|
+
{ label: 'true', value: true },
|
|
51
|
+
{ label: 'false', value: false },
|
|
52
|
+
],
|
|
53
|
+
xProps: {
|
|
54
|
+
hasClear: true,
|
|
55
|
+
},
|
|
56
|
+
width: 500,
|
|
55
57
|
},
|
|
56
|
-
width: 500
|
|
57
58
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
data: {
|
|
62
|
+
fileList: fileList,
|
|
63
|
+
},
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
@Controller('/ns/api/manage/deploy', { middleware: [checkPermission([ SystemFuncCode.AppMangeRead, SystemFuncCode.WorkbenchMangeRead])] })
|
|
67
|
+
@Controller('/ns/api/manage/deploy', { middleware: [checkPermission([SystemFuncCode.AppMangeRead, SystemFuncCode.WorkbenchMangeRead])] })
|
|
69
68
|
export class DeployManageApi extends BaseApiController {
|
|
70
69
|
@Inject()
|
|
71
70
|
protected ctx: Context;
|
|
@@ -108,7 +107,6 @@ export class DeployManageApi extends BaseApiController {
|
|
|
108
107
|
return CommonResult.successRes(data);
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
|
|
112
110
|
/**
|
|
113
111
|
* 资源文件让其生效
|
|
114
112
|
*/
|
|
@@ -123,57 +121,55 @@ export class DeployManageApi extends BaseApiController {
|
|
|
123
121
|
throw new BizException('packageName参数小于5');
|
|
124
122
|
}
|
|
125
123
|
|
|
126
|
-
const cdnResources = params.cdnResources
|
|
124
|
+
const cdnResources = params.cdnResources;
|
|
127
125
|
if (!Array.isArray(cdnResources) || cdnResources.length === 0) {
|
|
128
126
|
throw new BizException('cdnResources参数不存在');
|
|
129
127
|
}
|
|
130
128
|
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
130
|
+
|
|
131
|
+
const workbench = await this.curdMixService.executeCrudByCfg(
|
|
132
|
+
{
|
|
133
|
+
data: {
|
|
134
|
+
package_assets: JSON.stringify(toAssetsSchema(cdnResources)),
|
|
135
|
+
},
|
|
136
|
+
condition: {
|
|
137
|
+
package_name: params.packageName,
|
|
138
|
+
},
|
|
134
139
|
},
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
{
|
|
141
|
+
sqlTable: SystemTables.sys_workbench,
|
|
142
|
+
sqlDatabase: SystemDbName,
|
|
143
|
+
sqlDbType: SystemDbType,
|
|
144
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE,
|
|
137
145
|
}
|
|
138
|
-
|
|
139
|
-
sqlTable: SystemTables.sys_workbench,
|
|
140
|
-
sqlDatabase: SystemDbName,
|
|
141
|
-
sqlDdType: SystemDbType,
|
|
142
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE
|
|
143
|
-
});
|
|
146
|
+
);
|
|
144
147
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
const app = await this.curdMixService.executeCrudByCfg(
|
|
149
|
+
{
|
|
150
|
+
data: {
|
|
151
|
+
package_assets: JSON.stringify(toAssetsSchema(cdnResources)),
|
|
152
|
+
},
|
|
153
|
+
condition: {
|
|
154
|
+
package_name: params.packageName,
|
|
155
|
+
},
|
|
150
156
|
},
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
{
|
|
158
|
+
sqlTable: SystemTables.sys_app,
|
|
159
|
+
sqlDatabase: SystemDbName,
|
|
160
|
+
sqlDbType: SystemDbType,
|
|
161
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE,
|
|
153
162
|
}
|
|
154
|
-
|
|
155
|
-
sqlTable: SystemTables.sys_app,
|
|
156
|
-
sqlDatabase: SystemDbName,
|
|
157
|
-
sqlDdType: SystemDbType,
|
|
158
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE
|
|
159
|
-
});
|
|
160
|
-
|
|
163
|
+
);
|
|
161
164
|
|
|
162
165
|
this.workbenchService.clearCache();
|
|
163
166
|
|
|
164
167
|
const workbenchAffected = workbench.getResModelItem('affected') || {};
|
|
165
168
|
const appAffected = app.getResModelItem('affected') || {};
|
|
166
169
|
|
|
167
|
-
const result = CommonResult.successRes({workbenchAffected, appAffected});
|
|
170
|
+
const result = CommonResult.successRes({ workbenchAffected, appAffected });
|
|
168
171
|
|
|
169
|
-
result.message = `${cdnResources.length}个文件,更新到${workbenchAffected.affectedRows}个站点模版;更新到${appAffected.affectedRows}
|
|
172
|
+
result.message = `${cdnResources.length}个文件,更新到${workbenchAffected.affectedRows}个站点模版;更新到${appAffected.affectedRows}个应用模版,`;
|
|
170
173
|
return result;
|
|
171
174
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
175
|
}
|
|
@@ -30,7 +30,7 @@ export class DocLibManageApi extends BaseApiController {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
@Post('/createDocLib',
|
|
33
|
+
@Post('/createDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
34
34
|
async createDocLib() {
|
|
35
35
|
return this.executeSysSimpleSQL(SystemTables.sys_doc_lib, KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
36
36
|
validateCfg: {
|
|
@@ -42,11 +42,11 @@ export class DocLibManageApi extends BaseApiController {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
@Post('/updateDocLib',
|
|
45
|
+
@Post('/updateDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
46
46
|
async updateDocLib() {
|
|
47
47
|
return this.executeSysSimpleSQL(SystemTables.sys_doc_lib, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
48
48
|
validateCfg: {
|
|
49
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
49
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
50
50
|
'data.title': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
51
51
|
},
|
|
52
52
|
updateCfg: {
|
|
@@ -55,11 +55,11 @@ export class DocLibManageApi extends BaseApiController {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
@Post('/deleteDocLib',
|
|
58
|
+
@Post('/deleteDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
59
59
|
async deleteDocLib() {
|
|
60
60
|
return this.executeSysSimpleSQL(SystemTables.sys_doc_lib, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
61
61
|
validateCfg: {
|
|
62
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
62
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
63
63
|
},
|
|
64
64
|
updateCfg: {
|
|
65
65
|
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
3
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '
|
|
6
|
-
import { SystemFuncCode } from '
|
|
7
|
-
import { SystemTables } from '
|
|
8
|
-
import { CTX_VISITOR_ID, CTX_WORKBENCH_CODE } from '
|
|
5
|
+
import { checkPermission } from '@/middleware/permission.middleware';
|
|
6
|
+
import { SystemFuncCode } from '@/models/SystemPerm';
|
|
7
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
8
|
+
import { CTX_VISITOR_ID, CTX_WORKBENCH_CODE } from '@/models/bizmodels';
|
|
9
9
|
|
|
10
10
|
const publishUpdateCfg = {
|
|
11
11
|
'data.last_publish_by': { contextAsString: CTX_VISITOR_ID },
|
|
@@ -57,7 +57,7 @@ export class DocManageApi extends BaseApiController {
|
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
@Post('/createDoc',
|
|
60
|
+
@Post('/createDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
61
61
|
async createDoc() {
|
|
62
62
|
const isPublish = this.setReleaseData();
|
|
63
63
|
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
@@ -70,13 +70,13 @@ export class DocManageApi extends BaseApiController {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
@Post('/updateDoc',
|
|
73
|
+
@Post('/updateDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
74
74
|
async updateDoc() {
|
|
75
75
|
const isPublish = this.setReleaseData();
|
|
76
76
|
const updateCfg = isPublish ? publishUpdateCfg : {};
|
|
77
77
|
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
78
78
|
validateCfg: {
|
|
79
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
79
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
80
80
|
},
|
|
81
81
|
updateCfg: {
|
|
82
82
|
...updateCfg,
|
|
@@ -85,11 +85,11 @@ export class DocManageApi extends BaseApiController {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
@Post('/deleteDoc',
|
|
88
|
+
@Post('/deleteDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
89
89
|
async deleteDoc() {
|
|
90
90
|
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
91
91
|
validateCfg: {
|
|
92
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
92
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
93
93
|
},
|
|
94
94
|
updateCfg: {
|
|
95
95
|
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
@@ -32,7 +32,7 @@ export class FileMangeApi extends BaseApiController {
|
|
|
32
32
|
async updateFile() {
|
|
33
33
|
return this.executeSysSimpleSQL(SystemTables.sys_file, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
34
34
|
validateCfg: {
|
|
35
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
35
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
}
|
|
@@ -36,7 +36,7 @@ export class LowCodeTplManageApi extends BaseApiController {
|
|
|
36
36
|
async updateLowCodeTpl() {
|
|
37
37
|
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
38
38
|
validateCfg: {
|
|
39
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
39
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -45,7 +45,7 @@ export class LowCodeTplManageApi extends BaseApiController {
|
|
|
45
45
|
async deleteLowCodeTpl() {
|
|
46
46
|
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
47
47
|
validateCfg: {
|
|
48
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
48
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -14,50 +14,45 @@ export class MenuManageApi extends BaseApiController {
|
|
|
14
14
|
@Post('/getMenuList')
|
|
15
15
|
async getMenuList() {
|
|
16
16
|
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE, {
|
|
17
|
-
updateCfg: {
|
|
18
|
-
},
|
|
17
|
+
updateCfg: {},
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
@Post('/getMenuOne')
|
|
23
22
|
async getMenuOne() {
|
|
24
23
|
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_QUERY_ONE, {
|
|
25
|
-
updateCfg: {
|
|
26
|
-
},
|
|
24
|
+
updateCfg: {},
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
@Post('/createMenu',
|
|
28
|
+
@Post('/createMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
|
|
31
29
|
async createMenu() {
|
|
32
30
|
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
33
31
|
validateCfg: {
|
|
34
32
|
'data.menu_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
35
33
|
'data.menu_title': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
36
34
|
},
|
|
37
|
-
updateCfg: {
|
|
38
|
-
},
|
|
35
|
+
updateCfg: {},
|
|
39
36
|
});
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
@Post('/updateMenu',
|
|
39
|
+
@Post('/updateMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
|
|
43
40
|
async updateMenu() {
|
|
44
41
|
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
45
42
|
validateCfg: {
|
|
46
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
47
|
-
},
|
|
48
|
-
updateCfg: {
|
|
43
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
49
44
|
},
|
|
45
|
+
updateCfg: {},
|
|
50
46
|
});
|
|
51
47
|
}
|
|
52
48
|
|
|
53
|
-
@Post('/deleteMenu',
|
|
49
|
+
@Post('/deleteMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
|
|
54
50
|
async deleteMenu() {
|
|
55
51
|
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
56
52
|
validateCfg: {
|
|
57
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
58
|
-
},
|
|
59
|
-
updateCfg: {
|
|
53
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
60
54
|
},
|
|
55
|
+
updateCfg: {},
|
|
61
56
|
});
|
|
62
57
|
}
|
|
63
58
|
}
|
|
@@ -36,7 +36,7 @@ export class ProxyApiMangeApi extends BaseApiController {
|
|
|
36
36
|
async updateProxyApi() {
|
|
37
37
|
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
38
38
|
validateCfg: {
|
|
39
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
39
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -45,7 +45,7 @@ export class ProxyApiMangeApi extends BaseApiController {
|
|
|
45
45
|
async deleteProxyApi() {
|
|
46
46
|
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
47
47
|
validateCfg: {
|
|
48
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
48
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Controller, Inject, Post, Get } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { VisitStatService } from
|
|
3
|
+
import { VisitStatService } from '../../service/VisitStatService';
|
|
4
4
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
5
5
|
import { BaseApiController } from '../base/BaseApiController';
|
|
6
6
|
import { checkRole } from '../../middleware/permission.middleware';
|
|
7
7
|
import { SystemFuncCodeNameMap, SystemRoleCode, SystemRoleCodeNameMap } from '../../models/SystemPerm';
|
|
8
|
-
import {
|
|
9
|
-
import {CommonResult} from
|
|
8
|
+
import { SystemTables } from '../../models/SystemTables';
|
|
9
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
10
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
10
11
|
|
|
11
12
|
@Controller('/ns/api/manage/superAdmin', { middleware: [checkRole(SystemRoleCode.SuperAdmin)] })
|
|
12
13
|
export class SuperAdminManageApi extends BaseApiController {
|
|
@@ -16,12 +17,13 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
16
17
|
@Inject()
|
|
17
18
|
protected visitStatService: VisitStatService;
|
|
18
19
|
|
|
19
|
-
|
|
20
20
|
/**
|
|
21
21
|
* 预设系统内置功能点数据
|
|
22
22
|
*/
|
|
23
23
|
@Post('/presetsFuncCode')
|
|
24
24
|
async presetsFuncCode() {
|
|
25
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
26
|
+
|
|
25
27
|
const funcCodeList = Object.keys(SystemFuncCodeNameMap);
|
|
26
28
|
for (let i = 0; i < funcCodeList.length; i++) {
|
|
27
29
|
const funcCode = funcCodeList[i];
|
|
@@ -38,12 +40,11 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
38
40
|
sqlTable: SystemTables.sys_perm_func,
|
|
39
41
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
40
42
|
sqlDatabase: SystemDbName,
|
|
41
|
-
|
|
43
|
+
sqlDbType: SystemDbType,
|
|
42
44
|
}
|
|
43
45
|
);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
|
|
47
48
|
return CommonResult.successRes();
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -52,6 +53,8 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
52
53
|
*/
|
|
53
54
|
@Post('/presetsRoleCode')
|
|
54
55
|
async presetsRoleCode() {
|
|
56
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
57
|
+
|
|
55
58
|
const roleCodeList = [SystemRoleCode.DevOpsViewer, SystemRoleCode.DevOpsWriter];
|
|
56
59
|
|
|
57
60
|
for (let i = 0; i < roleCodeList.length; i++) {
|
|
@@ -69,7 +72,7 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
69
72
|
sqlTable: SystemTables.sys_perm_role,
|
|
70
73
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
71
74
|
sqlDatabase: SystemDbName,
|
|
72
|
-
|
|
75
|
+
sqlDbType: SystemDbType,
|
|
73
76
|
}
|
|
74
77
|
);
|
|
75
78
|
}
|
|
@@ -82,6 +85,8 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
82
85
|
*/
|
|
83
86
|
@Post('/presetsRoleFuncList')
|
|
84
87
|
async presetsRoleFuncList() {
|
|
88
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
89
|
+
|
|
85
90
|
const funcCodeList = Object.keys(SystemFuncCodeNameMap);
|
|
86
91
|
for (let i = 0; i < funcCodeList.length; i++) {
|
|
87
92
|
const funcCode = funcCodeList[i];
|
|
@@ -97,7 +102,7 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
97
102
|
sqlTable: SystemTables.sys_perm_role_func,
|
|
98
103
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
99
104
|
sqlDatabase: SystemDbName,
|
|
100
|
-
|
|
105
|
+
sqlDbType: SystemDbType,
|
|
101
106
|
}
|
|
102
107
|
);
|
|
103
108
|
}
|
|
@@ -116,7 +121,7 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
116
121
|
sqlTable: SystemTables.sys_perm_role_func,
|
|
117
122
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
118
123
|
sqlDatabase: SystemDbName,
|
|
119
|
-
|
|
124
|
+
sqlDbType: SystemDbType,
|
|
120
125
|
}
|
|
121
126
|
);
|
|
122
127
|
}
|
|
@@ -124,7 +129,6 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
124
129
|
return CommonResult.successRes();
|
|
125
130
|
}
|
|
126
131
|
|
|
127
|
-
|
|
128
132
|
/**
|
|
129
133
|
* 将每天的访问数据,更新到数据库中
|
|
130
134
|
*/
|
|
@@ -132,7 +136,4 @@ export class SuperAdminManageApi extends BaseApiController {
|
|
|
132
136
|
async flushVisitStatToDB() {
|
|
133
137
|
return this.visitStatService.flushVisitStatToDB();
|
|
134
138
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
139
|
}
|
|
@@ -5,8 +5,9 @@ import { BaseApiController } from '../base/BaseApiController';
|
|
|
5
5
|
import { checkPermission } from '../../middleware/permission.middleware';
|
|
6
6
|
import { SystemFuncCode } from '../../models/SystemPerm';
|
|
7
7
|
import { CTX_WORKBENCH_CODE } from '../../models/bizmodels';
|
|
8
|
-
import {
|
|
9
|
-
import {CommonResult} from
|
|
8
|
+
import { SystemTables } from '../../models/SystemTables';
|
|
9
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
10
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
10
11
|
|
|
11
12
|
@Controller('/ns/api/manage/sysconfig', { middleware: [checkPermission(SystemFuncCode.SysConfigMangeRead)] })
|
|
12
13
|
export class SysConfigMangeApi extends BaseApiController {
|
|
@@ -48,32 +49,31 @@ export class SysConfigMangeApi extends BaseApiController {
|
|
|
48
49
|
|
|
49
50
|
@Post('/updateSysConfig', { middleware: [checkPermission(SystemFuncCode.SysConfigMangeWrite)] })
|
|
50
51
|
async updateSysConfig() {
|
|
52
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
51
53
|
|
|
52
54
|
const body = this.ctx.request.body as any;
|
|
53
55
|
const id = body.condition.id;
|
|
54
56
|
if (!id) {
|
|
55
|
-
return CommonResult.errorRes(
|
|
57
|
+
return CommonResult.errorRes('id不能为空');
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
const sysConfig = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).getOne({condition: body.condition}, SystemTables.sys_configs)
|
|
60
|
+
const sysConfig = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).getOne({ condition: body.condition }, SystemTables.sys_configs);
|
|
59
61
|
if (!sysConfig) {
|
|
60
|
-
return CommonResult.errorRes(
|
|
62
|
+
return CommonResult.errorRes('配置项不存在');
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
const {edit_auth_type, edit_auth_config} = sysConfig;
|
|
65
|
+
const { edit_auth_type, edit_auth_config } = sysConfig;
|
|
64
66
|
if (edit_auth_type) {
|
|
65
67
|
const isOK = this.ctx.userSession.isAuthPass(edit_auth_type, edit_auth_config);
|
|
66
68
|
if (!isOK) {
|
|
67
|
-
return CommonResult.errorRes(
|
|
69
|
+
return CommonResult.errorRes('编辑权限校验不通过:' + JSON.stringify({ edit_auth_type, edit_auth_config }));
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
|
|
73
73
|
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
74
74
|
validateCfg: {
|
|
75
75
|
'data.workbench_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING, 'length:1,64'],
|
|
76
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
76
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
77
77
|
},
|
|
78
78
|
updateCfg: {
|
|
79
79
|
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
@@ -85,7 +85,7 @@ export class SysConfigMangeApi extends BaseApiController {
|
|
|
85
85
|
async deleteSysConfig() {
|
|
86
86
|
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
87
87
|
validateCfg: {
|
|
88
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
88
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
89
89
|
},
|
|
90
90
|
updateCfg: {
|
|
91
91
|
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
@@ -2,9 +2,9 @@ import { Controller, Inject, Get } from '@midwayjs/core';
|
|
|
2
2
|
import { InfoService } from '@midwayjs/info';
|
|
3
3
|
import { Context } from '@midwayjs/koa';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import {checkPermission} from '../../middleware/permission.middleware';
|
|
6
|
-
import {SystemFuncCode} from '../../models/SystemPerm';
|
|
7
|
-
import {CommonResult} from
|
|
5
|
+
import { checkPermission } from '../../middleware/permission.middleware';
|
|
6
|
+
import { SystemFuncCode } from '../../models/SystemPerm';
|
|
7
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
8
8
|
|
|
9
9
|
@Controller('/ns/api/manage/systemInfo', { middleware: [checkPermission(SystemFuncCode.SystemInfoManageApiRead)] })
|
|
10
10
|
export class SystemInfoManageApi extends BaseApiController {
|
|
@@ -41,8 +41,13 @@ export class SystemInfoManageApi extends BaseApiController {
|
|
|
41
41
|
const networkInfo = this.infoService.networkInfo();
|
|
42
42
|
|
|
43
43
|
return CommonResult.successRes({
|
|
44
|
-
projectInfo,
|
|
45
|
-
|
|
44
|
+
projectInfo,
|
|
45
|
+
systemInfo,
|
|
46
|
+
resourceOccupationInfo,
|
|
47
|
+
softwareInfo,
|
|
48
|
+
timeInfo,
|
|
49
|
+
envInfo,
|
|
50
|
+
networkInfo,
|
|
51
|
+
});
|
|
46
52
|
}
|
|
47
|
-
|
|
48
53
|
}
|