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
|
@@ -5,299 +5,291 @@ import * as fs from 'fs/promises';
|
|
|
5
5
|
import * as fs2 from 'fs';
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
import * as https from 'https';
|
|
8
|
-
import { parseJsonObject } from '
|
|
9
|
-
|
|
8
|
+
import { parseJsonObject } from '@/libs/utils/functions';
|
|
10
9
|
|
|
11
10
|
interface HttpGetRes {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
statusCode: number;
|
|
12
|
+
headers: any;
|
|
13
|
+
body: NodeJS.ReadableStream;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
const localDir = path.join(__dirname, '../../../public/static'); // 本地文件存储目录
|
|
19
|
-
const notFoundListFile = path.join(localDir, '__404__list.json') // 404列表文件
|
|
20
|
-
|
|
21
|
-
|
|
22
16
|
function getPathConfig(ossName: string) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
const remoteBaseUrlMap = {
|
|
18
|
+
cdnjsx: 'https://cdnjsx.oss-cn-shanghai.aliyuncs.com',
|
|
19
|
+
'i.alicdn.com': 'https://i.alicdn.com',
|
|
20
|
+
'img.alicdn.com': 'https://img.alicdn.com',
|
|
21
|
+
'at.alicdn.com': 'https://at.alicdn.com',
|
|
22
|
+
};
|
|
23
|
+
let remoteBaseUrl = remoteBaseUrlMap[ossName];
|
|
24
|
+
if (!remoteBaseUrl) {
|
|
25
|
+
console.error(`getPathConfig ossName: ${ossName} 未配置`);
|
|
26
|
+
remoteBaseUrl = `https://${ossName}`;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
remoteBaseUrl,
|
|
30
|
+
};
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
|
|
38
33
|
// 404列表缓存
|
|
39
34
|
let notFoundList = new Set();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// 初始化:加载404列表
|
|
43
|
-
async function init() {
|
|
44
|
-
try {
|
|
45
|
-
// 确保本地存储目录存在
|
|
46
|
-
await fs.mkdir(localDir, { recursive: true });
|
|
47
|
-
const data = await fs.readFile(notFoundListFile, 'utf8');
|
|
48
|
-
|
|
49
|
-
notFoundList = new Set(JSON.parse(data));
|
|
50
|
-
console.log(`已加载${notFoundList.size}个404记录`);
|
|
51
|
-
} catch (error) {
|
|
52
|
-
if (error.code !== 'ENOENT') {
|
|
53
|
-
console.error('读取404列表失败:', error);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
init();
|
|
35
|
+
let notFoundListIsInit = false;
|
|
60
36
|
|
|
61
37
|
/**
|
|
62
38
|
* 静态文件代理功能
|
|
63
39
|
*/
|
|
64
40
|
@Controller('/ns/static')
|
|
65
41
|
export class StaticController extends BaseApiController {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
private async responseLocalFile(localFilePath: string, localHeaderPath: string, relativePath: string): Promise<boolean> {
|
|
70
|
-
|
|
71
|
-
const headers = {
|
|
72
|
-
"Cache-Control": 'public, max-age=31536000',
|
|
73
|
-
"Expires": new Date(Date.now() + 31536000000).toUTCString()
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
// 检查本地文件是否存在.头文件
|
|
80
|
-
const stats = await fs.stat(localHeaderPath);
|
|
81
|
-
if (stats.isFile()) {
|
|
82
|
-
const headerDataStr = await fs.readFile(localHeaderPath, 'utf8');
|
|
83
|
-
const headerData = parseJsonObject(headerDataStr)
|
|
84
|
-
if (headerData) {
|
|
85
|
-
headers["content-type"] = headerData["content-type"];
|
|
86
|
-
headers["content-length"] = headerData["content-length"];
|
|
87
|
-
headers["last-modified"] = headerData["last-modified"];
|
|
88
|
-
headers["etag"] = headerData["etag"];
|
|
89
|
-
headers["cache-control"] = headerData["cache-control"];
|
|
90
|
-
headers["accept-ranges"] = headerData["accept-ranges"];
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
} catch (error) {
|
|
94
|
-
}
|
|
42
|
+
@Inject()
|
|
43
|
+
protected ctx: Context;
|
|
95
44
|
|
|
96
45
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
46
|
+
private getLocalPaths(): any {
|
|
47
|
+
const appDir = this.app.getAppDir();
|
|
48
|
+
const localDir = path.join(appDir, './public/static'); // 本地文件存储目录
|
|
49
|
+
const notFoundListFile = path.join(localDir, '__404__list.json'); // 404列表文件
|
|
50
|
+
return {
|
|
51
|
+
localDir,
|
|
52
|
+
notFoundListFile,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
104
55
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// }
|
|
56
|
+
private async initNotFoundList() {
|
|
57
|
+
if (notFoundListIsInit) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
notFoundListIsInit = true;
|
|
111
61
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
62
|
+
const { localDir, notFoundListFile } = this.getLocalPaths();
|
|
63
|
+
try {
|
|
64
|
+
// 确保本地存储目录存在
|
|
65
|
+
await fs.mkdir(localDir, { recursive: true });
|
|
66
|
+
const data = await fs.readFile(notFoundListFile, 'utf8');
|
|
115
67
|
|
|
68
|
+
notFoundList = new Set(JSON.parse(data));
|
|
69
|
+
console.log(`已加载${notFoundList.size}个404记录`);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error.code !== 'ENOENT') {
|
|
72
|
+
console.error('读取404列表失败:', error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
116
76
|
|
|
77
|
+
private async responseLocalFile(localFilePath: string, localHeaderPath: string, relativePath: string): Promise<boolean> {
|
|
78
|
+
const headers = {
|
|
79
|
+
'Cache-Control': 'public, max-age=31536000',
|
|
80
|
+
Expires: new Date(Date.now() + 31536000000).toUTCString(),
|
|
81
|
+
};
|
|
117
82
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
83
|
+
try {
|
|
84
|
+
// 检查本地文件是否存在.头文件
|
|
85
|
+
const stats = await fs.stat(localHeaderPath);
|
|
86
|
+
if (stats.isFile()) {
|
|
87
|
+
const headerDataStr = await fs.readFile(localHeaderPath, 'utf8');
|
|
88
|
+
const headerData = parseJsonObject(headerDataStr);
|
|
89
|
+
if (headerData) {
|
|
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'];
|
|
123
96
|
}
|
|
124
|
-
|
|
125
|
-
|
|
97
|
+
}
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.debug('[StaticController]responseLocalFile', error);
|
|
126
100
|
}
|
|
127
101
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
102
|
+
try {
|
|
103
|
+
// 检查本地文件是否存在
|
|
104
|
+
const stats = await fs.stat(localFilePath);
|
|
105
|
+
if (stats.isFile()) {
|
|
106
|
+
if (!headers['content-type']) {
|
|
107
|
+
headers['content-type'] = this.getMimeType(localFilePath);
|
|
108
|
+
}
|
|
132
109
|
|
|
110
|
+
const stream = fs2.createReadStream(localFilePath);
|
|
111
|
+
stream.setMaxListeners(50);
|
|
112
|
+
// const oldOn = stream.on.bind(stream);
|
|
113
|
+
// stream.on = (...args)=>{
|
|
114
|
+
// return oldOn(...args)
|
|
115
|
+
// }
|
|
133
116
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const remoteUrl = `${PATH_CONFIG.remoteBaseUrl}/${relativePath}`;
|
|
117
|
+
console.log(`返回本地文件: ${relativePath}`);
|
|
118
|
+
this.ctx.status = 200;
|
|
119
|
+
this.ctx.set(headers);
|
|
138
120
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
121
|
+
this.ctx.body = stream;
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
} catch (error) {
|
|
125
|
+
// 文件不存在,继续请求远程
|
|
126
|
+
}
|
|
144
127
|
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
145
130
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
131
|
+
@All('/:ossName/:relativePath+')
|
|
132
|
+
async proxyStaticFile(@Param('ossName') ossName: string, @Param('relativePath') relativePath: string) {
|
|
133
|
+
this.initNotFoundList();
|
|
134
|
+
const { localDir } = this.getLocalPaths();
|
|
135
|
+
const PATH_CONFIG = getPathConfig(ossName);
|
|
150
136
|
|
|
137
|
+
// 构建本地路径和远程路径
|
|
138
|
+
const localFilePath = path.join(localDir, 'files', ossName, relativePath);
|
|
139
|
+
const localHeaderPath = path.join(localDir, 'headers', ossName, relativePath);
|
|
140
|
+
const remoteUrl = `${PATH_CONFIG.remoteBaseUrl}/${relativePath}`;
|
|
151
141
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// 处理远程响应状态码
|
|
159
|
-
if (remoteRes.statusCode === 200) {
|
|
160
|
-
|
|
161
|
-
// 写入本地文件
|
|
162
|
-
await this.writeResponseToFile(remoteRes, localFilePath, localHeaderPath);
|
|
163
|
-
|
|
164
|
-
// 检查并返回本地文件
|
|
165
|
-
if (await this.responseLocalFile(localFilePath, localHeaderPath, relativePath)) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
} else if (remoteRes.statusCode === 404) {
|
|
171
|
-
// 记录404并返回
|
|
172
|
-
notFoundList.add(relativePath);
|
|
173
|
-
await this.saveNotFoundList();
|
|
174
|
-
console.log(`远程文件不存在,已记录404: ${relativePath}`);
|
|
175
|
-
this.ctx.status = 404;
|
|
176
|
-
return this.ctx.render('500', { errorMsg: ' 远程文件不存在,已记录404' });
|
|
177
|
-
} else {
|
|
178
|
-
// 其他状态码
|
|
179
|
-
const msg = `远程服务器返回状态码: ${remoteRes.statusCode}`;
|
|
180
|
-
console.log(msg);
|
|
181
|
-
this.ctx.status = 502;
|
|
182
|
-
return this.ctx.render('500', { errorMsg: msg });
|
|
183
|
-
}
|
|
184
|
-
} catch (err) {
|
|
185
|
-
const msg = `请求远程文件失败: ${err}`;
|
|
186
|
-
console.log(msg);
|
|
187
|
-
this.ctx.status = 500;
|
|
188
|
-
return this.ctx.render('500', { errorMsg: msg });
|
|
189
|
-
}
|
|
142
|
+
// 检查是否在404列表中
|
|
143
|
+
if (notFoundList.has(relativePath)) {
|
|
144
|
+
this.ctx.status = 404;
|
|
145
|
+
return this.ctx.render('500', { errorMsg: ' 远程文件不存在, 命中notFoundList' });
|
|
146
|
+
}
|
|
190
147
|
|
|
191
|
-
|
|
192
|
-
|
|
148
|
+
// 检查并返回本地文件
|
|
149
|
+
if (await this.responseLocalFile(localFilePath, localHeaderPath, relativePath)) {
|
|
150
|
+
return;
|
|
193
151
|
}
|
|
194
152
|
|
|
153
|
+
// 请求远程文件
|
|
154
|
+
console.log(`请求远程文件: ${remoteUrl}`);
|
|
195
155
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
try {
|
|
199
|
-
// 确保存储404列表的目录存在
|
|
200
|
-
const dir = path.dirname(notFoundListFile);
|
|
201
|
-
await fs.mkdir(dir, { recursive: true });
|
|
202
|
-
|
|
203
|
-
await fs.writeFile(
|
|
204
|
-
notFoundListFile,
|
|
205
|
-
JSON.stringify(Array.from(notFoundList), null),
|
|
206
|
-
'utf8'
|
|
207
|
-
);
|
|
208
|
-
} catch (error) {
|
|
209
|
-
console.error('保存404列表失败:', error);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
156
|
+
try {
|
|
157
|
+
const remoteRes = await this.httpsGet(remoteUrl);
|
|
212
158
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
resolve({
|
|
218
|
-
statusCode: res.statusCode || 500,
|
|
219
|
-
headers: res.headers,
|
|
220
|
-
body: res
|
|
221
|
-
});
|
|
222
|
-
}).on('error', (err) => {
|
|
223
|
-
reject(err);
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
}
|
|
159
|
+
// 处理远程响应状态码
|
|
160
|
+
if (remoteRes.statusCode === 200) {
|
|
161
|
+
// 写入本地文件
|
|
162
|
+
await this.writeResponseToFile(remoteRes, localFilePath, localHeaderPath);
|
|
227
163
|
|
|
228
|
-
|
|
229
|
-
|
|
164
|
+
// 检查并返回本地文件
|
|
165
|
+
if (await this.responseLocalFile(localFilePath, localHeaderPath, relativePath)) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
} else if (remoteRes.statusCode === 404) {
|
|
169
|
+
// 记录404并返回
|
|
170
|
+
notFoundList.add(relativePath);
|
|
171
|
+
await this.saveNotFoundList();
|
|
172
|
+
console.log(`远程文件不存在,已记录404: ${relativePath}`);
|
|
173
|
+
this.ctx.status = 404;
|
|
174
|
+
return this.ctx.render('500', { errorMsg: ' 远程文件不存在,已记录404' });
|
|
175
|
+
} else {
|
|
176
|
+
// 其他状态码
|
|
177
|
+
const msg = `远程服务器返回状态码: ${remoteRes.statusCode}`;
|
|
178
|
+
console.log(msg);
|
|
179
|
+
this.ctx.status = 502;
|
|
180
|
+
return this.ctx.render('500', { errorMsg: msg });
|
|
181
|
+
}
|
|
182
|
+
} catch (err) {
|
|
183
|
+
const msg = `请求远程文件失败: ${err}`;
|
|
184
|
+
console.log(msg);
|
|
185
|
+
this.ctx.status = 500;
|
|
186
|
+
return this.ctx.render('500', { errorMsg: msg });
|
|
187
|
+
}
|
|
230
188
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
189
|
+
this.ctx.status = 500;
|
|
190
|
+
return this.ctx.render('500', { errorMsg: '未知异常' });
|
|
191
|
+
}
|
|
234
192
|
|
|
235
|
-
|
|
236
|
-
|
|
193
|
+
// 保存404列表
|
|
194
|
+
async saveNotFoundList() {
|
|
195
|
+
const { notFoundListFile } = this.getLocalPaths();
|
|
196
|
+
try {
|
|
197
|
+
// 确保存储404列表的目录存在
|
|
198
|
+
const dir = path.dirname(notFoundListFile);
|
|
199
|
+
await fs.mkdir(dir, { recursive: true });
|
|
237
200
|
|
|
238
|
-
|
|
239
|
-
|
|
201
|
+
await fs.writeFile(notFoundListFile, JSON.stringify(Array.from(notFoundList), null), 'utf8');
|
|
202
|
+
} catch (error) {
|
|
203
|
+
console.error('保存404列表失败:', error);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// 封装https请求为异步函数
|
|
208
|
+
async httpsGet(url: string): Promise<HttpGetRes> {
|
|
209
|
+
return new Promise<HttpGetRes>((resolve, reject) => {
|
|
210
|
+
https
|
|
211
|
+
.get(url, res => {
|
|
212
|
+
resolve({
|
|
213
|
+
statusCode: res.statusCode || 500,
|
|
214
|
+
headers: res.headers,
|
|
215
|
+
body: res,
|
|
216
|
+
});
|
|
217
|
+
})
|
|
218
|
+
.on('error', err => {
|
|
219
|
+
reject(err);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
}
|
|
240
223
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
224
|
+
// 新增:将响应body写入文件的函数
|
|
225
|
+
async writeResponseToFile(httpsGetRes: HttpGetRes, localFilePath: string, localHeaderPath: string): Promise<void> {
|
|
226
|
+
// 创建本地目录(如果不存在)
|
|
227
|
+
const localFileDir = path.dirname(localFilePath);
|
|
228
|
+
await fs.mkdir(localFileDir, { recursive: true });
|
|
245
229
|
|
|
246
|
-
|
|
247
|
-
|
|
230
|
+
const localHeaderDir = path.dirname(localHeaderPath);
|
|
231
|
+
await fs.mkdir(localHeaderDir, { recursive: true });
|
|
248
232
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
body.pipe(fileStream);
|
|
233
|
+
try {
|
|
234
|
+
const { statusCode, body } = httpsGetRes;
|
|
252
235
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
236
|
+
// 检查HTTP状态码
|
|
237
|
+
if (statusCode >= 400) {
|
|
238
|
+
throw new Error(`HTTP请求失败,状态码: ${statusCode}`);
|
|
239
|
+
}
|
|
256
240
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
reject(new Error(`写入文件失败: ${err.message}`));
|
|
260
|
-
});
|
|
261
|
-
});
|
|
241
|
+
// 创建可写流
|
|
242
|
+
const fileStream = fs2.createWriteStream(localFilePath);
|
|
262
243
|
|
|
263
|
-
|
|
244
|
+
// 使用管道将响应流写入文件
|
|
245
|
+
await new Promise((resolve, reject) => {
|
|
246
|
+
body.pipe(fileStream);
|
|
264
247
|
|
|
265
|
-
|
|
248
|
+
body.on('error', err => {
|
|
249
|
+
reject(new Error(`读取响应流失败: ${err.message}`));
|
|
250
|
+
});
|
|
266
251
|
|
|
267
|
-
|
|
252
|
+
fileStream.on('finish', resolve);
|
|
253
|
+
fileStream.on('error', err => {
|
|
254
|
+
reject(new Error(`写入文件失败: ${err.message}`));
|
|
255
|
+
});
|
|
256
|
+
});
|
|
268
257
|
|
|
258
|
+
console.log(`文件已成功写入1: ${localFilePath}`);
|
|
269
259
|
|
|
270
|
-
|
|
271
|
-
// 发生错误时删除可能存在的不完整文件
|
|
272
|
-
if (fs2.existsSync(localFilePath)) {
|
|
273
|
-
fs2.unlinkSync(localFilePath);
|
|
274
|
-
}
|
|
275
|
-
throw new Error(`下载过程中发生错误: ${err.message}`);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
260
|
+
await fs.writeFile(localHeaderPath, JSON.stringify(httpsGetRes.headers), 'utf8');
|
|
278
261
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
'.json': 'application/json',
|
|
287
|
-
'.png': 'image/png',
|
|
288
|
-
'.jpg': 'image/jpg',
|
|
289
|
-
'.gif': 'image/gif',
|
|
290
|
-
'.svg': 'image/svg+xml',
|
|
291
|
-
'.woff': 'font/woff',
|
|
292
|
-
'.woff2': 'font/woff2',
|
|
293
|
-
'.ttf': 'font/ttf',
|
|
294
|
-
'.eot': 'application/vnd.ms-fontobject',
|
|
295
|
-
'.txt': 'text/plain',
|
|
296
|
-
'.pdf': 'application/pdf',
|
|
297
|
-
'.mp4': 'video/mp4',
|
|
298
|
-
'.ico': 'image/x-icon'
|
|
299
|
-
};
|
|
300
|
-
return mimeTypes[extname] || 'application/octet-stream';
|
|
262
|
+
console.log(`文件已成功写入2: ${localHeaderPath}`);
|
|
263
|
+
} catch (err) {
|
|
264
|
+
// 发生错误时删除可能存在的不完整文件
|
|
265
|
+
if (fs2.existsSync(localFilePath)) {
|
|
266
|
+
fs2.unlinkSync(localFilePath);
|
|
267
|
+
}
|
|
268
|
+
throw new Error(`下载过程中发生错误: ${err.message}`);
|
|
301
269
|
}
|
|
302
|
-
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// 根据文件扩展名获取MIME类型
|
|
273
|
+
getMimeType(filePath: string) {
|
|
274
|
+
const extname = path.extname(filePath).toLowerCase();
|
|
275
|
+
const mimeTypes = {
|
|
276
|
+
'.html': 'text/html',
|
|
277
|
+
'.js': 'text/javascript',
|
|
278
|
+
'.css': 'text/css',
|
|
279
|
+
'.json': 'application/json',
|
|
280
|
+
'.png': 'image/png',
|
|
281
|
+
'.jpg': 'image/jpg',
|
|
282
|
+
'.gif': 'image/gif',
|
|
283
|
+
'.svg': 'image/svg+xml',
|
|
284
|
+
'.woff': 'font/woff',
|
|
285
|
+
'.woff2': 'font/woff2',
|
|
286
|
+
'.ttf': 'font/ttf',
|
|
287
|
+
'.eot': 'application/vnd.ms-fontobject',
|
|
288
|
+
'.txt': 'text/plain',
|
|
289
|
+
'.pdf': 'application/pdf',
|
|
290
|
+
'.mp4': 'video/mp4',
|
|
291
|
+
'.ico': 'image/x-icon',
|
|
292
|
+
};
|
|
293
|
+
return mimeTypes[extname] || 'application/octet-stream';
|
|
294
|
+
}
|
|
303
295
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {Controller, Get, Inject} from '@midwayjs/core';
|
|
2
|
-
import {Context} from '@midwayjs/koa';
|
|
3
|
-
import {BaseApiController} from './base/BaseApiController';
|
|
4
|
-
import {WorkbenchService} from '../service/WorkbenchService';
|
|
5
|
-
import {createRenderUtils} from
|
|
6
|
-
import {privateAES} from
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Controller, Get, Inject } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import { BaseApiController } from './base/BaseApiController';
|
|
4
|
+
import { WorkbenchService } from '../service/WorkbenchService';
|
|
5
|
+
import { createRenderUtils } from '../libs/utils/render-utils';
|
|
6
|
+
import { privateAES } from '../libs/utils/crypto-utils';
|
|
9
7
|
|
|
10
8
|
@Controller('/')
|
|
11
9
|
export class HomeController extends BaseApiController {
|
|
@@ -36,21 +34,19 @@ export class HomeController extends BaseApiController {
|
|
|
36
34
|
|
|
37
35
|
const userInfo = this.getUserSessionInfo();
|
|
38
36
|
|
|
39
|
-
const fatcmscsrftoken = await privateAES.time_encrypt_utf8_base64(
|
|
37
|
+
const fatcmscsrftoken = await privateAES.time_encrypt_utf8_base64('' + Date.now());
|
|
40
38
|
|
|
41
39
|
const utils = createRenderUtils({
|
|
42
40
|
ctx: this.ctx,
|
|
43
41
|
userInfo,
|
|
44
42
|
workbenchInfo,
|
|
45
43
|
package_assets: workbenchInfo.package_assets,
|
|
46
|
-
fatcmscsrftoken
|
|
44
|
+
fatcmscsrftoken,
|
|
47
45
|
});
|
|
48
46
|
|
|
49
47
|
return this.ctx.renderString(html_content, { workbenchInfo, userInfo, utils }, { viewEngine: 'ejs' });
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
|
|
54
50
|
@Get('/robots.txt')
|
|
55
51
|
async robots(): Promise<string> {
|
|
56
52
|
return `User-agent: * \nDisallow: /ns/api/manage/`;
|
|
@@ -65,7 +61,4 @@ export class HomeController extends BaseApiController {
|
|
|
65
61
|
// ctx.set('Content-Type', 'image/jpeg');
|
|
66
62
|
// ctx.body = buffer;
|
|
67
63
|
// }
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
64
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Controller, Inject, Post } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
3
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
4
4
|
import { BaseApiController } from '../base/BaseApiController';
|
|
5
|
-
import { checkPermission } from '
|
|
6
|
-
import { SystemFuncCode } from '
|
|
7
|
-
import { SystemTables } from '
|
|
8
|
-
import { ISysAnyApiEntity } from '
|
|
5
|
+
import { checkPermission } from '@/middleware/permission.middleware';
|
|
6
|
+
import { SystemFuncCode } from '@/models/SystemPerm';
|
|
7
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
8
|
+
import { ISysAnyApiEntity } from '@/models/SystemEntities';
|
|
9
9
|
import * as md5 from 'md5';
|
|
10
|
-
import {parseJsonObject} from
|
|
10
|
+
import { parseJsonObject } from '@/libs/utils/functions';
|
|
11
11
|
|
|
12
12
|
function fixBodyData(body: any) {
|
|
13
13
|
const dataObj: any = (body.data || {}) as ISysAnyApiEntity;
|
|
14
14
|
const parsedOthers = parseJsonObject(dataObj.others);
|
|
15
15
|
dataObj.func_code_md5 = md5(dataObj.func_code || '');
|
|
16
|
-
dataObj.req_params = parsedOthers?.req_params?.length || 0;
|
|
16
|
+
dataObj.req_params = parsedOthers?.req_params?.length || 0; // 参数个数
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
@Controller('/ns/api/manage/anyapi', { middleware: [checkPermission(SystemFuncCode.AnyApiManageRead)] })
|
|
@@ -31,7 +31,7 @@ export class AnyApiMangeApi extends BaseApiController {
|
|
|
31
31
|
return this.executeSysSimpleSQL(SystemTables.sys_anyapi, KeysOfSimpleSQL.SIMPLE_QUERY_ONE);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
@Post('/createAnyApi',
|
|
34
|
+
@Post('/createAnyApi', { middleware: [checkPermission(SystemFuncCode.AnyApiManageWrite)] })
|
|
35
35
|
async createAnyApi() {
|
|
36
36
|
fixBodyData(this.ctx.request.body);
|
|
37
37
|
|
|
@@ -44,13 +44,13 @@ export class AnyApiMangeApi extends BaseApiController {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
@Post('/updateAnyApi'
|
|
47
|
+
@Post('/updateAnyApi', { middleware: [checkPermission(SystemFuncCode.AnyApiManageWrite)] })
|
|
48
48
|
async updateAnyApi() {
|
|
49
49
|
fixBodyData(this.ctx.request.body);
|
|
50
50
|
|
|
51
51
|
return this.executeSysSimpleSQL(SystemTables.sys_anyapi, KeysOfSimpleSQL.SIMPLE_UPDATE, {
|
|
52
52
|
validateCfg: {
|
|
53
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
53
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
54
54
|
},
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -59,7 +59,7 @@ export class AnyApiMangeApi extends BaseApiController {
|
|
|
59
59
|
async deleteAnyApi() {
|
|
60
60
|
return this.executeSysSimpleSQL(SystemTables.sys_anyapi, KeysOfSimpleSQL.SIMPLE_DELETE, {
|
|
61
61
|
validateCfg: {
|
|
62
|
-
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.
|
|
62
|
+
'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.NUMERIC],
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
65
|
}
|