midway-fatcms 0.0.1-beta.2 → 0.0.1-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +12 -0
- package/.prettierrc.js +4 -0
- package/README.md +7 -0
- package/dist/config/config.default.js +52 -15
- package/dist/configuration.d.ts +1 -0
- package/dist/configuration.js +33 -8
- package/dist/controller/base/BaseApiController.d.ts +1 -1
- package/dist/controller/base/BaseApiController.js +14 -6
- package/dist/controller/gateway/AsyncTaskController.d.ts +14 -0
- package/dist/controller/gateway/AsyncTaskController.js +108 -0
- package/dist/controller/gateway/CrudMtdGatewayController.d.ts +3 -3
- package/dist/controller/gateway/CrudMtdGatewayController.js +9 -6
- package/dist/controller/gateway/CrudStdGatewayController.d.ts +5 -5
- package/dist/controller/gateway/DocGatewayController.js +14 -9
- package/dist/controller/gateway/PublicApiController.js +4 -6
- package/dist/controller/gateway/StaticController.d.ts +2 -0
- package/dist/controller/gateway/StaticController.js +59 -40
- package/dist/controller/helpers.controller.d.ts +1 -1
- package/dist/controller/home.controller.js +2 -2
- package/dist/controller/manage/AnyApiMangeApi.js +2 -2
- package/dist/controller/manage/AppLogMangeApi.js +2 -2
- package/dist/controller/manage/AppMangeApi.js +2 -2
- package/dist/controller/manage/AppPageMangeApi.js +2 -2
- package/dist/controller/manage/AppSchemaHistoryApi.js +2 -2
- package/dist/controller/manage/CrudMethodsMangeApi.js +2 -2
- package/dist/controller/manage/CrudStandardDesignApi.d.ts +1 -1
- package/dist/controller/manage/CrudStandardDesignApi.js +78 -75
- package/dist/controller/manage/DataDictManageApi.d.ts +1 -1
- package/dist/controller/manage/DataDictManageApi.js +1 -1
- package/dist/controller/manage/DeployManageApi.d.ts +1 -1
- package/dist/controller/manage/DeployManageApi.js +38 -34
- package/dist/controller/manage/DocLibManageApi.js +2 -2
- package/dist/controller/manage/DocManageApi.js +2 -2
- package/dist/controller/manage/FileManageApi.js +1 -1
- package/dist/controller/manage/LowCodeTplManageApi.js +2 -2
- package/dist/controller/manage/MenuManageApi.js +2 -2
- package/dist/controller/manage/ProxyApiMangeApi.js +2 -2
- package/dist/controller/manage/SuperAdminManageApi.d.ts +2 -2
- package/dist/controller/manage/SuperAdminManageApi.js +12 -8
- package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -1
- package/dist/controller/manage/SysConfigMangeApi.js +8 -6
- package/dist/controller/manage/SystemInfoManageApi.d.ts +1 -1
- package/dist/controller/manage/SystemInfoManageApi.js +7 -1
- package/dist/controller/manage/UserAccountManageApi.d.ts +2 -2
- package/dist/controller/manage/UserAccountManageApi.js +7 -2
- package/dist/controller/manage/WorkbenchMangeApi.js +3 -3
- package/dist/controller/myinfo/AuthController.d.ts +0 -4
- package/dist/controller/myinfo/AuthController.js +1 -54
- package/dist/controller/render/AppRenderController.js +10 -4
- package/dist/controller/test.controller.d.ts +1 -1
- package/dist/controller/test.controller.js +5 -5
- package/dist/index.d.ts +34 -4
- package/dist/index.js +34 -4
- package/dist/libs/crud-pro/CrudPro.d.ts +1 -0
- package/dist/libs/crud-pro/CrudPro.js +5 -0
- package/dist/libs/crud-pro/defaultConfigs.js +2 -0
- package/dist/libs/crud-pro/interfaces.d.ts +7 -1
- package/dist/libs/crud-pro/models/ExecuteContext.d.ts +2 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +8 -1
- package/dist/libs/crud-pro/models/ExecuteContextFunc.js +8 -0
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/ResModel.d.ts +16 -0
- package/dist/libs/crud-pro/models/ResModel.js +2 -0
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/TransactionSqlServer.js +1 -1
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +27 -15
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +13 -17
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +1 -1
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +10 -12
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +14 -23
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +7 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +2 -6
- package/dist/libs/crud-pro/services/CrudProServiceBase.js +3 -2
- package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +1 -0
- package/dist/libs/crud-pro/services/CrudProTableMetaService.js +32 -7
- package/dist/libs/crud-pro/utils/DatabaseName.js +24 -3
- package/dist/libs/crud-pro/utils/MixinUtils.js +1 -1
- package/dist/libs/crud-pro/utils/ValidateUtils.js +1 -1
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.d.ts +3 -0
- package/dist/libs/crud-pro/utils/sqlConvert/convertMix.js +22 -0
- package/dist/libs/global-config/global-config.d.ts +45 -0
- package/dist/libs/global-config/global-config.js +33 -0
- package/dist/libs/utils/errorToString.d.ts +2 -0
- package/dist/libs/utils/errorToString.js +57 -0
- package/dist/libs/utils/fatcms-request.js +2 -2
- package/dist/middleware/forbidden.middleware.js +4 -20
- package/dist/middleware/global.middleware.js +8 -1
- package/dist/models/AsyncTaskModel.d.ts +69 -0
- package/dist/models/AsyncTaskModel.js +26 -0
- package/dist/models/RedisKeys.d.ts +8 -0
- package/dist/models/RedisKeys.js +11 -0
- package/dist/models/SystemTables.d.ts +1 -3
- package/dist/models/SystemTables.js +2 -4
- package/dist/schedule/anonymousContext.d.ts +13 -0
- package/dist/schedule/anonymousContext.js +59 -0
- package/dist/schedule/index.d.ts +4 -3
- package/dist/schedule/index.js +8 -67
- package/dist/schedule/runSchedule.d.ts +15 -0
- package/dist/schedule/runSchedule.js +68 -0
- package/dist/schedule/scheduleNames.d.ts +13 -0
- package/dist/schedule/scheduleNames.js +17 -0
- package/dist/service/AuthService.js +8 -5
- package/dist/service/EnumInfoService.js +7 -4
- package/dist/service/FileCenterService.js +13 -9
- package/dist/service/SysConfigService.js +4 -2
- package/dist/service/UserAccountService.js +10 -6
- package/dist/service/UserSessionService.js +2 -1
- package/dist/service/VisitStatService.d.ts +1 -1
- package/dist/service/VisitStatService.js +20 -27
- package/dist/service/WorkbenchService.js +4 -2
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +37 -0
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +232 -0
- package/dist/service/asyncTask/AsyncTaskService.d.ts +7 -0
- package/dist/service/asyncTask/AsyncTaskService.js +34 -0
- package/dist/service/crudstd/CrudStdService.d.ts +2 -1
- package/dist/service/crudstd/CrudStdService.js +48 -3
- package/dist/service/curd/CrudProQuick.d.ts +24 -0
- package/dist/service/curd/CrudProQuick.js +105 -0
- package/dist/service/curd/CurdMixByAccountService.js +12 -6
- package/dist/service/curd/CurdMixByDictService.js +4 -2
- package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +10 -1
- package/dist/service/curd/CurdMixByLinkToCustomService.js +72 -24
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/curd/CurdMixService.d.ts +1 -1
- package/dist/service/curd/CurdMixService.js +2 -2
- package/dist/service/curd/CurdMixUtils.d.ts +7 -0
- package/dist/service/curd/CurdMixUtils.js +65 -28
- package/dist/service/curd/CurdProService.d.ts +2 -10
- package/dist/service/curd/CurdProService.js +31 -146
- package/dist/service/curd/fixCfgModel.d.ts +3 -0
- package/dist/service/curd/fixCfgModel.js +107 -0
- package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
- package/dist/views/404_app.html +31 -0
- package/dist/views/404_workbench.html +34 -0
- package/dist/views/static/favicon.ico +0 -0
- package/package.json +9 -2
- package/src/config/config.default.ts +58 -27
- package/src/configuration.ts +42 -9
- package/src/controller/base/BaseApiController.ts +26 -19
- package/src/controller/gateway/AnyApiGatewayController.ts +1 -1
- package/src/controller/gateway/AsyncTaskController.ts +83 -0
- package/src/controller/gateway/CrudMtdGatewayController.ts +17 -13
- package/src/controller/gateway/CrudStdGatewayController.ts +4 -4
- package/src/controller/gateway/DocGatewayController.ts +25 -17
- package/src/controller/gateway/FileController.ts +8 -9
- package/src/controller/gateway/ProxyApiGatewayController.ts +4 -4
- package/src/controller/gateway/PublicApiController.ts +19 -22
- package/src/controller/gateway/StaticController.ts +234 -242
- package/src/controller/helpers.controller.ts +1 -1
- package/src/controller/home.controller.ts +8 -15
- package/src/controller/manage/AnyApiMangeApi.ts +11 -11
- package/src/controller/manage/AppLogMangeApi.ts +5 -5
- package/src/controller/manage/AppMangeApi.ts +7 -7
- package/src/controller/manage/AppPageMangeApi.ts +5 -5
- package/src/controller/manage/AppSchemaHistoryApi.ts +3 -3
- package/src/controller/manage/CrudMethodsMangeApi.ts +5 -5
- package/src/controller/manage/CrudStandardDesignApi.ts +106 -113
- package/src/controller/manage/DataDictManageApi.ts +5 -5
- package/src/controller/manage/DeployManageApi.ts +85 -89
- package/src/controller/manage/DocLibManageApi.ts +5 -5
- package/src/controller/manage/DocManageApi.ts +10 -10
- package/src/controller/manage/FileManageApi.ts +1 -1
- package/src/controller/manage/LowCodeTplManageApi.ts +2 -2
- package/src/controller/manage/MenuManageApi.ts +10 -15
- package/src/controller/manage/ProxyApiMangeApi.ts +2 -2
- package/src/controller/manage/SuperAdminManageApi.ts +14 -13
- package/src/controller/manage/SysConfigMangeApi.ts +11 -11
- package/src/controller/manage/SystemInfoManageApi.ts +11 -6
- package/src/controller/manage/UserAccountManageApi.ts +10 -4
- package/src/controller/manage/WorkbenchMangeApi.ts +8 -8
- package/src/controller/myinfo/AuthController.ts +6 -72
- package/src/controller/render/AppRenderController.ts +24 -21
- package/src/controller/test.controller.ts +18 -18
- package/src/index.ts +38 -4
- package/src/libs/crud-pro/CrudPro.ts +7 -0
- package/src/libs/crud-pro/defaultConfigs.ts +2 -0
- package/src/libs/crud-pro/interfaces.ts +10 -3
- package/src/libs/crud-pro/models/ExecuteContext.ts +3 -3
- package/src/libs/crud-pro/models/ExecuteContextFunc.ts +11 -1
- package/src/libs/crud-pro/models/RequestCfgModel.ts +1 -1
- package/src/libs/crud-pro/models/RequestModel.ts +1 -1
- package/src/libs/crud-pro/models/ResModel.ts +19 -0
- package/src/libs/crud-pro/models/SqlCfgModel.ts +2 -2
- package/src/libs/crud-pro/models/Transaction.ts +8 -9
- package/src/libs/crud-pro/models/TransactionPostgres.ts +1 -1
- package/src/libs/crud-pro/models/TransactionSqlServer.ts +8 -13
- package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +32 -23
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +38 -54
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +26 -45
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +23 -40
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +25 -29
- package/src/libs/crud-pro/services/CrudProServiceBase.ts +5 -9
- package/src/libs/crud-pro/services/CrudProTableMetaService.ts +36 -9
- package/src/libs/crud-pro/utils/DatabaseName.ts +35 -15
- package/src/libs/crud-pro/utils/DateTimeUtils.ts +2 -2
- package/src/libs/crud-pro/utils/MixinUtils.ts +1 -1
- package/src/libs/crud-pro/utils/ValidateUtils.ts +1 -3
- package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +1 -1
- package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +3 -3
- package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +3 -3
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +2 -2
- package/src/libs/crud-pro/utils/sqlConvert/convertMix.ts +26 -0
- package/src/libs/global-config/global-config.ts +78 -0
- package/src/libs/utils/crypto-utils.ts +2 -4
- package/src/libs/utils/errorToString.ts +61 -0
- package/src/libs/utils/fatcms-request.ts +9 -21
- package/src/libs/utils/ordernum-utils.ts +2 -6
- package/src/libs/utils/parseConfig.ts +7 -15
- package/src/middleware/forbidden.middleware.ts +6 -25
- package/src/middleware/global.middleware.ts +18 -16
- package/src/models/AsyncTaskModel.ts +79 -0
- package/src/models/RedisKeys.ts +13 -0
- package/src/models/SystemTables.ts +1 -4
- package/src/models/bizmodels.ts +1 -2
- package/src/schedule/anonymousContext.ts +79 -0
- package/src/schedule/index.ts +11 -72
- package/src/schedule/runSchedule.ts +83 -0
- package/src/schedule/scheduleNames.ts +21 -0
- package/src/service/AuthService.ts +13 -8
- package/src/service/EnumInfoService.ts +8 -3
- package/src/service/FileCenterService.ts +12 -6
- package/src/service/SysConfigService.ts +10 -6
- package/src/service/UserAccountService.ts +14 -4
- package/src/service/UserSessionService.ts +5 -4
- package/src/service/VisitStatService.ts +57 -70
- package/src/service/WorkbenchService.ts +7 -2
- package/src/service/anyapi/AnyApiService.ts +11 -8
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +255 -0
- package/src/service/asyncTask/AsyncTaskService.ts +21 -0
- package/src/service/base/BaseService.ts +2 -2
- package/src/service/crudstd/CrudStdService.ts +60 -5
- package/src/service/curd/CrudProQuick.ts +137 -0
- package/src/service/curd/CurdMixByAccountService.ts +14 -6
- package/src/service/curd/CurdMixByDictService.ts +8 -2
- package/src/service/curd/CurdMixByLinkToCustomService.ts +101 -50
- package/src/service/curd/CurdMixBySysConfigService.ts +7 -2
- package/src/service/curd/CurdMixByWorkbenchService.ts +6 -2
- package/src/service/curd/CurdMixService.ts +3 -3
- package/src/service/curd/CurdMixUtils.ts +82 -39
- package/src/service/curd/CurdProService.ts +45 -189
- package/src/service/curd/fixCfgModel.ts +139 -0
- package/src/service/proxyapi/ProxyApiLoadService.ts +12 -3
- package/src/views/404_app.html +31 -0
- package/src/views/404_workbench.html +34 -0
- package/src/views/static/favicon.ico +0 -0
- package/tsconfig.json +32 -0
- package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
- package/dist/controller/medstatistic/MedAdminController.js +0 -205
- package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
- package/dist/controller/medstatistic/MedClientController.js +0 -188
- package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
- package/dist/controller/medstatistic/MedMessageService.js +0 -95
- package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
- package/dist/controller/medstatistic/MedScoreService.js +0 -107
- package/dist/controller/medstatistic/constants.d.ts +0 -32
- package/dist/controller/medstatistic/constants.js +0 -43
- package/src/controller/medstatistic/MedAdminController.ts +0 -221
- package/src/controller/medstatistic/MedClientController.ts +0 -188
- package/src/controller/medstatistic/MedMessageService.ts +0 -89
- package/src/controller/medstatistic/MedScoreService.ts +0 -108
- package/src/controller/medstatistic/constants.ts +0 -63
|
@@ -3,10 +3,11 @@ import {Context} from '@midwayjs/koa';
|
|
|
3
3
|
import {KeysOfSimpleSQL} from '../libs/crud-pro/models/keys';
|
|
4
4
|
import {CurdProService} from './curd/CurdProService';
|
|
5
5
|
import {RelatedType} from './curd/CurdMixUtils';
|
|
6
|
-
import {
|
|
6
|
+
import {SystemTables} from '../models/SystemTables';
|
|
7
7
|
import {parseConfigContentToEnumInfo, IEnumInfo} from '../libs/utils/parseConfig';
|
|
8
8
|
import {RedisCacheService} from "./base/RedisCacheService";
|
|
9
9
|
import {CurdMixByLinkToCustomService} from "./curd/CurdMixByLinkToCustomService";
|
|
10
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
interface IQueryEnumInfo {
|
|
@@ -88,6 +89,8 @@ export class EnumInfoService {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
private async queryEnumInfoBySysCfgEnum(code: string): Promise<IEnumInfo[]> {
|
|
92
|
+
const {SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
93
|
+
|
|
91
94
|
const res1 = await this.curdProService.executeCrudByCfg(
|
|
92
95
|
{
|
|
93
96
|
condition: { config_code: code },
|
|
@@ -96,7 +99,7 @@ export class EnumInfoService {
|
|
|
96
99
|
sqlTable: SystemTables.sys_configs,
|
|
97
100
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
98
101
|
sqlDatabase: SystemDbName,
|
|
99
|
-
|
|
102
|
+
sqlDbType: SystemDbType,
|
|
100
103
|
}
|
|
101
104
|
);
|
|
102
105
|
const obj = res1.getOneObj();
|
|
@@ -109,6 +112,8 @@ export class EnumInfoService {
|
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
private async queryEnumInfoItemByDict(code: string): Promise<IEnumInfo[]> {
|
|
115
|
+
const {SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
116
|
+
|
|
112
117
|
const res1 = await this.curdProService.executeCrudByCfg(
|
|
113
118
|
{
|
|
114
119
|
condition: { dict_code: code },
|
|
@@ -117,7 +122,7 @@ export class EnumInfoService {
|
|
|
117
122
|
sqlTable: SystemTables.sys_data_dict_item,
|
|
118
123
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
119
124
|
sqlDatabase: SystemDbName,
|
|
120
|
-
|
|
125
|
+
sqlDbType: SystemDbType,
|
|
121
126
|
}
|
|
122
127
|
);
|
|
123
128
|
const obj = res1.getResRows();
|
|
@@ -10,7 +10,7 @@ import { KeysOfSimpleSQL, KeysOfValidators } from '../libs/crud-pro/models/keys'
|
|
|
10
10
|
import { AccessType, IEntityCommonInfo, UploadCategoryType } from '../models/bizmodels';
|
|
11
11
|
import { IRequestCfgModel } from '../libs/crud-pro/interfaces';
|
|
12
12
|
import { BaseService } from './base/BaseService';
|
|
13
|
-
import {
|
|
13
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
14
|
|
|
15
15
|
function getSuffix(s: string): string {
|
|
16
16
|
if (s) {
|
|
@@ -107,12 +107,14 @@ class FileDB {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
async getFileInfo(fileKey: string): Promise<IFileInfo> {
|
|
110
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
111
|
+
|
|
110
112
|
const condition: any = { file_key: fileKey };
|
|
111
113
|
const cfgModel: IRequestCfgModel = {
|
|
112
114
|
sqlTable: 'sys_file',
|
|
113
115
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
114
116
|
sqlDatabase: SystemDbName,
|
|
115
|
-
|
|
117
|
+
sqlDbType: SystemDbType,
|
|
116
118
|
validateCfg: {
|
|
117
119
|
'condition.file_key': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
|
|
118
120
|
},
|
|
@@ -123,11 +125,13 @@ class FileDB {
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
async saveFileInfo(fileInfo: IFileInfo) {
|
|
128
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
129
|
+
|
|
126
130
|
const cfgModel = {
|
|
127
131
|
sqlTable: 'sys_file',
|
|
128
132
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
129
133
|
sqlDatabase: SystemDbName,
|
|
130
|
-
|
|
134
|
+
sqlDbType: SystemDbType,
|
|
131
135
|
};
|
|
132
136
|
return await this.curdMixService.executeCrudByCfg(
|
|
133
137
|
{
|
|
@@ -141,21 +145,23 @@ class FileDB {
|
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
async saveAssetsLog(fileInfo: IFileInfo) {
|
|
148
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
144
149
|
const cfgModel = {
|
|
145
150
|
sqlTable: 'sys_assets_log',
|
|
146
151
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
147
152
|
sqlDatabase: SystemDbName,
|
|
148
|
-
|
|
153
|
+
sqlDbType: SystemDbType,
|
|
149
154
|
};
|
|
150
155
|
return await this.curdMixService.executeCrudByCfg({ data: fileInfo }, cfgModel);
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
async deleteFileInfo(id: number) {
|
|
159
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
154
160
|
const cfgModel: IRequestCfgModel = {
|
|
155
161
|
sqlTable: 'sys_file',
|
|
156
162
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_DELETE,
|
|
157
163
|
sqlDatabase: SystemDbName,
|
|
158
|
-
|
|
164
|
+
sqlDbType: SystemDbType,
|
|
159
165
|
validateCfg: {
|
|
160
166
|
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMBER],
|
|
161
167
|
},
|
|
@@ -200,7 +206,7 @@ function toUploadOriginByReferer(referer: string): string {
|
|
|
200
206
|
return 'doc-editor';
|
|
201
207
|
}
|
|
202
208
|
if (pathname.startsWith('/pages/devops/file-manage')) {
|
|
203
|
-
return
|
|
209
|
+
return 'file-manage';
|
|
204
210
|
}
|
|
205
211
|
} catch (error) {
|
|
206
212
|
console.error('toUploadOriginByReferer', error);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL} from "../libs/crud-pro/models/keys";
|
|
4
|
-
import {
|
|
5
|
-
import {BaseService} from "./base/BaseService";
|
|
6
|
-
import {CurdProService} from "./curd/CurdProService";
|
|
3
|
+
import { KeysOfSimpleSQL } from "../libs/crud-pro/models/keys";
|
|
4
|
+
import { SystemTables } from "../models/SystemTables";
|
|
5
|
+
import { BaseService } from "./base/BaseService";
|
|
6
|
+
import { CurdProService } from "./curd/CurdProService";
|
|
7
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
7
8
|
|
|
8
9
|
@Provide()
|
|
9
10
|
export class SysConfigService extends BaseService {
|
|
@@ -14,9 +15,12 @@ export class SysConfigService extends BaseService {
|
|
|
14
15
|
private curdProService: CurdProService;
|
|
15
16
|
|
|
16
17
|
async getSysConfigOne(config_code: string): Promise<any> {
|
|
17
|
-
if (!config_code){
|
|
18
|
+
if (!config_code) {
|
|
18
19
|
throw new Error('[getSysConfigOne] config_code required');
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
23
|
+
|
|
20
24
|
const res1 = await this.curdProService.executeCrudByCfg(
|
|
21
25
|
{
|
|
22
26
|
condition: { config_code },
|
|
@@ -25,7 +29,7 @@ export class SysConfigService extends BaseService {
|
|
|
25
29
|
sqlTable: SystemTables.sys_configs,
|
|
26
30
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
27
31
|
sqlDatabase: SystemDbName,
|
|
28
|
-
|
|
32
|
+
sqlDbType: SystemDbType,
|
|
29
33
|
}
|
|
30
34
|
);
|
|
31
35
|
return res1.getOneObj();
|
|
@@ -6,8 +6,9 @@ import { CurdMixService } from './curd/CurdMixService';
|
|
|
6
6
|
import { createUniqueId } from '../libs/utils/functions';
|
|
7
7
|
import { CommonException, Exceptions } from '../libs/crud-pro/exceptions';
|
|
8
8
|
import { IRequestCfgModel, IRequestModel } from '../libs/crud-pro/interfaces';
|
|
9
|
-
import {
|
|
9
|
+
import {SystemTables} from '../models/SystemTables';
|
|
10
10
|
import { CommonResult } from '../libs/utils/common-dto';
|
|
11
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
11
12
|
|
|
12
13
|
@Provide()
|
|
13
14
|
export class UserAccountService {
|
|
@@ -21,6 +22,9 @@ export class UserAccountService {
|
|
|
21
22
|
* @param loginName
|
|
22
23
|
*/
|
|
23
24
|
public async queryUserAccountByLoginName(loginName: string) {
|
|
25
|
+
|
|
26
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
27
|
+
|
|
24
28
|
const query = await this.curdMixService.executeCrudByCfg(
|
|
25
29
|
{
|
|
26
30
|
condition: { login_name: loginName },
|
|
@@ -30,7 +34,7 @@ export class UserAccountService {
|
|
|
30
34
|
sqlTable: SystemTables.sys_user_account,
|
|
31
35
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
32
36
|
sqlDatabase: SystemDbName,
|
|
33
|
-
|
|
37
|
+
sqlDbType: SystemDbType,
|
|
34
38
|
}
|
|
35
39
|
);
|
|
36
40
|
const { row } = query.getResModel();
|
|
@@ -47,6 +51,9 @@ export class UserAccountService {
|
|
|
47
51
|
return [];
|
|
48
52
|
}
|
|
49
53
|
|
|
54
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
55
|
+
|
|
56
|
+
|
|
50
57
|
const accountIds = accountIdList.map(userId => {
|
|
51
58
|
return `${userId}`;
|
|
52
59
|
});
|
|
@@ -56,7 +63,7 @@ export class UserAccountService {
|
|
|
56
63
|
sqlTable: SystemTables.sys_user_account,
|
|
57
64
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
58
65
|
sqlDatabase: SystemDbName,
|
|
59
|
-
|
|
66
|
+
sqlDbType: SystemDbType,
|
|
60
67
|
};
|
|
61
68
|
|
|
62
69
|
const reqJson: IRequestModel = {
|
|
@@ -81,6 +88,9 @@ export class UserAccountService {
|
|
|
81
88
|
if (!loginName) {
|
|
82
89
|
throw new CommonException(Exceptions.OTHER_EXCEPTION, 'loginName不存在');
|
|
83
90
|
}
|
|
91
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
92
|
+
|
|
93
|
+
|
|
84
94
|
const pwd_salt = createUniqueId();
|
|
85
95
|
const pwd_md5 = md5(unsaltedPwd + pwd_salt);
|
|
86
96
|
const res1 = await this.curdMixService.executeCrudByCfg(
|
|
@@ -92,7 +102,7 @@ export class UserAccountService {
|
|
|
92
102
|
sqlTable: SystemTables.sys_user_account,
|
|
93
103
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE,
|
|
94
104
|
sqlDatabase: SystemDbName,
|
|
95
|
-
|
|
105
|
+
sqlDbType: SystemDbType,
|
|
96
106
|
}
|
|
97
107
|
);
|
|
98
108
|
return CommonResult.successRes(res1.getResModel());
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {Inject, Provide} from '@midwayjs/core';
|
|
2
2
|
import {Context} from '@midwayjs/koa';
|
|
3
|
-
import {parseJsonObject} from '
|
|
4
|
-
import {ISessionInfo, SESSION_ID_KEY, sessionCookieCfg} from '
|
|
3
|
+
import {parseJsonObject} from '@/libs/utils/functions';
|
|
4
|
+
import {ISessionInfo, SESSION_ID_KEY, sessionCookieCfg} from '@/models/userSession';
|
|
5
5
|
import {RedisCacheService} from "./base/RedisCacheService";
|
|
6
|
+
import {RedisKeys} from "@/models/RedisKeys";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
function pickUserAvatar(avatar: any): string {
|
|
@@ -35,8 +36,8 @@ function pickUserAvatar(avatar: any): string {
|
|
|
35
36
|
|
|
36
37
|
const SESSION_KEEP_TIME_SECOND: number = 3600 * 24 * 30;
|
|
37
38
|
|
|
38
|
-
const toCacheKey = (sessionId: string)=>{
|
|
39
|
-
return
|
|
39
|
+
const toCacheKey = (sessionId: string): string =>{
|
|
40
|
+
return `${RedisKeys.USER_SESSION_PREFIX}${sessionId}`;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
@Provide()
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {Inject, Provide} from '@midwayjs/core';
|
|
2
|
-
import {Context} from '@midwayjs/koa';
|
|
3
|
-
import {IScheduleService} from '
|
|
4
|
-
import {BaseService} from
|
|
5
|
-
import {CurdProService} from
|
|
6
|
-
import {
|
|
7
|
-
import {KeysOfSimpleSQL} from
|
|
8
|
-
import {FILE_GET_TYPES} from
|
|
9
|
-
import {CommonResult} from
|
|
10
|
-
|
|
1
|
+
import { Inject, Provide } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import { IScheduleService } from '@/interface';
|
|
4
|
+
import { BaseService } from './base/BaseService';
|
|
5
|
+
import { CurdProService } from './curd/CurdProService';
|
|
6
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
7
|
+
import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
|
|
8
|
+
import { FILE_GET_TYPES } from '@/models/bizmodels';
|
|
9
|
+
import { CommonResult } from '@/libs/utils/common-dto';
|
|
10
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
11
|
+
import { RedisKeys } from '@/models/RedisKeys';
|
|
11
12
|
|
|
12
13
|
// 3天 的秒数
|
|
13
14
|
const EXPIRE_TIME = 3 * 24 * 60 * 60;
|
|
@@ -18,7 +19,6 @@ const STAT_TYPES = {
|
|
|
18
19
|
uv_uid: 'uv_uid',
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
|
|
22
22
|
@Provide()
|
|
23
23
|
export class VisitStatService extends BaseService implements IScheduleService {
|
|
24
24
|
@Inject()
|
|
@@ -29,32 +29,32 @@ export class VisitStatService extends BaseService implements IScheduleService {
|
|
|
29
29
|
|
|
30
30
|
async runBySchedule(): Promise<any> {
|
|
31
31
|
const hours = new Date().getHours();
|
|
32
|
-
this.logInfo(
|
|
32
|
+
this.logInfo('[VisitStatService] runBySchedule called, hours = ' + hours);
|
|
33
33
|
return this.flushVisitStatToDB();
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
async flushVisitStatToDB(): Promise<any> {
|
|
37
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
36
38
|
|
|
37
|
-
async flushVisitStatToDB(): Promise<any> {
|
|
38
39
|
// 统计昨天的数据。
|
|
39
40
|
const stat_date = new Date(Date.now() - 24 * 3600 * 1000).toISOString().split('T')[0];
|
|
40
41
|
|
|
41
|
-
const lockKey =
|
|
42
|
+
const lockKey = `${RedisKeys.VISIT_STAT_LOCK_PREFIX}${stat_date}`;
|
|
42
43
|
// 每天只能执行一次
|
|
43
44
|
const client = this.redisService;
|
|
44
|
-
const nxRes = await client.set(lockKey, 1, 'EX', EXPIRE_TIME, 'NX')
|
|
45
|
+
const nxRes = await client.set(lockKey, 1, 'EX', EXPIRE_TIME, 'NX');
|
|
45
46
|
if (nxRes !== 'OK') {
|
|
46
|
-
this.logInfo(
|
|
47
|
-
return CommonResult.errorRes(
|
|
47
|
+
this.logInfo('[VisitStatService] flushVisitStatToDB 每天只能执行一次 ');
|
|
48
|
+
return CommonResult.errorRes('每天只能执行一次');
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
this.logInfo(
|
|
51
|
+
this.logInfo('[VisitStatService] flushVisitStatToDB start ');
|
|
51
52
|
|
|
52
|
-
let totalCount = 0
|
|
53
|
+
let totalCount = 0;
|
|
53
54
|
let successCount = 0;
|
|
54
55
|
|
|
55
56
|
try {
|
|
56
|
-
|
|
57
|
-
const keys = await client.keys(`vs_${stat_date}::*`);
|
|
57
|
+
const keys = await client.keys(`${RedisKeys.VISIT_STAT_DATE_PREFIX}${stat_date}::*`);
|
|
58
58
|
// `vs_${date}::${req_host}::${resource_type}::${stat_type}::${resource}`;
|
|
59
59
|
totalCount = keys.length;
|
|
60
60
|
|
|
@@ -68,112 +68,99 @@ export class VisitStatService extends BaseService implements IScheduleService {
|
|
|
68
68
|
const stat_resource = parts[4];
|
|
69
69
|
|
|
70
70
|
let stat_count: number;
|
|
71
|
-
if (stat_type === STAT_TYPES.uv_ip || stat_type
|
|
71
|
+
if (stat_type === STAT_TYPES.uv_ip || stat_type === STAT_TYPES.uv_uid) {
|
|
72
72
|
stat_count = await client.scard(key);
|
|
73
73
|
} else {
|
|
74
74
|
stat_count = parseInt(await client.get(key)) || 0;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
await this.curdProService.executeCrudByCfg(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
await this.curdProService.executeCrudByCfg(
|
|
78
|
+
{
|
|
79
|
+
data: {
|
|
80
|
+
stat_date,
|
|
81
|
+
stat_resource,
|
|
82
|
+
stat_type,
|
|
83
|
+
resource_type,
|
|
84
|
+
stat_count,
|
|
85
|
+
req_host,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
90
|
+
sqlDatabase: SystemDbName,
|
|
91
|
+
sqlDbType: SystemDbType,
|
|
92
|
+
sqlTable: SystemTables.sys_visit_stats,
|
|
85
93
|
}
|
|
86
|
-
|
|
87
|
-
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
88
|
-
sqlDatabase: SystemDbName,
|
|
89
|
-
sqlDdType: SystemDbType,
|
|
90
|
-
sqlTable: SystemTables.sys_visit_stats,
|
|
91
|
-
})
|
|
94
|
+
);
|
|
92
95
|
|
|
93
96
|
await client.del(key);
|
|
94
97
|
successCount++;
|
|
95
98
|
}
|
|
96
|
-
} catch (e){
|
|
99
|
+
} catch (e) {
|
|
97
100
|
this.logError('[VisitStatService] flushVisitStatToDB: key = ' + key, e);
|
|
98
101
|
console.log('[VisitStatService] flushVisitStatToDB: key = ' + key, e);
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
} catch (error) {
|
|
102
|
-
this.logError('[VisitStatService] flushVisitStatToDB'
|
|
103
|
-
console.log('[VisitStatService] flushVisitStatToDB'
|
|
105
|
+
this.logError('[VisitStatService] flushVisitStatToDB', error);
|
|
106
|
+
console.log('[VisitStatService] flushVisitStatToDB', error);
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
this.logInfo(
|
|
109
|
+
this.logInfo('[VisitStatService] flushVisitStatToDB end ');
|
|
107
110
|
|
|
108
|
-
return CommonResult.successRes({successCount, totalCount})
|
|
111
|
+
return CommonResult.successRes({ successCount, totalCount });
|
|
109
112
|
}
|
|
110
113
|
|
|
111
|
-
|
|
112
114
|
/**
|
|
113
115
|
* 统计请求数据
|
|
114
116
|
*/
|
|
115
117
|
async trackRequest(resource: string, resourceType: string) {
|
|
116
|
-
|
|
117
118
|
// 文件下载定制
|
|
118
119
|
if (resource.startsWith('/ns/gw/file/get/')) {
|
|
119
120
|
for (let i = 0; i < FILE_GET_TYPES.length; i++) {
|
|
120
121
|
const fileGetType = FILE_GET_TYPES[i];
|
|
121
|
-
const pathPrefix = `/ns/gw/file/get/${fileGetType}
|
|
122
|
+
const pathPrefix = `/ns/gw/file/get/${fileGetType}/`;
|
|
122
123
|
if (resource.startsWith(pathPrefix)) {
|
|
123
124
|
const res2 = resource.substring(pathPrefix.length);
|
|
124
|
-
return this.trackRequestImpl(res2, fileGetType)
|
|
125
|
+
return this.trackRequestImpl(res2, fileGetType);
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
// 文档访问定制
|
|
130
131
|
if (resource.startsWith('/ns/app/doc-editor/libview')) {
|
|
131
|
-
const {docLibId,docId} = this.ctx.query || {};
|
|
132
|
-
return this.trackRequestImpl(`${docLibId},${docId}`, 'docLibView')
|
|
132
|
+
const { docLibId, docId } = this.ctx.query || {};
|
|
133
|
+
return this.trackRequestImpl(`${docLibId},${docId}`, 'docLibView');
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
return this.trackRequestImpl(resource, resourceType)
|
|
136
|
+
return this.trackRequestImpl(resource, resourceType);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
140
139
|
private async trackRequestImpl(resource: string, resource_type: string) {
|
|
141
140
|
const client = this.redisService;
|
|
142
141
|
const ip = this.ctx.headers['x-real-ip'];
|
|
143
|
-
const userSession = this.ctx.userSession
|
|
144
|
-
const req_host = this.ctx?.request?.host ||
|
|
142
|
+
const userSession = this.ctx.userSession;
|
|
143
|
+
const req_host = this.ctx?.request?.host || 'null'; // 域名
|
|
145
144
|
const date = new Date().toISOString().split('T')[0];
|
|
146
145
|
|
|
147
146
|
const toDateResourceKey = (stat_type: string): string => {
|
|
148
|
-
return
|
|
149
|
-
}
|
|
147
|
+
return `${RedisKeys.VISIT_STAT_DATE_PREFIX}${date}::${req_host}::${resource_type}::${stat_type}::${resource}`;
|
|
148
|
+
};
|
|
150
149
|
|
|
151
150
|
const pv_key = toDateResourceKey(STAT_TYPES.pv);
|
|
152
151
|
const uv_ip_key = toDateResourceKey(STAT_TYPES.uv_ip);
|
|
153
152
|
const uv_uid_key = toDateResourceKey(STAT_TYPES.uv_uid);
|
|
154
153
|
|
|
155
|
-
|
|
156
154
|
// 统计 PV
|
|
157
|
-
await Promise.all([
|
|
158
|
-
client.incr(pv_key),
|
|
159
|
-
client.expire(pv_key, EXPIRE_TIME)
|
|
160
|
-
]);
|
|
155
|
+
await Promise.all([client.incr(pv_key), client.expire(pv_key, EXPIRE_TIME)]);
|
|
161
156
|
|
|
162
157
|
// IP 访问 UV
|
|
163
|
-
await Promise.all([
|
|
164
|
-
client.sadd(uv_ip_key, `${ip}`),
|
|
165
|
-
client.expire(uv_ip_key, EXPIRE_TIME)
|
|
166
|
-
]);
|
|
158
|
+
await Promise.all([client.sadd(uv_ip_key, `${ip}`), client.expire(uv_ip_key, EXPIRE_TIME)]);
|
|
167
159
|
|
|
168
160
|
if (userSession && userSession.isLogin()) {
|
|
169
161
|
const accountId = userSession.getSessionInfo().accountId;
|
|
170
162
|
// 统计 UV
|
|
171
|
-
await Promise.all([
|
|
172
|
-
client.sadd(uv_uid_key, accountId),
|
|
173
|
-
client.expire(uv_uid_key, EXPIRE_TIME)
|
|
174
|
-
]);
|
|
163
|
+
await Promise.all([client.sadd(uv_uid_key, accountId), client.expire(uv_uid_key, EXPIRE_TIME)]);
|
|
175
164
|
}
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
|
|
165
|
+
}
|
|
179
166
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
3
|
import { KeysOfSimpleSQL } from '../libs/crud-pro/models/keys';
|
|
4
|
-
import {
|
|
4
|
+
import { SystemTables} from '../models/SystemTables';
|
|
5
5
|
import { BaseService } from './base/BaseService';
|
|
6
6
|
// import { LRUCache } from 'lru-cache';
|
|
7
7
|
import { CurdProService } from './curd/CurdProService';
|
|
@@ -11,6 +11,7 @@ import { IWorkbenchEntity } from '../models/SystemEntities';
|
|
|
11
11
|
import { IScheduleService } from '../interface';
|
|
12
12
|
import { getDebugWorkbenchCode } from '../libs/utils/fatcms-request';
|
|
13
13
|
import { MixinUtils } from '../libs/crud-pro/utils/MixinUtils';
|
|
14
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
15
|
//
|
|
15
16
|
// const lruCache = new LRUCache<string, any>({
|
|
16
17
|
// max: 500,
|
|
@@ -42,6 +43,10 @@ export class WorkbenchService extends BaseService implements IScheduleService {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
public async getAllWorkbenchInfoList(isForceRefresh?: boolean): Promise<IWorkbenchEntity[]> {
|
|
46
|
+
|
|
47
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
48
|
+
|
|
49
|
+
|
|
45
50
|
let listData = lruCache.get(CACHE_KEY_WORKBENCH_LIST);
|
|
46
51
|
if (!listData || isForceRefresh === true) {
|
|
47
52
|
const reqJson = { condition: {}, pageSize: 1000, limit: 1000 };
|
|
@@ -49,7 +54,7 @@ export class WorkbenchService extends BaseService implements IScheduleService {
|
|
|
49
54
|
sqlTable: SystemTables.sys_workbench,
|
|
50
55
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
51
56
|
sqlDatabase: SystemDbName,
|
|
52
|
-
|
|
57
|
+
sqlDbType: SystemDbType,
|
|
53
58
|
});
|
|
54
59
|
listData = res.getResRows();
|
|
55
60
|
lruCache.set(CACHE_KEY_WORKBENCH_LIST, listData);
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL } from '
|
|
4
|
-
import {
|
|
3
|
+
import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
|
|
4
|
+
import { SystemTables} from '@/models/SystemTables';
|
|
5
5
|
import { LRUCache } from 'lru-cache';
|
|
6
|
-
import { BizException } from '
|
|
6
|
+
import { BizException } from '@/models/devops';
|
|
7
7
|
import { CurdMixService } from '../curd/CurdMixService';
|
|
8
|
-
import { ISysAnyApiEntity } from '
|
|
8
|
+
import { ISysAnyApiEntity } from '@/models/SystemEntities';
|
|
9
9
|
import { AnyApiSandboxService, IRunInSandboxParams } from './AnyApiSandboxService';
|
|
10
|
-
import { parseJsonObject } from '
|
|
10
|
+
import { parseJsonObject } from '@/libs/utils/functions';
|
|
11
11
|
import * as _ from 'lodash';
|
|
12
|
-
import { MixinUtils } from '
|
|
12
|
+
import { MixinUtils } from '@/libs/crud-pro/utils/MixinUtils';
|
|
13
13
|
import { WorkbenchService } from '../WorkbenchService';
|
|
14
|
-
import { validateByCfgString } from '
|
|
14
|
+
import { validateByCfgString } from '@/libs/crud-pro/utils/ValidateUtils';
|
|
15
15
|
import { API_BASE_TYPE, ApiBaseService } from '../base/ApiBaseService';
|
|
16
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
16
17
|
|
|
17
18
|
const lruCache = new LRUCache<string, any>({
|
|
18
19
|
max: 500,
|
|
@@ -80,6 +81,8 @@ export class AnyApiService extends ApiBaseService {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
private async _getAnyApiMethod(methodCode: string): Promise<ISysAnyApiEntity> {
|
|
84
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
85
|
+
|
|
83
86
|
const res = await this.curdMixService.executeCrudByCfg(
|
|
84
87
|
{ condition: { method: methodCode } },
|
|
85
88
|
{
|
|
@@ -87,7 +90,7 @@ export class AnyApiService extends ApiBaseService {
|
|
|
87
90
|
method: `get_sys_anyapi_${methodCode}`,
|
|
88
91
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
89
92
|
sqlDatabase: SystemDbName,
|
|
90
|
-
|
|
93
|
+
sqlDbType: SystemDbType,
|
|
91
94
|
updateCfg: {},
|
|
92
95
|
}
|
|
93
96
|
);
|