midway-fatcms 0.0.1-beta.4 → 0.0.1-beta.41
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 +14 -0
- package/.prettierrc.js +4 -0
- package/README.md +7 -0
- package/dist/config/config.default.js +58 -15
- package/dist/config/seed/aeskey.txt +1 -1
- package/dist/configuration.d.ts +1 -0
- package/dist/configuration.js +33 -9
- package/dist/controller/base/BaseApiController.d.ts +7 -1
- package/dist/controller/base/BaseApiController.js +32 -6
- package/dist/controller/gateway/AsyncTaskController.d.ts +20 -0
- package/dist/controller/gateway/AsyncTaskController.js +181 -0
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +3 -3
- package/dist/controller/gateway/CrudMtdGatewayController.js +9 -6
- package/dist/controller/gateway/DocGatewayController.js +14 -9
- package/dist/controller/gateway/FileController.d.ts +3 -2
- package/dist/controller/gateway/PublicApiController.js +4 -6
- package/dist/controller/gateway/StaticController.d.ts +0 -1
- package/dist/controller/gateway/StaticController.js +40 -39
- package/dist/controller/helpers.controller.d.ts +1 -1
- package/dist/controller/home.controller.js +4 -3
- 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 +86 -83
- 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 +12 -5
- package/dist/controller/test.controller.d.ts +1 -1
- package/dist/controller/test.controller.js +5 -5
- package/dist/index.d.ts +35 -4
- package/dist/index.js +35 -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 +12 -5
- 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/Transaction.d.ts +1 -0
- package/dist/libs/crud-pro/models/Transaction.js +7 -0
- 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 +17 -19
- 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 +15 -3
- 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/sql.txt +120 -120
- 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/base64.d.ts +9 -0
- package/dist/libs/utils/base64.js +42 -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/libs/utils/functions.d.ts +2 -1
- package/dist/libs/utils/functions.js +6 -1
- package/dist/middleware/forbidden.middleware.js +4 -20
- package/dist/middleware/global.middleware.js +30 -10
- package/dist/middleware/permission.middleware.js +1 -1
- package/dist/models/AsyncTaskModel.d.ts +74 -0
- package/dist/models/AsyncTaskModel.js +31 -0
- package/dist/models/RedisKeys.d.ts +14 -0
- package/dist/models/RedisKeys.js +17 -0
- package/dist/models/SystemEntities.d.ts +8 -1
- package/dist/models/SystemEntities.js +7 -0
- package/dist/models/SystemTables.d.ts +1 -3
- package/dist/models/SystemTables.js +2 -4
- package/dist/models/bizmodels.d.ts +28 -0
- package/dist/models/bizmodels.js +6 -1
- package/dist/schedule/anonymousContext.d.ts +14 -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 +12 -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 +9 -5
- package/dist/service/FileCenterService.js +13 -9
- package/dist/service/SysConfigService.d.ts +1 -1
- package/dist/service/SysConfigService.js +4 -2
- package/dist/service/UserAccountService.js +10 -6
- package/dist/service/UserSessionService.d.ts +21 -0
- package/dist/service/UserSessionService.js +73 -2
- package/dist/service/VisitStatService.d.ts +1 -1
- package/dist/service/VisitStatService.js +20 -27
- package/dist/service/WorkbenchService.d.ts +33 -0
- package/dist/service/WorkbenchService.js +70 -12
- package/dist/service/anyapi/AnyApiSandboxService.js +12 -12
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +50 -0
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +287 -0
- package/dist/service/asyncTask/AsyncTaskService.d.ts +7 -0
- package/dist/service/asyncTask/AsyncTaskService.js +34 -0
- package/dist/service/asyncTask/handler/ExcelInfoModel.d.ts +10 -0
- package/dist/service/asyncTask/handler/ExcelInfoModel.js +2 -0
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.d.ts +7 -0
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.js +216 -0
- package/dist/service/asyncTask/handler/ExportExcelByInnerHttpHandler.d.ts +36 -0
- package/dist/service/asyncTask/handler/ExportExcelByInnerHttpHandler.js +139 -0
- package/dist/service/asyncTask/handler/ExportExcelByStdCrudHandler.d.ts +46 -0
- package/dist/service/asyncTask/handler/ExportExcelByStdCrudHandler.js +121 -0
- package/dist/service/base/BaseService.d.ts +12 -0
- package/dist/service/base/BaseService.js +22 -0
- package/dist/service/base/RedisCacheService.d.ts +7 -0
- package/dist/service/base/RedisCacheService.js +7 -0
- package/dist/service/crudstd/CrudStdService.d.ts +8 -1
- package/dist/service/crudstd/CrudStdService.js +63 -6
- package/dist/service/curd/CrudProQuick.d.ts +44 -0
- package/dist/service/curd/CrudProQuick.js +147 -0
- package/dist/service/curd/CurdMixByAccountService.d.ts +4 -4
- package/dist/service/curd/CurdMixByAccountService.js +12 -6
- package/dist/service/curd/CurdMixByDictService.d.ts +4 -4
- package/dist/service/curd/CurdMixByDictService.js +10 -7
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +13 -4
- package/dist/service/curd/CurdMixByLinkToCustomService.js +73 -24
- package/dist/service/curd/CurdMixBySysConfigService.d.ts +3 -3
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.d.ts +3 -3
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/curd/CurdMixService.d.ts +13 -3
- package/dist/service/curd/CurdMixService.js +26 -2
- package/dist/service/curd/CurdMixUtils.d.ts +27 -4
- package/dist/service/curd/CurdMixUtils.js +115 -41
- package/dist/service/curd/CurdProService.d.ts +3 -10
- package/dist/service/curd/CurdProService.js +36 -148
- 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/service/proxyapi/ProxyApiService.d.ts +1 -0
- package/dist/service/proxyapi/ProxyApiService.js +43 -9
- package/dist/views/404_app.html +31 -31
- package/dist/views/404_workbench.html +34 -34
- package/package.json +28 -24
- 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/config/config.default.ts +0 -172
- package/src/config/seed/aeskey.txt +0 -1
- package/src/config/utils.ts +0 -23
- package/src/configuration.ts +0 -83
- package/src/controller/base/BaseApiController.ts +0 -145
- package/src/controller/gateway/AnyApiGatewayController.ts +0 -33
- package/src/controller/gateway/CrudMtdGatewayController.ts +0 -107
- package/src/controller/gateway/CrudStdGatewayController.ts +0 -101
- package/src/controller/gateway/DocGatewayController.ts +0 -165
- package/src/controller/gateway/FileController.ts +0 -110
- package/src/controller/gateway/ProxyApiGatewayController.ts +0 -47
- package/src/controller/gateway/PublicApiController.ts +0 -145
- package/src/controller/gateway/StaticController.ts +0 -328
- package/src/controller/helpers.controller.ts +0 -161
- package/src/controller/home.controller.ts +0 -71
- package/src/controller/manage/AnyApiMangeApi.ts +0 -66
- package/src/controller/manage/AppLogMangeApi.ts +0 -53
- package/src/controller/manage/AppMangeApi.ts +0 -53
- package/src/controller/manage/AppPageMangeApi.ts +0 -52
- package/src/controller/manage/AppSchemaHistoryApi.ts +0 -49
- package/src/controller/manage/CrudMethodsMangeApi.ts +0 -49
- package/src/controller/manage/CrudStandardDesignApi.ts +0 -353
- package/src/controller/manage/DataDictManageApi.ts +0 -78
- package/src/controller/manage/DeployManageApi.ts +0 -179
- package/src/controller/manage/DocLibManageApi.ts +0 -69
- package/src/controller/manage/DocManageApi.ts +0 -99
- package/src/controller/manage/FileManageApi.ts +0 -45
- package/src/controller/manage/LowCodeTplManageApi.ts +0 -52
- package/src/controller/manage/MenuManageApi.ts +0 -63
- package/src/controller/manage/ProxyApiMangeApi.ts +0 -52
- package/src/controller/manage/SuperAdminManageApi.ts +0 -138
- package/src/controller/manage/SysConfigMangeApi.ts +0 -95
- package/src/controller/manage/SystemInfoManageApi.ts +0 -48
- package/src/controller/manage/UserAccountManageApi.ts +0 -88
- package/src/controller/manage/WorkbenchMangeApi.ts +0 -72
- 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
- package/src/controller/myinfo/AuthController.ts +0 -174
- package/src/controller/myinfo/MyInfoController.ts +0 -32
- package/src/controller/render/AppRenderController.ts +0 -76
- package/src/controller/test.controller.ts +0 -37
- package/src/filter/default.filter.ts +0 -13
- package/src/filter/notfound.filter.ts +0 -10
- package/src/index.ts +0 -71
- package/src/interface.ts +0 -31
- package/src/libs/crud-pro/CrudPro.ts +0 -158
- package/src/libs/crud-pro/defaultConfigs.ts +0 -13
- package/src/libs/crud-pro/exceptions.ts +0 -124
- package/src/libs/crud-pro/interfaces.ts +0 -183
- package/src/libs/crud-pro/models/ExecuteContext.ts +0 -111
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +0 -86
- package/src/libs/crud-pro/models/FuncContext.ts +0 -21
- package/src/libs/crud-pro/models/RequestCfgModel.ts +0 -141
- package/src/libs/crud-pro/models/RequestModel.ts +0 -141
- package/src/libs/crud-pro/models/ServiceHub.ts +0 -32
- package/src/libs/crud-pro/models/SqlCfgModel.ts +0 -52
- package/src/libs/crud-pro/models/SqlSegArg.ts +0 -13
- package/src/libs/crud-pro/models/Transaction.ts +0 -74
- package/src/libs/crud-pro/models/TransactionMySQL.ts +0 -79
- package/src/libs/crud-pro/models/TransactionPostgres.ts +0 -91
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +0 -107
- package/src/libs/crud-pro/models/keys.ts +0 -159
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +0 -75
- package/src/libs/crud-pro/services/CrudProExecuteFuncService.ts +0 -128
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +0 -279
- package/src/libs/crud-pro/services/CrudProFieldUpdateService.ts +0 -60
- package/src/libs/crud-pro/services/CrudProFieldValidateService.ts +0 -180
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +0 -373
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +0 -202
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +0 -397
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +0 -98
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +0 -59
- package/src/libs/crud-pro/services/CurdProServiceHub.ts +0 -92
- package/src/libs/crud-pro/sql.txt +0 -120
- package/src/libs/crud-pro/utils/CompareUtils.ts +0 -23
- package/src/libs/crud-pro/utils/DatabaseName.ts +0 -40
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +0 -20
- package/src/libs/crud-pro/utils/MemoryRefreshCache.ts +0 -64
- package/src/libs/crud-pro/utils/MessageParseUtils.ts +0 -33
- package/src/libs/crud-pro/utils/MixinUtils.ts +0 -285
- package/src/libs/crud-pro/utils/ModelUtils.ts +0 -55
- package/src/libs/crud-pro/utils/MultiKeyMap.ts +0 -72
- package/src/libs/crud-pro/utils/SqlFuncUtils.ts +0 -29
- package/src/libs/crud-pro/utils/TypeUtils.ts +0 -188
- package/src/libs/crud-pro/utils/ValidateUtils.ts +0 -167
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +0 -20
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +0 -22
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +0 -22
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +0 -26
- package/src/libs/crud-pro/utils/sqlConvert/convertMsSql.ts +0 -11
- package/src/libs/crud-pro/utils/sqlConvert/convertPgSql.ts +0 -11
- package/src/libs/crud-pro/utils/sqlConvert/convertPgType.ts +0 -129
- package/src/libs/utils/common-dto.ts +0 -52
- package/src/libs/utils/crypto-utils.ts +0 -52
- package/src/libs/utils/fatcms-request.ts +0 -115
- package/src/libs/utils/functions.ts +0 -67
- package/src/libs/utils/ordernum-utils.ts +0 -18
- package/src/libs/utils/parseConfig.ts +0 -62
- package/src/libs/utils/parseCreateSql.ts +0 -91
- package/src/libs/utils/render-utils.ts +0 -184
- package/src/middleware/forbidden.middleware.ts +0 -71
- package/src/middleware/global.middleware.ts +0 -278
- package/src/middleware/permission.middleware.ts +0 -81
- package/src/middleware/tx.middleware.ts +0 -30
- package/src/models/SystemEntities.ts +0 -115
- package/src/models/SystemPerm.ts +0 -105
- package/src/models/SystemTables.ts +0 -30
- package/src/models/bizmodels.ts +0 -89
- package/src/models/contextLogger.ts +0 -132
- package/src/models/devops.ts +0 -17
- package/src/models/userSession.ts +0 -216
- package/src/schedule/index.ts +0 -73
- package/src/service/AuthService.ts +0 -270
- package/src/service/EnumInfoService.ts +0 -129
- package/src/service/FileCenterService.ts +0 -394
- package/src/service/SysConfigService.ts +0 -34
- package/src/service/UserAccountService.ts +0 -100
- package/src/service/UserSessionService.ts +0 -81
- package/src/service/VisitStatService.ts +0 -179
- package/src/service/WorkbenchService.ts +0 -160
- package/src/service/anyapi/AnyApiSandboxService.ts +0 -121
- package/src/service/anyapi/AnyApiService.ts +0 -184
- package/src/service/base/ApiBaseService.ts +0 -42
- package/src/service/base/ApiRateLimiter.ts +0 -59
- package/src/service/base/BaseService.ts +0 -74
- package/src/service/base/RedisCacheService.ts +0 -38
- package/src/service/crudstd/CrudStdActionService.ts +0 -27
- package/src/service/crudstd/CrudStdConstant.ts +0 -62
- package/src/service/crudstd/CrudStdRelationService.ts +0 -78
- package/src/service/crudstd/CrudStdService.ts +0 -188
- package/src/service/curd/CurdMixByAccountService.ts +0 -83
- package/src/service/curd/CurdMixByDictService.ts +0 -113
- package/src/service/curd/CurdMixByLinkToCustomService.ts +0 -167
- package/src/service/curd/CurdMixBySysConfigService.ts +0 -78
- package/src/service/curd/CurdMixByWorkbenchService.ts +0 -68
- package/src/service/curd/CurdMixService.ts +0 -65
- package/src/service/curd/CurdMixUtils.ts +0 -248
- package/src/service/curd/CurdProService.ts +0 -379
- package/src/service/proxyapi/ProxyApiLoadService.ts +0 -165
- package/src/service/proxyapi/ProxyApiService.ts +0 -262
- package/src/service/proxyapi/ProxyApiUtils.ts +0 -32
- package/src/service/proxyapi/RouteHandler.ts +0 -8
- package/src/service/proxyapi/RouteTrie.ts +0 -74
- package/src/service/proxyapi/WeightedRandom.ts +0 -37
- package/src/service/proxyapi/WeightedRoundRobin.ts +0 -44
- package/src/views/404_app.html +0 -31
- package/src/views/404_workbench.html +0 -34
- package/src/views/static/favicon.ico +0 -0
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
|
|
4
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
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
|
-
|
|
10
|
-
const publishUpdateCfg = {
|
|
11
|
-
'data.last_publish_by': { contextAsString: CTX_VISITOR_ID },
|
|
12
|
-
'data.last_publish_at': { const: { $sqlFunc: 'NOW' } },
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
@Controller('/ns/api/manage/doc', { middleware: [checkPermission(SystemFuncCode.DocMangeRead)] })
|
|
16
|
-
export class DocManageApi extends BaseApiController {
|
|
17
|
-
@Inject()
|
|
18
|
-
ctx: Context;
|
|
19
|
-
|
|
20
|
-
@Post('/getDocList')
|
|
21
|
-
async getDocList() {
|
|
22
|
-
return this.executeSysSimpleSQL(SystemTables.sys_doc, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE, {
|
|
23
|
-
validateCfg: {
|
|
24
|
-
// 'condition.doc_lib_id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
25
|
-
},
|
|
26
|
-
updateCfg: {
|
|
27
|
-
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@Post('/getDocOne')
|
|
33
|
-
async getDocOne() {
|
|
34
|
-
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_QUERY_ONE, {
|
|
35
|
-
updateCfg: {
|
|
36
|
-
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
setReleaseData(): boolean {
|
|
42
|
-
const body = this.ctx.request.body as any;
|
|
43
|
-
const dataObj: any = body.data || {};
|
|
44
|
-
|
|
45
|
-
dataObj.workbench_code = this.ctx.workbenchInfo.workbench_code;
|
|
46
|
-
|
|
47
|
-
// 发布动作,需要前端给一个 is_publish_action 这个字段
|
|
48
|
-
if (dataObj.is_publish_action === true) {
|
|
49
|
-
dataObj.title_release = dataObj.title;
|
|
50
|
-
dataObj.content_release = dataObj.content;
|
|
51
|
-
dataObj.content_release_lake = dataObj.content_lake;
|
|
52
|
-
dataObj.is_publish = 'Y';
|
|
53
|
-
delete dataObj.is_publish_action;
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
delete dataObj.is_publish_action;
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@Post('/createDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
61
|
-
async createDoc() {
|
|
62
|
-
const isPublish = this.setReleaseData();
|
|
63
|
-
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
64
|
-
validateCfg: {
|
|
65
|
-
'data.doc_lib_id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
66
|
-
'data.title': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
67
|
-
'data.content': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
68
|
-
},
|
|
69
|
-
updateCfg: isPublish ? publishUpdateCfg : {},
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@Post('/updateDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
74
|
-
async updateDoc() {
|
|
75
|
-
const isPublish = this.setReleaseData();
|
|
76
|
-
const updateCfg = isPublish ? publishUpdateCfg : {};
|
|
77
|
-
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
78
|
-
validateCfg: {
|
|
79
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
80
|
-
},
|
|
81
|
-
updateCfg: {
|
|
82
|
-
...updateCfg,
|
|
83
|
-
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
@Post('/deleteDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
|
|
89
|
-
async deleteDoc() {
|
|
90
|
-
return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
91
|
-
validateCfg: {
|
|
92
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
93
|
-
},
|
|
94
|
-
updateCfg: {
|
|
95
|
-
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
|
|
4
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { FileCenterService } from '../../service/FileCenterService';
|
|
6
|
-
import { checkPermission } from '../../middleware/permission.middleware';
|
|
7
|
-
import { SystemFuncCode } from '../../models/SystemPerm';
|
|
8
|
-
import { SystemTables } from '../../models/SystemTables';
|
|
9
|
-
|
|
10
|
-
@Controller('/ns/api/manage/file', { middleware: [checkPermission(SystemFuncCode.FileMangeRead)] })
|
|
11
|
-
export class FileMangeApi extends BaseApiController {
|
|
12
|
-
@Inject()
|
|
13
|
-
ctx: Context;
|
|
14
|
-
|
|
15
|
-
@Inject()
|
|
16
|
-
private fileCenterService: FileCenterService;
|
|
17
|
-
|
|
18
|
-
@Post('/getFileList')
|
|
19
|
-
async getFileList() {
|
|
20
|
-
return this.executeSysSimpleSQL(SystemTables.sys_file, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@Post('/getFileOne')
|
|
24
|
-
async getFileOne() {
|
|
25
|
-
return this.executeSysSimpleSQL(SystemTables.sys_file, KeysOfSimpleSQL.SIMPLE_QUERY_ONE);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 更新文件属性
|
|
30
|
-
*/
|
|
31
|
-
@Post('/updateFile', { middleware: [checkPermission(SystemFuncCode.FileMangeWrite)] })
|
|
32
|
-
async updateFile() {
|
|
33
|
-
return this.executeSysSimpleSQL(SystemTables.sys_file, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
34
|
-
validateCfg: {
|
|
35
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Post('/deleteFile', { middleware: [checkPermission(SystemFuncCode.FileMangeWrite)] })
|
|
41
|
-
async deleteFile() {
|
|
42
|
-
const { fileKey } = this.ctx.request.body as any;
|
|
43
|
-
return this.fileCenterService.deleteFile(fileKey);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
|
|
4
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
|
|
6
|
-
const tableName = 'sys_lowcode_tpl';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 低代码模版管理
|
|
10
|
-
*/
|
|
11
|
-
@Controller('/ns/api/manage/LowCodeTplManageApi')
|
|
12
|
-
export class LowCodeTplManageApi extends BaseApiController {
|
|
13
|
-
@Inject()
|
|
14
|
-
ctx: Context;
|
|
15
|
-
|
|
16
|
-
@Post('/getLowCodeTplList')
|
|
17
|
-
async getLowCodeTplList() {
|
|
18
|
-
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Post('/getLowCodeTplOne')
|
|
22
|
-
async getLowCodeTplOne() {
|
|
23
|
-
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_QUERY_ONE);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Post('/createLowCodeTpl')
|
|
27
|
-
async createLowCodeTpl() {
|
|
28
|
-
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
29
|
-
validateCfg: {
|
|
30
|
-
'data.tpl_title': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Post('/updateLowCodeTpl')
|
|
36
|
-
async updateLowCodeTpl() {
|
|
37
|
-
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
38
|
-
validateCfg: {
|
|
39
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@Post('/deleteLowCodeTpl')
|
|
45
|
-
async deleteLowCodeTpl() {
|
|
46
|
-
return this.executeSysSimpleSQL(tableName, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
47
|
-
validateCfg: {
|
|
48
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
|
|
4
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '../../middleware/permission.middleware';
|
|
6
|
-
import { SystemFuncCode } from '../../models/SystemPerm';
|
|
7
|
-
import { SystemTables } from '../../models/SystemTables';
|
|
8
|
-
|
|
9
|
-
@Controller('/ns/api/manage/menu', { middleware: [checkPermission(SystemFuncCode.MenuMangeRead)] })
|
|
10
|
-
export class MenuManageApi extends BaseApiController {
|
|
11
|
-
@Inject()
|
|
12
|
-
ctx: Context;
|
|
13
|
-
|
|
14
|
-
@Post('/getMenuList')
|
|
15
|
-
async getMenuList() {
|
|
16
|
-
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE, {
|
|
17
|
-
updateCfg: {
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Post('/getMenuOne')
|
|
23
|
-
async getMenuOne() {
|
|
24
|
-
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_QUERY_ONE, {
|
|
25
|
-
updateCfg: {
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Post('/createMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
|
|
31
|
-
async createMenu() {
|
|
32
|
-
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
33
|
-
validateCfg: {
|
|
34
|
-
'data.menu_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
35
|
-
'data.menu_title': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
36
|
-
},
|
|
37
|
-
updateCfg: {
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@Post('/updateMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
|
|
43
|
-
async updateMenu() {
|
|
44
|
-
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
45
|
-
validateCfg: {
|
|
46
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER]
|
|
47
|
-
},
|
|
48
|
-
updateCfg: {
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@Post('/deleteMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
|
|
54
|
-
async deleteMenu() {
|
|
55
|
-
return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
56
|
-
validateCfg: {
|
|
57
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
58
|
-
},
|
|
59
|
-
updateCfg: {
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
|
|
4
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '../../middleware/permission.middleware';
|
|
6
|
-
import { SystemFuncCode } from '../../models/SystemPerm';
|
|
7
|
-
import { SystemTables } from '../../models/SystemTables';
|
|
8
|
-
|
|
9
|
-
@Controller('/ns/api/manage/proxyapi', { middleware: [checkPermission(SystemFuncCode.ProxyApiManageRead)] })
|
|
10
|
-
export class ProxyApiMangeApi extends BaseApiController {
|
|
11
|
-
@Inject()
|
|
12
|
-
protected ctx: Context;
|
|
13
|
-
|
|
14
|
-
@Post('/getProxyApiList')
|
|
15
|
-
async getProxyApiList() {
|
|
16
|
-
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Post('/getProxyApiOne')
|
|
20
|
-
async getProxyApiOne() {
|
|
21
|
-
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, KeysOfSimpleSQL.SIMPLE_QUERY_ONE);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@Post('/createProxyApi', { middleware: [checkPermission(SystemFuncCode.ProxyApiManageWrite)] })
|
|
25
|
-
async createProxyApi() {
|
|
26
|
-
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
27
|
-
validateCfg: {
|
|
28
|
-
'data.proxy_name': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
29
|
-
'data.path_prefix': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
30
|
-
'data.upstream_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Post('/updateProxyApi', { middleware: [checkPermission(SystemFuncCode.ProxyApiManageWrite)] })
|
|
36
|
-
async updateProxyApi() {
|
|
37
|
-
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
38
|
-
validateCfg: {
|
|
39
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@Post('/deleteProxyApi', { middleware: [checkPermission(SystemFuncCode.ProxyApiManageWrite)] })
|
|
45
|
-
async deleteProxyApi() {
|
|
46
|
-
return this.executeSysSimpleSQL(SystemTables.sys_proxyapi, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
47
|
-
validateCfg: {
|
|
48
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Post, Get } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { VisitStatService } from "../../service/VisitStatService";
|
|
4
|
-
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
5
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
6
|
-
import { checkRole } from '../../middleware/permission.middleware';
|
|
7
|
-
import { SystemFuncCodeNameMap, SystemRoleCode, SystemRoleCodeNameMap } from '../../models/SystemPerm';
|
|
8
|
-
import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
|
|
9
|
-
import {CommonResult} from "../../libs/utils/common-dto";
|
|
10
|
-
|
|
11
|
-
@Controller('/ns/api/manage/superAdmin', { middleware: [checkRole(SystemRoleCode.SuperAdmin)] })
|
|
12
|
-
export class SuperAdminManageApi extends BaseApiController {
|
|
13
|
-
@Inject()
|
|
14
|
-
protected ctx: Context;
|
|
15
|
-
|
|
16
|
-
@Inject()
|
|
17
|
-
protected visitStatService: VisitStatService;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 预设系统内置功能点数据
|
|
22
|
-
*/
|
|
23
|
-
@Post('/presetsFuncCode')
|
|
24
|
-
async presetsFuncCode() {
|
|
25
|
-
const funcCodeList = Object.keys(SystemFuncCodeNameMap);
|
|
26
|
-
for (let i = 0; i < funcCodeList.length; i++) {
|
|
27
|
-
const funcCode = funcCodeList[i];
|
|
28
|
-
const funcName = SystemFuncCodeNameMap[funcCode];
|
|
29
|
-
await this.curdMixService.executeCrudByCfg(
|
|
30
|
-
{
|
|
31
|
-
data: {
|
|
32
|
-
func_code: funcCode,
|
|
33
|
-
func_name: funcName,
|
|
34
|
-
is_presets: 1,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
sqlTable: SystemTables.sys_perm_func,
|
|
39
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
40
|
-
sqlDatabase: SystemDbName,
|
|
41
|
-
sqlDdType: SystemDbType,
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return CommonResult.successRes();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 预设系统内置角色数据
|
|
52
|
-
*/
|
|
53
|
-
@Post('/presetsRoleCode')
|
|
54
|
-
async presetsRoleCode() {
|
|
55
|
-
const roleCodeList = [SystemRoleCode.DevOpsViewer, SystemRoleCode.DevOpsWriter];
|
|
56
|
-
|
|
57
|
-
for (let i = 0; i < roleCodeList.length; i++) {
|
|
58
|
-
const roleCode = roleCodeList[i];
|
|
59
|
-
const roleName = SystemRoleCodeNameMap[roleCode];
|
|
60
|
-
await this.curdMixService.executeCrudByCfg(
|
|
61
|
-
{
|
|
62
|
-
data: {
|
|
63
|
-
role_code: roleCode,
|
|
64
|
-
role_name: roleName,
|
|
65
|
-
is_presets: 1,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
sqlTable: SystemTables.sys_perm_role,
|
|
70
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
71
|
-
sqlDatabase: SystemDbName,
|
|
72
|
-
sqlDdType: SystemDbType,
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return CommonResult.successRes();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* 预设系统内置:角色和功能点的关系
|
|
82
|
-
*/
|
|
83
|
-
@Post('/presetsRoleFuncList')
|
|
84
|
-
async presetsRoleFuncList() {
|
|
85
|
-
const funcCodeList = Object.keys(SystemFuncCodeNameMap);
|
|
86
|
-
for (let i = 0; i < funcCodeList.length; i++) {
|
|
87
|
-
const funcCode = funcCodeList[i];
|
|
88
|
-
await this.curdMixService.executeCrudByCfg(
|
|
89
|
-
{
|
|
90
|
-
data: {
|
|
91
|
-
func_code: funcCode,
|
|
92
|
-
role_code: SystemRoleCode.DevOpsWriter,
|
|
93
|
-
is_presets: 1,
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
sqlTable: SystemTables.sys_perm_role_func,
|
|
98
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
99
|
-
sqlDatabase: SystemDbName,
|
|
100
|
-
sqlDdType: SystemDbType,
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
for (let i = 0; i < funcCodeList.length; i++) {
|
|
105
|
-
const funcCode = funcCodeList[i];
|
|
106
|
-
if (!funcCode.endsWith('Write')) {
|
|
107
|
-
await this.curdMixService.executeCrudByCfg(
|
|
108
|
-
{
|
|
109
|
-
data: {
|
|
110
|
-
func_code: funcCode,
|
|
111
|
-
role_code: SystemRoleCode.DevOpsViewer,
|
|
112
|
-
is_presets: 1,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
sqlTable: SystemTables.sys_perm_role_func,
|
|
117
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
118
|
-
sqlDatabase: SystemDbName,
|
|
119
|
-
sqlDdType: SystemDbType,
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return CommonResult.successRes();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* 将每天的访问数据,更新到数据库中
|
|
130
|
-
*/
|
|
131
|
-
@Get('/flushVisitStatToDB')
|
|
132
|
-
async flushVisitStatToDB() {
|
|
133
|
-
return this.visitStatService.flushVisitStatToDB();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
|
|
4
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '../../middleware/permission.middleware';
|
|
6
|
-
import { SystemFuncCode } from '../../models/SystemPerm';
|
|
7
|
-
import { CTX_WORKBENCH_CODE } from '../../models/bizmodels';
|
|
8
|
-
import {SystemDbName, SystemDbType, SystemTables} from "../../models/SystemTables";
|
|
9
|
-
import {CommonResult} from "../../libs/utils/common-dto";
|
|
10
|
-
|
|
11
|
-
@Controller('/ns/api/manage/sysconfig', { middleware: [checkPermission(SystemFuncCode.SysConfigMangeRead)] })
|
|
12
|
-
export class SysConfigMangeApi extends BaseApiController {
|
|
13
|
-
@Inject()
|
|
14
|
-
ctx: Context;
|
|
15
|
-
|
|
16
|
-
@Post('/getSysConfigList')
|
|
17
|
-
async getSysConfigList() {
|
|
18
|
-
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_QUERY_PAGE, {
|
|
19
|
-
updateCfg: {
|
|
20
|
-
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Post('/getSysConfigOne')
|
|
26
|
-
async getSysConfigOne() {
|
|
27
|
-
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_QUERY_ONE, {
|
|
28
|
-
updateCfg: {
|
|
29
|
-
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@Post('/createSysConfig', { middleware: [checkPermission(SystemFuncCode.SysConfigMangeWrite)] })
|
|
35
|
-
async createSysConfig() {
|
|
36
|
-
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
37
|
-
validateCfg: {
|
|
38
|
-
'data.workbench_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING, 'length:1,64'],
|
|
39
|
-
'data.config_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
40
|
-
'data.config_name': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
41
|
-
'data.config_type': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
42
|
-
},
|
|
43
|
-
updateCfg: {
|
|
44
|
-
'data.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@Post('/updateSysConfig', { middleware: [checkPermission(SystemFuncCode.SysConfigMangeWrite)] })
|
|
50
|
-
async updateSysConfig() {
|
|
51
|
-
|
|
52
|
-
const body = this.ctx.request.body as any;
|
|
53
|
-
const id = body.condition.id;
|
|
54
|
-
if (!id) {
|
|
55
|
-
return CommonResult.errorRes("id不能为空")
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const sysConfig = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).getOne({condition: body.condition}, SystemTables.sys_configs)
|
|
59
|
-
if (!sysConfig) {
|
|
60
|
-
return CommonResult.errorRes("配置项不存在")
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const {edit_auth_type, edit_auth_config} = sysConfig;
|
|
64
|
-
if (edit_auth_type) {
|
|
65
|
-
const isOK = this.ctx.userSession.isAuthPass(edit_auth_type, edit_auth_config);
|
|
66
|
-
if (!isOK) {
|
|
67
|
-
return CommonResult.errorRes("编辑权限校验不通过:" + JSON.stringify({edit_auth_type, edit_auth_config}));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
74
|
-
validateCfg: {
|
|
75
|
-
'data.workbench_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING, 'length:1,64'],
|
|
76
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
77
|
-
},
|
|
78
|
-
updateCfg: {
|
|
79
|
-
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@Post('/deleteSysConfig', { middleware: [checkPermission(SystemFuncCode.SysConfigMangeWrite)] })
|
|
85
|
-
async deleteSysConfig() {
|
|
86
|
-
return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
87
|
-
validateCfg: {
|
|
88
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
89
|
-
},
|
|
90
|
-
updateCfg: {
|
|
91
|
-
'condition.workbench_code': { contextAsString: CTX_WORKBENCH_CODE },
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Get } from '@midwayjs/core';
|
|
2
|
-
import { InfoService } from '@midwayjs/info';
|
|
3
|
-
import { Context } from '@midwayjs/koa';
|
|
4
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import {checkPermission} from '../../middleware/permission.middleware';
|
|
6
|
-
import {SystemFuncCode} from '../../models/SystemPerm';
|
|
7
|
-
import {CommonResult} from "../../libs/utils/common-dto";
|
|
8
|
-
|
|
9
|
-
@Controller('/ns/api/manage/systemInfo', { middleware: [checkPermission(SystemFuncCode.SystemInfoManageApiRead)] })
|
|
10
|
-
export class SystemInfoManageApi extends BaseApiController {
|
|
11
|
-
@Inject()
|
|
12
|
-
protected ctx: Context;
|
|
13
|
-
|
|
14
|
-
@Inject()
|
|
15
|
-
protected infoService: InfoService;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 预设系统内置功能点数据
|
|
19
|
-
*/
|
|
20
|
-
@Get('/getSystemInfo')
|
|
21
|
-
async getSystemInfo() {
|
|
22
|
-
// 应用信息,应用名等
|
|
23
|
-
const projectInfo = this.infoService.projectInfo();
|
|
24
|
-
// 系统信息
|
|
25
|
-
const systemInfo = this.infoService.systemInfo();
|
|
26
|
-
// 堆内存,cpu 等
|
|
27
|
-
const resourceOccupationInfo = this.infoService.resourceOccupationInfo();
|
|
28
|
-
// midway 框架的信息
|
|
29
|
-
const softwareInfo = this.infoService.softwareInfo();
|
|
30
|
-
// 当前使用的环境配置
|
|
31
|
-
// const midwayConfig = this.infoService.midwayConfig();
|
|
32
|
-
// 依赖注入容器中的服务
|
|
33
|
-
// this.infoService.midwayService();
|
|
34
|
-
// 系统时间,时区,启动时常
|
|
35
|
-
const timeInfo = this.infoService.timeInfo();
|
|
36
|
-
// 环境变量
|
|
37
|
-
const envInfo = this.infoService.envInfo();
|
|
38
|
-
// 依赖信息
|
|
39
|
-
// this.infoService.dependenciesInfo();
|
|
40
|
-
// 网络信息
|
|
41
|
-
const networkInfo = this.infoService.networkInfo();
|
|
42
|
-
|
|
43
|
-
return CommonResult.successRes({
|
|
44
|
-
projectInfo,systemInfo,resourceOccupationInfo,softwareInfo,timeInfo,envInfo,networkInfo
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
|
|
4
|
-
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { createUniqueId } from '../../libs/utils/functions';
|
|
6
|
-
import { checkPermission } from '../../middleware/permission.middleware';
|
|
7
|
-
import { SystemFuncCode } from '../../models/SystemPerm';
|
|
8
|
-
import { CommonException, Exceptions } from '../../libs/crud-pro/exceptions';
|
|
9
|
-
import { SystemTables } from '../../models/SystemTables';
|
|
10
|
-
|
|
11
|
-
const accountNameBlacklist = new Set(['sa', 'root', 'admin', 'superadmin', 'administrator', 'sys', 'sysop', 'schedule_user']);
|
|
12
|
-
function checkAccountCreateBlacklist(value: string) {
|
|
13
|
-
if (!value) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (accountNameBlacklist.has(value)) {
|
|
17
|
-
throw new CommonException(Exceptions.VALIDATE_EXCEPTION, '用户名或昵称不能使用具有管理员歧义的词语');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const LOGIN_NAME_VALIDATE = [KeysOfValidators.STRING, KeysOfValidators.NAME, 'length:6,50', checkAccountCreateBlacklist]
|
|
22
|
-
|
|
23
|
-
@Controller('/ns/api/manage/userAccount', { middleware: [checkPermission(SystemFuncCode.UserAccountMangeRead)] })
|
|
24
|
-
export class UserAccountManageApi extends BaseApiController {
|
|
25
|
-
@Inject()
|
|
26
|
-
ctx: Context;
|
|
27
|
-
|
|
28
|
-
@Post('/getUserAccountList')
|
|
29
|
-
async getUserAccountList() {
|
|
30
|
-
return this.executeSysSimpleSQL(SystemTables.sys_user_account, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE, {
|
|
31
|
-
columns: '!pwd_md5,!pwd_salt',
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Post('/getUserAccountOne')
|
|
36
|
-
async getUserAccountOne() {
|
|
37
|
-
return this.executeSysSimpleSQL(SystemTables.sys_user_account, KeysOfSimpleSQL.SIMPLE_QUERY_ONE, {
|
|
38
|
-
columns: '!pwd_md5,!pwd_salt',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@Post('/updateUserAccount', { middleware: [checkPermission(SystemFuncCode.UserAccountMangeWrite)] })
|
|
43
|
-
async updateUserAccount() {
|
|
44
|
-
return this.executeSysSimpleSQL(SystemTables.sys_user_account, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
45
|
-
validateCfg: {
|
|
46
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
47
|
-
'data.login_name': LOGIN_NAME_VALIDATE,
|
|
48
|
-
'data.nick_name': [KeysOfValidators.STRING, 'length:3,20', checkAccountCreateBlacklist],
|
|
49
|
-
},
|
|
50
|
-
allowCfg: {
|
|
51
|
-
data: ['login_name', 'nick_name', 'avatar', 'status'],
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@Post('/createUserAccount', { middleware: [checkPermission(SystemFuncCode.UserAccountMangeWrite)] })
|
|
57
|
-
async createUserAccount() {
|
|
58
|
-
const body = this.ctx.request.body as any;
|
|
59
|
-
body.data.account_id = createUniqueId();
|
|
60
|
-
|
|
61
|
-
return this.executeSysSimpleSQL(SystemTables.sys_user_account, KeysOfSimpleSQL.SIMPLE_INSERT, {
|
|
62
|
-
validateCfg: {
|
|
63
|
-
'data.login_name': LOGIN_NAME_VALIDATE,
|
|
64
|
-
'data.nick_name': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING, 'length:3,20', checkAccountCreateBlacklist],
|
|
65
|
-
'data.avatar': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@Post('/deleteUserAccount', { middleware: [checkPermission(SystemFuncCode.UserAccountMangeWrite)] })
|
|
71
|
-
async deleteUserAccount() {
|
|
72
|
-
return this.executeSysSimpleSQL(SystemTables.sys_user_account, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
73
|
-
validateCfg: {
|
|
74
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 重置密码
|
|
81
|
-
*/
|
|
82
|
-
@Post('/chgUserPassword', { middleware: [checkPermission(SystemFuncCode.UserAccountMangeWrite)] })
|
|
83
|
-
async chgUserPassword() {
|
|
84
|
-
const body = this.ctx.request.body as any;
|
|
85
|
-
const { loginName, unsaltedPwd } = body;
|
|
86
|
-
return this.userAccountService.chgUserPassword(loginName, unsaltedPwd);
|
|
87
|
-
}
|
|
88
|
-
}
|