midway-fatcms 0.0.1-beta.3 → 0.0.1-beta.31
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 +60 -19
- 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 +3 -0
- package/dist/controller/gateway/StaticController.js +74 -51
- 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/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 +14 -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/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/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/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 +32 -0
- package/dist/service/WorkbenchService.js +61 -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/views/404_app.html +31 -31
- package/dist/views/404_workbench.html +34 -34
- package/package.json +25 -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 -303
- 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
|
@@ -22,6 +22,7 @@ const ApiBaseService_1 = require("../../service/base/ApiBaseService");
|
|
|
22
22
|
const CurdProService_1 = require("../../service/curd/CurdProService");
|
|
23
23
|
const CurdMixService_1 = require("../../service/curd/CurdMixService");
|
|
24
24
|
const DatabaseName_1 = require("../../libs/crud-pro/utils/DatabaseName");
|
|
25
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
25
26
|
const QUERY_AS_LIST = ['condition', 'data'];
|
|
26
27
|
function pickAsQuery(query_as_pick, query) {
|
|
27
28
|
if (query_as_pick && typeof query_as_pick === 'string') {
|
|
@@ -30,11 +31,11 @@ function pickAsQuery(query_as_pick, query) {
|
|
|
30
31
|
}
|
|
31
32
|
return query;
|
|
32
33
|
}
|
|
33
|
-
// /ns/gw/
|
|
34
|
+
// /ns/gw/crudApi/getUser?__query_as_condition__=id&_query_as_data__=name&&id=1&name=22
|
|
34
35
|
/**
|
|
35
|
-
* query形式1:GET: /ns/gw/
|
|
36
|
-
* query形式2:GET: /ns/gw/
|
|
37
|
-
* query形式3:GET: /ns/gw/
|
|
36
|
+
* query形式1:GET: /ns/gw/crudApi/getUser?__query_json__=%7B%22condition%22%3A%7B%22id%22%3A2%7D%7D
|
|
37
|
+
* query形式2:GET: /ns/gw/crudApi/getUser?__query_as__=condition&id=1&name=22
|
|
38
|
+
* query形式3:GET: /ns/gw/crudApi/createUser?__query_as__=data&__query_pick__=id,name&id=1&name=22
|
|
38
39
|
*
|
|
39
40
|
* 执行单个配置的接口
|
|
40
41
|
*/
|
|
@@ -50,7 +51,7 @@ let CrudMtdGatewayController = class CrudMtdGatewayController extends ApiBaseSer
|
|
|
50
51
|
if (!methodInfo || methodInfo.status !== 1) {
|
|
51
52
|
return common_dto_1.CommonResult.errorRes('接口不存在或已下线: ' + methodCode);
|
|
52
53
|
}
|
|
53
|
-
this.logInfo(
|
|
54
|
+
this.logInfo('methodInfo=== ', methodInfo);
|
|
54
55
|
const workbench_code_array = methodInfo.workbench_code_array || methodInfo.workbenchCodeArray;
|
|
55
56
|
const isSupport = await this.workbenchService.isSupportCurrentWorkbench(workbench_code_array);
|
|
56
57
|
if (!isSupport) {
|
|
@@ -83,7 +84,9 @@ let CrudMtdGatewayController = class CrudMtdGatewayController extends ApiBaseSer
|
|
|
83
84
|
const cfgModel = methodInfo;
|
|
84
85
|
const { dbType, dbName } = (0, DatabaseName_1.parseDatabaseName)(cfgModel.sqlDatabase);
|
|
85
86
|
cfgModel.sqlDatabase = dbName;
|
|
86
|
-
cfgModel.
|
|
87
|
+
cfgModel.sqlDbType = dbType;
|
|
88
|
+
// 业务系统自定义的修改cfgModel
|
|
89
|
+
await global_config_1.GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudMtd(reqJson, cfgModel, methodInfo, this.ctx);
|
|
87
90
|
return this.curdMixService.executeCrudByCfg(reqJson, cfgModel);
|
|
88
91
|
}
|
|
89
92
|
};
|
|
@@ -16,6 +16,7 @@ exports.DocGatewayController = void 0;
|
|
|
16
16
|
const core_1 = require("@midwayjs/core");
|
|
17
17
|
const BaseApiController_1 = require("../base/BaseApiController");
|
|
18
18
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
19
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
19
20
|
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
20
21
|
const WorkbenchService_1 = require("../../service/WorkbenchService");
|
|
21
22
|
const common_dto_1 = require("../../libs/utils/common-dto");
|
|
@@ -40,9 +41,10 @@ let DocGatewayController = class DocGatewayController extends BaseApiController_
|
|
|
40
41
|
if (nxRes !== 'OK') {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
44
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
43
45
|
await this.curdMixService.executeCrudByCfg({
|
|
44
46
|
data: {
|
|
45
|
-
pv: pv + 1
|
|
47
|
+
pv: pv + 1,
|
|
46
48
|
},
|
|
47
49
|
condition: {
|
|
48
50
|
id: parseInt(docId),
|
|
@@ -51,8 +53,8 @@ let DocGatewayController = class DocGatewayController extends BaseApiController_
|
|
|
51
53
|
}, {
|
|
52
54
|
sqlTable: SystemTables_1.SystemTables.sys_doc,
|
|
53
55
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE,
|
|
54
|
-
sqlDatabase:
|
|
55
|
-
|
|
56
|
+
sqlDatabase: SystemDbName,
|
|
57
|
+
sqlDbType: SystemDbType,
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
@@ -66,6 +68,7 @@ let DocGatewayController = class DocGatewayController extends BaseApiController_
|
|
|
66
68
|
if (!docLibInfoRes.success) {
|
|
67
69
|
return docLibInfoRes;
|
|
68
70
|
}
|
|
71
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
69
72
|
const res = await this.curdMixService.executeCrudByCfg({
|
|
70
73
|
condition: {
|
|
71
74
|
id: parseInt(docId),
|
|
@@ -74,8 +77,8 @@ let DocGatewayController = class DocGatewayController extends BaseApiController_
|
|
|
74
77
|
}, {
|
|
75
78
|
sqlTable: SystemTables_1.SystemTables.sys_doc,
|
|
76
79
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
77
|
-
sqlDatabase:
|
|
78
|
-
|
|
80
|
+
sqlDatabase: SystemDbName,
|
|
81
|
+
sqlDbType: SystemDbType,
|
|
79
82
|
});
|
|
80
83
|
// 更新PV数据
|
|
81
84
|
const docObj = res.getOneObj();
|
|
@@ -94,6 +97,7 @@ let DocGatewayController = class DocGatewayController extends BaseApiController_
|
|
|
94
97
|
if (!docLibInfoRes.success) {
|
|
95
98
|
return docLibInfoRes;
|
|
96
99
|
}
|
|
100
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
97
101
|
return this.curdMixService.executeCrudByCfg({
|
|
98
102
|
columns: 'id,title,doc_category_code,sort_index',
|
|
99
103
|
orderBy: 'sort_index+,id-',
|
|
@@ -106,8 +110,8 @@ let DocGatewayController = class DocGatewayController extends BaseApiController_
|
|
|
106
110
|
}, {
|
|
107
111
|
sqlTable: SystemTables_1.SystemTables.sys_doc,
|
|
108
112
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
109
|
-
sqlDatabase:
|
|
110
|
-
|
|
113
|
+
sqlDatabase: SystemDbName,
|
|
114
|
+
sqlDbType: SystemDbType,
|
|
111
115
|
});
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
@@ -116,6 +120,7 @@ let DocGatewayController = class DocGatewayController extends BaseApiController_
|
|
|
116
120
|
*/
|
|
117
121
|
async getDocLibInfo(docLibId) {
|
|
118
122
|
checkIsNumber(docLibId, 'docLibId');
|
|
123
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
119
124
|
const s = await this.curdMixService.executeCrudByCfg({
|
|
120
125
|
condition: {
|
|
121
126
|
id: parseInt(docLibId),
|
|
@@ -123,8 +128,8 @@ let DocGatewayController = class DocGatewayController extends BaseApiController_
|
|
|
123
128
|
}, {
|
|
124
129
|
sqlTable: SystemTables_1.SystemTables.sys_doc_lib,
|
|
125
130
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
126
|
-
sqlDatabase:
|
|
127
|
-
|
|
131
|
+
sqlDatabase: SystemDbName,
|
|
132
|
+
sqlDbType: SystemDbType,
|
|
128
133
|
});
|
|
129
134
|
const docLibInfo = s.getOneObj();
|
|
130
135
|
if (!docLibInfo) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Context } from '@midwayjs/koa';
|
|
2
2
|
import { BaseApiController } from '../base/BaseApiController';
|
|
3
|
+
import { FileCenterService } from '../../service/FileCenterService';
|
|
3
4
|
import { CommonResult } from '../../libs/utils/common-dto';
|
|
4
5
|
/**
|
|
5
6
|
* 文件上传下载服务
|
|
6
7
|
*/
|
|
7
8
|
export declare class FileController extends BaseApiController {
|
|
8
|
-
ctx: Context;
|
|
9
|
-
|
|
9
|
+
protected ctx: Context;
|
|
10
|
+
protected fileCenterService: FileCenterService;
|
|
10
11
|
/**
|
|
11
12
|
* 上传普通文件。必须是登录用户才能上传。
|
|
12
13
|
* @param files
|
|
@@ -48,11 +48,11 @@ let PublicApiController = class PublicApiController extends BaseApiController_1.
|
|
|
48
48
|
if (!workbenchMenuCode) {
|
|
49
49
|
return common_dto_1.CommonResult.errorRes('param workbenchMenuCode is null');
|
|
50
50
|
}
|
|
51
|
-
const workbenchMenuCodeStr =
|
|
51
|
+
const workbenchMenuCodeStr = '' + workbenchMenuCode;
|
|
52
52
|
const workbenchMenuCodeArray = workbenchMenuCodeStr.split(',');
|
|
53
53
|
const condition = {
|
|
54
54
|
menu_code: {
|
|
55
|
-
|
|
55
|
+
$in: workbenchMenuCodeArray,
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
58
|
const rows = await this.sysDBUtil.getList({ condition }, SystemTables_1.SystemTables.sys_menus);
|
|
@@ -74,9 +74,7 @@ let PublicApiController = class PublicApiController extends BaseApiController_1.
|
|
|
74
74
|
// 特殊的devops菜单
|
|
75
75
|
map['devops'] = {
|
|
76
76
|
menu_list: [],
|
|
77
|
-
hasPermission: this.ctx.userSession.isAuthPass(keys_1.KeysOfAuthType.byRoleCode, [
|
|
78
|
-
SystemPerm_1.SystemRoleCode.DevOpsWriter, SystemPerm_1.SystemRoleCode.DevOpsViewer, SystemPerm_1.SystemRoleCode.SuperAdmin
|
|
79
|
-
])
|
|
77
|
+
hasPermission: this.ctx.userSession.isAuthPass(keys_1.KeysOfAuthType.byRoleCode, [SystemPerm_1.SystemRoleCode.DevOpsWriter, SystemPerm_1.SystemRoleCode.DevOpsViewer, SystemPerm_1.SystemRoleCode.SuperAdmin]),
|
|
80
78
|
};
|
|
81
79
|
return common_dto_1.CommonResult.successRes(map);
|
|
82
80
|
}
|
|
@@ -109,7 +107,7 @@ let PublicApiController = class PublicApiController extends BaseApiController_1.
|
|
|
109
107
|
const body = this.ctx.request.body;
|
|
110
108
|
const query = this.ctx.query || {};
|
|
111
109
|
let codeList = _.get(body, 'codeList');
|
|
112
|
-
|
|
110
|
+
const refreshCache = `${_.get(body, 'refreshCache')}` === 'true' || query.refreshCache === 'true';
|
|
113
111
|
if (query.codeList) {
|
|
114
112
|
//codeList=dict@@SexEnum,sysCfgEnum@@EntityStatusEnum
|
|
115
113
|
const codeListStr = query.codeList;
|
|
@@ -11,6 +11,9 @@ interface HttpGetRes {
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class StaticController extends BaseApiController {
|
|
13
13
|
protected ctx: Context;
|
|
14
|
+
constructor();
|
|
15
|
+
private getLocalPaths;
|
|
16
|
+
private initNotFoundList;
|
|
14
17
|
private responseLocalFile;
|
|
15
18
|
proxyStaticFile(ossName: string, relativePath: string): Promise<string>;
|
|
16
19
|
saveNotFoundList(): Promise<void>;
|
|
@@ -20,17 +20,17 @@ const fs2 = require("fs");
|
|
|
20
20
|
const path = require("path");
|
|
21
21
|
const https = require("https");
|
|
22
22
|
const functions_1 = require("../../libs/utils/functions");
|
|
23
|
-
const localDir = path.join(__dirname, '../../../public/static'); // 本地文件存储目录
|
|
24
|
-
const notFoundListFile = path.join(localDir, '__404__list.json'); // 404列表文件
|
|
25
23
|
function getPathConfig(ossName) {
|
|
26
24
|
const remoteBaseUrlMap = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
cdnjsx: 'https://cdnjsx.oss-cn-shanghai.aliyuncs.com',
|
|
26
|
+
'i.alicdn.com': 'https://i.alicdn.com',
|
|
27
|
+
'img.alicdn.com': 'https://img.alicdn.com',
|
|
28
|
+
'at.alicdn.com': 'https://at.alicdn.com',
|
|
30
29
|
};
|
|
31
|
-
|
|
30
|
+
let remoteBaseUrl = remoteBaseUrlMap[ossName];
|
|
32
31
|
if (!remoteBaseUrl) {
|
|
33
|
-
|
|
32
|
+
console.error(`getPathConfig ossName: ${ossName} 未配置`);
|
|
33
|
+
remoteBaseUrl = `https://${ossName}`;
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
remoteBaseUrl,
|
|
@@ -38,30 +38,47 @@ function getPathConfig(ossName) {
|
|
|
38
38
|
}
|
|
39
39
|
// 404列表缓存
|
|
40
40
|
let notFoundList = new Set();
|
|
41
|
-
|
|
42
|
-
async function init() {
|
|
43
|
-
try {
|
|
44
|
-
// 确保本地存储目录存在
|
|
45
|
-
await fs.mkdir(localDir, { recursive: true });
|
|
46
|
-
const data = await fs.readFile(notFoundListFile, 'utf8');
|
|
47
|
-
notFoundList = new Set(JSON.parse(data));
|
|
48
|
-
console.log(`已加载${notFoundList.size}个404记录`);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
if (error.code !== 'ENOENT') {
|
|
52
|
-
console.error('读取404列表失败:', error);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
init();
|
|
41
|
+
let notFoundListIsInit = false;
|
|
57
42
|
/**
|
|
58
43
|
* 静态文件代理功能
|
|
59
44
|
*/
|
|
60
45
|
let StaticController = class StaticController extends BaseApiController_1.BaseApiController {
|
|
46
|
+
constructor() {
|
|
47
|
+
super();
|
|
48
|
+
this.initNotFoundList();
|
|
49
|
+
}
|
|
50
|
+
getLocalPaths() {
|
|
51
|
+
const appDir = this.app.getAppDir();
|
|
52
|
+
const localDir = path.join(appDir, './public/static'); // 本地文件存储目录
|
|
53
|
+
const notFoundListFile = path.join(localDir, '__404__list.json'); // 404列表文件
|
|
54
|
+
return {
|
|
55
|
+
localDir,
|
|
56
|
+
notFoundListFile,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async initNotFoundList() {
|
|
60
|
+
if (notFoundListIsInit) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
notFoundListIsInit = true;
|
|
64
|
+
const { localDir, notFoundListFile } = this.getLocalPaths();
|
|
65
|
+
try {
|
|
66
|
+
// 确保本地存储目录存在
|
|
67
|
+
await fs.mkdir(localDir, { recursive: true });
|
|
68
|
+
const data = await fs.readFile(notFoundListFile, 'utf8');
|
|
69
|
+
notFoundList = new Set(JSON.parse(data));
|
|
70
|
+
console.log(`已加载${notFoundList.size}个404记录`);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error.code !== 'ENOENT') {
|
|
74
|
+
console.error('读取404列表失败:', error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
61
78
|
async responseLocalFile(localFilePath, localHeaderPath, relativePath) {
|
|
62
79
|
const headers = {
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
'Cache-Control': 'public, max-age=31536000',
|
|
81
|
+
Expires: new Date(Date.now() + 31536000000).toUTCString(),
|
|
65
82
|
};
|
|
66
83
|
try {
|
|
67
84
|
// 检查本地文件是否存在.头文件
|
|
@@ -70,16 +87,17 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
|
|
|
70
87
|
const headerDataStr = await fs.readFile(localHeaderPath, 'utf8');
|
|
71
88
|
const headerData = (0, functions_1.parseJsonObject)(headerDataStr);
|
|
72
89
|
if (headerData) {
|
|
73
|
-
headers[
|
|
74
|
-
headers[
|
|
75
|
-
headers[
|
|
76
|
-
headers[
|
|
77
|
-
headers[
|
|
78
|
-
headers[
|
|
90
|
+
headers['content-type'] = headerData['content-type'];
|
|
91
|
+
headers['content-length'] = headerData['content-length'];
|
|
92
|
+
headers['last-modified'] = headerData['last-modified'];
|
|
93
|
+
headers['etag'] = headerData['etag'];
|
|
94
|
+
headers['cache-control'] = headerData['cache-control'];
|
|
95
|
+
headers['accept-ranges'] = headerData['accept-ranges'];
|
|
79
96
|
}
|
|
80
97
|
}
|
|
81
98
|
}
|
|
82
99
|
catch (error) {
|
|
100
|
+
this.logDebug('[StaticController]responseLocalFile', error);
|
|
83
101
|
}
|
|
84
102
|
try {
|
|
85
103
|
// 检查本地文件是否存在
|
|
@@ -94,7 +112,7 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
|
|
|
94
112
|
// stream.on = (...args)=>{
|
|
95
113
|
// return oldOn(...args)
|
|
96
114
|
// }
|
|
97
|
-
|
|
115
|
+
this.logInfo(`[StaticController]返回本地文件: ${relativePath}`);
|
|
98
116
|
this.ctx.status = 200;
|
|
99
117
|
this.ctx.set(headers);
|
|
100
118
|
this.ctx.body = stream;
|
|
@@ -107,10 +125,11 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
|
|
|
107
125
|
return false;
|
|
108
126
|
}
|
|
109
127
|
async proxyStaticFile(ossName, relativePath) {
|
|
128
|
+
const { localDir } = this.getLocalPaths();
|
|
110
129
|
const PATH_CONFIG = getPathConfig(ossName);
|
|
111
130
|
// 构建本地路径和远程路径
|
|
112
|
-
const localFilePath = path.join(localDir,
|
|
113
|
-
const localHeaderPath = path.join(localDir,
|
|
131
|
+
const localFilePath = path.join(localDir, 'files', ossName, relativePath);
|
|
132
|
+
const localHeaderPath = path.join(localDir, 'headers', ossName, relativePath);
|
|
114
133
|
const remoteUrl = `${PATH_CONFIG.remoteBaseUrl}/${relativePath}`;
|
|
115
134
|
// 检查是否在404列表中
|
|
116
135
|
if (notFoundList.has(relativePath)) {
|
|
@@ -122,7 +141,7 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
|
|
|
122
141
|
return;
|
|
123
142
|
}
|
|
124
143
|
// 请求远程文件
|
|
125
|
-
|
|
144
|
+
this.logInfo(`[StaticController]请求远程文件: ${remoteUrl}`);
|
|
126
145
|
try {
|
|
127
146
|
const remoteRes = await this.httpsGet(remoteUrl);
|
|
128
147
|
// 处理远程响应状态码
|
|
@@ -138,29 +157,30 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
|
|
|
138
157
|
// 记录404并返回
|
|
139
158
|
notFoundList.add(relativePath);
|
|
140
159
|
await this.saveNotFoundList();
|
|
141
|
-
|
|
160
|
+
this.logInfo(`[StaticController]远程文件不存在,已记录404: ${relativePath}`);
|
|
142
161
|
this.ctx.status = 404;
|
|
143
162
|
return this.ctx.render('500', { errorMsg: ' 远程文件不存在,已记录404' });
|
|
144
163
|
}
|
|
145
164
|
else {
|
|
146
165
|
// 其他状态码
|
|
147
|
-
const msg =
|
|
148
|
-
|
|
166
|
+
const msg = `[StaticController]远程服务器返回状态码: ${remoteRes.statusCode}`;
|
|
167
|
+
this.logInfo(msg);
|
|
149
168
|
this.ctx.status = 502;
|
|
150
169
|
return this.ctx.render('500', { errorMsg: msg });
|
|
151
170
|
}
|
|
152
171
|
}
|
|
153
172
|
catch (err) {
|
|
154
|
-
const msg =
|
|
155
|
-
|
|
173
|
+
const msg = `[StaticController]请求远程文件失败: ${err}`;
|
|
174
|
+
this.logError(msg);
|
|
156
175
|
this.ctx.status = 500;
|
|
157
176
|
return this.ctx.render('500', { errorMsg: msg });
|
|
158
177
|
}
|
|
159
178
|
this.ctx.status = 500;
|
|
160
|
-
return this.ctx.render('500', { errorMsg:
|
|
179
|
+
return this.ctx.render('500', { errorMsg: '未知异常' });
|
|
161
180
|
}
|
|
162
181
|
// 保存404列表
|
|
163
182
|
async saveNotFoundList() {
|
|
183
|
+
const { notFoundListFile } = this.getLocalPaths();
|
|
164
184
|
try {
|
|
165
185
|
// 确保存储404列表的目录存在
|
|
166
186
|
const dir = path.dirname(notFoundListFile);
|
|
@@ -168,19 +188,21 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
|
|
|
168
188
|
await fs.writeFile(notFoundListFile, JSON.stringify(Array.from(notFoundList), null), 'utf8');
|
|
169
189
|
}
|
|
170
190
|
catch (error) {
|
|
171
|
-
|
|
191
|
+
this.logError('[StaticController]保存404列表失败:', error);
|
|
172
192
|
}
|
|
173
193
|
}
|
|
174
194
|
// 封装https请求为异步函数
|
|
175
195
|
async httpsGet(url) {
|
|
176
196
|
return new Promise((resolve, reject) => {
|
|
177
|
-
https
|
|
197
|
+
https
|
|
198
|
+
.get(url, res => {
|
|
178
199
|
resolve({
|
|
179
200
|
statusCode: res.statusCode || 500,
|
|
180
201
|
headers: res.headers,
|
|
181
|
-
body: res
|
|
202
|
+
body: res,
|
|
182
203
|
});
|
|
183
|
-
})
|
|
204
|
+
})
|
|
205
|
+
.on('error', err => {
|
|
184
206
|
reject(err);
|
|
185
207
|
});
|
|
186
208
|
});
|
|
@@ -203,17 +225,17 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
|
|
|
203
225
|
// 使用管道将响应流写入文件
|
|
204
226
|
await new Promise((resolve, reject) => {
|
|
205
227
|
body.pipe(fileStream);
|
|
206
|
-
body.on('error',
|
|
228
|
+
body.on('error', err => {
|
|
207
229
|
reject(new Error(`读取响应流失败: ${err.message}`));
|
|
208
230
|
});
|
|
209
231
|
fileStream.on('finish', resolve);
|
|
210
|
-
fileStream.on('error',
|
|
232
|
+
fileStream.on('error', err => {
|
|
211
233
|
reject(new Error(`写入文件失败: ${err.message}`));
|
|
212
234
|
});
|
|
213
235
|
});
|
|
214
|
-
|
|
236
|
+
this.logInfo(`[StaticController]文件已成功写入1: ${localFilePath}`);
|
|
215
237
|
await fs.writeFile(localHeaderPath, JSON.stringify(httpsGetRes.headers), 'utf8');
|
|
216
|
-
|
|
238
|
+
this.logInfo(`[StaticController]文件已成功写入2: ${localHeaderPath}`);
|
|
217
239
|
}
|
|
218
240
|
catch (err) {
|
|
219
241
|
// 发生错误时删除可能存在的不完整文件
|
|
@@ -242,7 +264,7 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
|
|
|
242
264
|
'.txt': 'text/plain',
|
|
243
265
|
'.pdf': 'application/pdf',
|
|
244
266
|
'.mp4': 'video/mp4',
|
|
245
|
-
'.ico': 'image/x-icon'
|
|
267
|
+
'.ico': 'image/x-icon',
|
|
246
268
|
};
|
|
247
269
|
return mimeTypes[extname] || 'application/octet-stream';
|
|
248
270
|
}
|
|
@@ -260,6 +282,7 @@ __decorate([
|
|
|
260
282
|
__metadata("design:returntype", Promise)
|
|
261
283
|
], StaticController.prototype, "proxyStaticFile", null);
|
|
262
284
|
StaticController = __decorate([
|
|
263
|
-
(0, core_1.Controller)('/ns/static')
|
|
285
|
+
(0, core_1.Controller)('/ns/static'),
|
|
286
|
+
__metadata("design:paramtypes", [])
|
|
264
287
|
], StaticController);
|
|
265
288
|
exports.StaticController = StaticController;
|
|
@@ -3,7 +3,7 @@ import { Context } from '@midwayjs/koa';
|
|
|
3
3
|
import { CurdMixService } from '../service/curd/CurdMixService';
|
|
4
4
|
import { CommonResult } from '../libs/utils/common-dto';
|
|
5
5
|
export declare class HelpersApi {
|
|
6
|
-
ctx: Context;
|
|
6
|
+
protected ctx: Context;
|
|
7
7
|
private midwayWebRouterService;
|
|
8
8
|
protected curdMixService: CurdMixService;
|
|
9
9
|
getApiEnv(): Promise<{
|
|
@@ -31,15 +31,16 @@ let HomeController = class HomeController extends BaseApiController_1.BaseApiCon
|
|
|
31
31
|
}
|
|
32
32
|
const html_content = workbenchInfo.html_content || '未配置HTML模版';
|
|
33
33
|
const userInfo = this.getUserSessionInfo();
|
|
34
|
-
const fatcmscsrftoken = await crypto_utils_1.privateAES.time_encrypt_utf8_base64(
|
|
34
|
+
const fatcmscsrftoken = await crypto_utils_1.privateAES.time_encrypt_utf8_base64('' + Date.now());
|
|
35
35
|
const utils = (0, render_utils_1.createRenderUtils)({
|
|
36
36
|
ctx: this.ctx,
|
|
37
37
|
userInfo,
|
|
38
38
|
workbenchInfo,
|
|
39
39
|
package_assets: workbenchInfo.package_assets,
|
|
40
|
-
fatcmscsrftoken
|
|
40
|
+
fatcmscsrftoken,
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
const query = this.ctx.query || {};
|
|
43
|
+
return this.ctx.renderString(html_content, { workbenchInfo, userInfo, utils, query }, { viewEngine: 'ejs' });
|
|
43
44
|
}
|
|
44
45
|
async robots() {
|
|
45
46
|
return `User-agent: * \nDisallow: /ns/api/manage/`;
|
|
@@ -46,14 +46,14 @@ let AnyApiMangeApi = class AnyApiMangeApi extends BaseApiController_1.BaseApiCon
|
|
|
46
46
|
fixBodyData(this.ctx.request.body);
|
|
47
47
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_anyapi, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
48
48
|
validateCfg: {
|
|
49
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
49
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
async deleteAnyApi() {
|
|
54
54
|
return this.executeSysSimpleSQL(SystemTables_1.SystemTables.sys_anyapi, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
55
55
|
validateCfg: {
|
|
56
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
56
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
57
57
|
},
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -34,7 +34,7 @@ let AppLogMangeApi = class AppLogMangeApi extends BaseApiController_1.BaseApiCon
|
|
|
34
34
|
async updateAppLog() {
|
|
35
35
|
return this.executeSysSimpleSQL('sys_app_log', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
36
36
|
validateCfg: {
|
|
37
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
37
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
38
38
|
'condition.app_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
39
39
|
},
|
|
40
40
|
});
|
|
@@ -42,7 +42,7 @@ let AppLogMangeApi = class AppLogMangeApi extends BaseApiController_1.BaseApiCon
|
|
|
42
42
|
async deleteAppLog() {
|
|
43
43
|
return this.executeSysSimpleSQL('sys_app_log', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
45
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
46
46
|
'condition.app_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
47
47
|
},
|
|
48
48
|
});
|
|
@@ -34,7 +34,7 @@ let AppMangeApi = class AppMangeApi extends BaseApiController_1.BaseApiControlle
|
|
|
34
34
|
async updateApp() {
|
|
35
35
|
return this.executeSysSimpleSQL('sys_app', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
36
36
|
validateCfg: {
|
|
37
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
37
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
38
38
|
'condition.app_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
39
39
|
},
|
|
40
40
|
});
|
|
@@ -42,7 +42,7 @@ let AppMangeApi = class AppMangeApi extends BaseApiController_1.BaseApiControlle
|
|
|
42
42
|
async deleteApp() {
|
|
43
43
|
return this.executeSysSimpleSQL('sys_app', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
45
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
46
46
|
'condition.app_code': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
47
47
|
},
|
|
48
48
|
});
|
|
@@ -35,14 +35,14 @@ let AppPageMangeApi = class AppPageMangeApi extends BaseApiController_1.BaseApiC
|
|
|
35
35
|
async updateAppPage() {
|
|
36
36
|
return this.executeSysSimpleSQL('sys_app_page', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
37
37
|
validateCfg: {
|
|
38
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
38
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
async deleteAppPage() {
|
|
43
43
|
return this.executeSysSimpleSQL('sys_app_page', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
44
44
|
validateCfg: {
|
|
45
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
45
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -31,14 +31,14 @@ let AppSchemaHistoryApi = class AppSchemaHistoryApi extends BaseApiController_1.
|
|
|
31
31
|
async updateAppSchemaHistory() {
|
|
32
32
|
return this.executeSysSimpleSQL(tableName, keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
33
33
|
validateCfg: {
|
|
34
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
34
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
async deleteAppSchemaHistory() {
|
|
39
39
|
return this.executeSysSimpleSQL(tableName, keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
40
40
|
validateCfg: {
|
|
41
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
41
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -32,14 +32,14 @@ let CrudMethodsMangeApi = class CrudMethodsMangeApi extends BaseApiController_1.
|
|
|
32
32
|
async updateCrudMethod() {
|
|
33
33
|
return this.executeSysSimpleSQL('sys_crud_methods', keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
34
34
|
validateCfg: {
|
|
35
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
35
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
async deleteCrudMethod() {
|
|
40
40
|
return this.executeSysSimpleSQL('sys_crud_methods', keys_1.KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
41
41
|
validateCfg: {
|
|
42
|
-
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.
|
|
42
|
+
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMERIC],
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseApiController } from '../base/BaseApiController';
|
|
2
2
|
import { SqlDbType } from '../../libs/crud-pro/models/keys';
|
|
3
|
-
import { CommonResult } from
|
|
3
|
+
import { CommonResult } from '../../libs/utils/common-dto';
|
|
4
4
|
export declare class CrudStandardDesignApi extends BaseApiController {
|
|
5
5
|
private mysql2Config;
|
|
6
6
|
private postgres2Config;
|