midway-fatcms 0.0.1-beta.5 → 0.0.1-beta.7
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/dist/config/config.default.js +48 -11
- package/dist/controller/base/BaseApiController.js +9 -6
- package/dist/controller/gateway/DocGatewayController.js +13 -8
- package/dist/controller/home.controller.js +2 -2
- package/dist/controller/manage/CrudStandardDesignApi.js +83 -68
- package/dist/controller/manage/DeployManageApi.js +6 -4
- package/dist/controller/manage/SuperAdminManageApi.js +12 -8
- package/dist/controller/manage/SysConfigMangeApi.js +3 -1
- package/dist/controller/render/AppRenderController.js +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/libs/global-config/global-config.d.ts +19 -0
- package/dist/libs/global-config/global-config.js +25 -0
- package/dist/models/SystemTables.d.ts +0 -3
- package/dist/models/SystemTables.js +1 -4
- package/dist/service/AuthService.js +7 -4
- 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/VisitStatService.js +4 -2
- package/dist/service/WorkbenchService.js +4 -2
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/crudstd/CrudStdService.js +6 -2
- package/dist/service/curd/CurdMixByAccountService.js +4 -2
- package/dist/service/curd/CurdMixByDictService.js +4 -2
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
- package/package.json +1 -1
- package/src/config/config.default.ts +54 -23
- package/src/controller/base/BaseApiController.ts +13 -13
- package/src/controller/gateway/DocGatewayController.ts +9 -1
- package/src/controller/home.controller.ts +8 -10
- package/src/controller/manage/CrudStandardDesignApi.ts +139 -94
- package/src/controller/manage/DeployManageApi.ts +4 -1
- package/src/controller/manage/SuperAdminManageApi.ts +11 -2
- package/src/controller/manage/SysConfigMangeApi.ts +4 -1
- package/src/controller/render/AppRenderController.ts +17 -14
- package/src/index.ts +1 -1
- package/src/libs/global-config/global-config.ts +47 -0
- package/src/models/SystemTables.ts +0 -4
- package/src/service/AuthService.ts +10 -5
- package/src/service/EnumInfoService.ts +6 -1
- package/src/service/FileCenterService.ts +8 -2
- package/src/service/SysConfigService.ts +9 -5
- package/src/service/UserAccountService.ts +11 -1
- package/src/service/VisitStatService.ts +5 -1
- package/src/service/WorkbenchService.ts +6 -1
- package/src/service/anyapi/AnyApiService.ts +6 -1
- package/src/service/crudstd/CrudStdService.ts +11 -1
- package/src/service/curd/CurdMixByAccountService.ts +6 -1
- package/src/service/curd/CurdMixByDictService.ts +7 -1
- package/src/service/curd/CurdMixBySysConfigService.ts +6 -1
- package/src/service/curd/CurdMixByWorkbenchService.ts +5 -1
- package/src/service/proxyapi/ProxyApiLoadService.ts +9 -1
package/dist/index.js
CHANGED
|
@@ -109,3 +109,4 @@ __exportStar(require("./libs/crud-pro/models/keys"), exports);
|
|
|
109
109
|
__exportStar(require("./libs/crud-pro/models/ExecuteContextFunc"), exports);
|
|
110
110
|
__exportStar(require("./libs/crud-pro/models/RequestCfgModel"), exports);
|
|
111
111
|
__exportStar(require("./libs/crud-pro/models/SqlSegArg"), exports);
|
|
112
|
+
__exportStar(require("./libs/global-config/global-config"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SqlDbType } from "../crud-pro/models/keys";
|
|
2
|
+
interface IGlobalStaticConfig {
|
|
3
|
+
/**
|
|
4
|
+
* CrudStd: 业务系统自定义的修改cfgModel
|
|
5
|
+
* @param cfgModel
|
|
6
|
+
* @param appInfo
|
|
7
|
+
*/
|
|
8
|
+
addCfgModelForCrudStdService(cfgModel: any, appInfo: any): Promise<any>;
|
|
9
|
+
SystemDbName: string;
|
|
10
|
+
SystemDbType: SqlDbType;
|
|
11
|
+
}
|
|
12
|
+
declare class GlobalStaticConfig {
|
|
13
|
+
private configObject;
|
|
14
|
+
constructor();
|
|
15
|
+
getConfig(): IGlobalStaticConfig;
|
|
16
|
+
setConfig(configObject: any): void;
|
|
17
|
+
}
|
|
18
|
+
declare const GLOBAL_STATIC_CONFIG: GlobalStaticConfig;
|
|
19
|
+
export { GLOBAL_STATIC_CONFIG };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GLOBAL_STATIC_CONFIG = void 0;
|
|
4
|
+
const keys_1 = require("../crud-pro/models/keys");
|
|
5
|
+
function noop() { }
|
|
6
|
+
class GlobalStaticConfig {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.configObject = {
|
|
9
|
+
addCfgModelForCrudStdService: noop,
|
|
10
|
+
SystemDbName: 'fatcms',
|
|
11
|
+
SystemDbType: keys_1.SqlDbType.mysql
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
getConfig() {
|
|
15
|
+
return this.configObject;
|
|
16
|
+
}
|
|
17
|
+
setConfig(configObject) {
|
|
18
|
+
if (!configObject || typeof configObject !== 'object') {
|
|
19
|
+
throw new Error("参数configObject不能为空");
|
|
20
|
+
}
|
|
21
|
+
Object.assign(this.configObject, configObject);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const GLOBAL_STATIC_CONFIG = new GlobalStaticConfig();
|
|
25
|
+
exports.GLOBAL_STATIC_CONFIG = GLOBAL_STATIC_CONFIG;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SqlDbType } from "../libs/crud-pro/models/keys";
|
|
2
1
|
export declare const SystemTables: {
|
|
3
2
|
sys_workbench: string;
|
|
4
3
|
sys_user_account: string;
|
|
@@ -22,6 +21,4 @@ export declare const SystemTables: {
|
|
|
22
21
|
sys_proxyapi: string;
|
|
23
22
|
sys_visit_stats: string;
|
|
24
23
|
};
|
|
25
|
-
export declare const SystemDbName = "fatcms";
|
|
26
|
-
export declare const SystemDbType = SqlDbType.mysql;
|
|
27
24
|
export declare const SystemDevOpsWorkbench = "devops";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SystemDevOpsWorkbench = exports.
|
|
4
|
-
const keys_1 = require("../libs/crud-pro/models/keys");
|
|
3
|
+
exports.SystemDevOpsWorkbench = exports.SystemTables = void 0;
|
|
5
4
|
exports.SystemTables = {
|
|
6
5
|
sys_workbench: 'sys_workbench',
|
|
7
6
|
sys_user_account: 'sys_user_account',
|
|
@@ -25,6 +24,4 @@ exports.SystemTables = {
|
|
|
25
24
|
sys_proxyapi: 'sys_proxyapi',
|
|
26
25
|
sys_visit_stats: 'sys_visit_stats',
|
|
27
26
|
};
|
|
28
|
-
exports.SystemDbName = 'fatcms';
|
|
29
|
-
exports.SystemDbType = keys_1.SqlDbType.mysql;
|
|
30
27
|
exports.SystemDevOpsWorkbench = 'devops';
|
|
@@ -22,6 +22,7 @@ const UserSessionService_1 = require("./UserSessionService");
|
|
|
22
22
|
const common_dto_1 = require("../libs/utils/common-dto");
|
|
23
23
|
const fatcms_request_1 = require("../libs/utils/fatcms-request");
|
|
24
24
|
const exceptions_1 = require("../libs/crud-pro/exceptions");
|
|
25
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
25
26
|
let AuthService = class AuthService {
|
|
26
27
|
/**
|
|
27
28
|
* 明文密码转unsaltedPwd密码
|
|
@@ -171,14 +172,15 @@ let AuthService = class AuthService {
|
|
|
171
172
|
* @private
|
|
172
173
|
*/
|
|
173
174
|
async queryUserRoleCodeList(accountId) {
|
|
175
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
174
176
|
const res = await this.curdMixService.executeCrudByCfg({
|
|
175
177
|
condition: { account_id: accountId },
|
|
176
178
|
limit: 10000,
|
|
177
179
|
}, {
|
|
178
180
|
sqlTable: SystemTables_1.SystemTables.sys_perm_user_role,
|
|
179
181
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
180
|
-
sqlDatabase:
|
|
181
|
-
sqlDdType:
|
|
182
|
+
sqlDatabase: SystemDbName,
|
|
183
|
+
sqlDdType: SystemDbType,
|
|
182
184
|
});
|
|
183
185
|
const rows = res.getResModel().rows || [];
|
|
184
186
|
const roleCodes = rows.map(({ role_code }) => {
|
|
@@ -195,14 +197,15 @@ let AuthService = class AuthService {
|
|
|
195
197
|
if (!roleCodeList || roleCodeList.length === 0) {
|
|
196
198
|
return [];
|
|
197
199
|
}
|
|
200
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
198
201
|
const res = await this.curdMixService.executeCrudByCfg({
|
|
199
202
|
condition: { role_code: { $in: roleCodeList } },
|
|
200
203
|
limit: 10000,
|
|
201
204
|
}, {
|
|
202
205
|
sqlTable: SystemTables_1.SystemTables.sys_perm_role_func,
|
|
203
206
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
204
|
-
sqlDatabase:
|
|
205
|
-
sqlDdType:
|
|
207
|
+
sqlDatabase: SystemDbName,
|
|
208
|
+
sqlDdType: SystemDbType,
|
|
206
209
|
});
|
|
207
210
|
const rows = res.getResModel().rows || [];
|
|
208
211
|
const funcCodes = rows.map(({ func_code }) => {
|
|
@@ -18,6 +18,7 @@ const SystemTables_1 = require("../models/SystemTables");
|
|
|
18
18
|
const parseConfig_1 = require("../libs/utils/parseConfig");
|
|
19
19
|
const RedisCacheService_1 = require("./base/RedisCacheService");
|
|
20
20
|
const CurdMixByLinkToCustomService_1 = require("./curd/CurdMixByLinkToCustomService");
|
|
21
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
21
22
|
function filterEmpty(e) {
|
|
22
23
|
return e.label && typeof e.value !== 'undefined';
|
|
23
24
|
}
|
|
@@ -70,13 +71,14 @@ let EnumInfoService = class EnumInfoService {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
async queryEnumInfoBySysCfgEnum(code) {
|
|
74
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
73
75
|
const res1 = await this.curdProService.executeCrudByCfg({
|
|
74
76
|
condition: { config_code: code },
|
|
75
77
|
}, {
|
|
76
78
|
sqlTable: SystemTables_1.SystemTables.sys_configs,
|
|
77
79
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
78
|
-
sqlDatabase:
|
|
79
|
-
sqlDdType:
|
|
80
|
+
sqlDatabase: SystemDbName,
|
|
81
|
+
sqlDdType: SystemDbType,
|
|
80
82
|
});
|
|
81
83
|
const obj = res1.getOneObj();
|
|
82
84
|
if (!obj) {
|
|
@@ -86,13 +88,14 @@ let EnumInfoService = class EnumInfoService {
|
|
|
86
88
|
return rows.map(e => ({ label: e.label, value: e.value, children: e.children })).filter(filterEmpty);
|
|
87
89
|
}
|
|
88
90
|
async queryEnumInfoItemByDict(code) {
|
|
91
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
89
92
|
const res1 = await this.curdProService.executeCrudByCfg({
|
|
90
93
|
condition: { dict_code: code },
|
|
91
94
|
}, {
|
|
92
95
|
sqlTable: SystemTables_1.SystemTables.sys_data_dict_item,
|
|
93
96
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
94
|
-
sqlDatabase:
|
|
95
|
-
sqlDdType:
|
|
97
|
+
sqlDatabase: SystemDbName,
|
|
98
|
+
sqlDdType: SystemDbType,
|
|
96
99
|
});
|
|
97
100
|
const obj = res1.getResRows();
|
|
98
101
|
if (!obj) {
|
|
@@ -20,7 +20,7 @@ const CurdMixService_1 = require("./curd/CurdMixService");
|
|
|
20
20
|
const keys_1 = require("../libs/crud-pro/models/keys");
|
|
21
21
|
const bizmodels_1 = require("../models/bizmodels");
|
|
22
22
|
const BaseService_1 = require("./base/BaseService");
|
|
23
|
-
const
|
|
23
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
24
24
|
function getSuffix(s) {
|
|
25
25
|
if (s) {
|
|
26
26
|
const indexOf = s.lastIndexOf('.');
|
|
@@ -93,12 +93,13 @@ class FileDB {
|
|
|
93
93
|
this.curdMixService = curdMixService;
|
|
94
94
|
}
|
|
95
95
|
async getFileInfo(fileKey) {
|
|
96
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
96
97
|
const condition = { file_key: fileKey };
|
|
97
98
|
const cfgModel = {
|
|
98
99
|
sqlTable: 'sys_file',
|
|
99
100
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
100
|
-
sqlDatabase:
|
|
101
|
-
sqlDdType:
|
|
101
|
+
sqlDatabase: SystemDbName,
|
|
102
|
+
sqlDdType: SystemDbType,
|
|
102
103
|
validateCfg: {
|
|
103
104
|
'condition.file_key': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
104
105
|
},
|
|
@@ -107,11 +108,12 @@ class FileDB {
|
|
|
107
108
|
return res.getOneObj();
|
|
108
109
|
}
|
|
109
110
|
async saveFileInfo(fileInfo) {
|
|
111
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
110
112
|
const cfgModel = {
|
|
111
113
|
sqlTable: 'sys_file',
|
|
112
114
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
113
|
-
sqlDatabase:
|
|
114
|
-
sqlDdType:
|
|
115
|
+
sqlDatabase: SystemDbName,
|
|
116
|
+
sqlDdType: SystemDbType,
|
|
115
117
|
};
|
|
116
118
|
return await this.curdMixService.executeCrudByCfg({
|
|
117
119
|
data: fileInfo,
|
|
@@ -121,20 +123,22 @@ class FileDB {
|
|
|
121
123
|
}, cfgModel);
|
|
122
124
|
}
|
|
123
125
|
async saveAssetsLog(fileInfo) {
|
|
126
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
124
127
|
const cfgModel = {
|
|
125
128
|
sqlTable: 'sys_assets_log',
|
|
126
129
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
127
|
-
sqlDatabase:
|
|
128
|
-
sqlDdType:
|
|
130
|
+
sqlDatabase: SystemDbName,
|
|
131
|
+
sqlDdType: SystemDbType,
|
|
129
132
|
};
|
|
130
133
|
return await this.curdMixService.executeCrudByCfg({ data: fileInfo }, cfgModel);
|
|
131
134
|
}
|
|
132
135
|
async deleteFileInfo(id) {
|
|
136
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
133
137
|
const cfgModel = {
|
|
134
138
|
sqlTable: 'sys_file',
|
|
135
139
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_DELETE,
|
|
136
|
-
sqlDatabase:
|
|
137
|
-
sqlDdType:
|
|
140
|
+
sqlDatabase: SystemDbName,
|
|
141
|
+
sqlDdType: SystemDbType,
|
|
138
142
|
validateCfg: {
|
|
139
143
|
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMBER],
|
|
140
144
|
},
|
|
@@ -15,18 +15,20 @@ const keys_1 = require("../libs/crud-pro/models/keys");
|
|
|
15
15
|
const SystemTables_1 = require("../models/SystemTables");
|
|
16
16
|
const BaseService_1 = require("./base/BaseService");
|
|
17
17
|
const CurdProService_1 = require("./curd/CurdProService");
|
|
18
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
18
19
|
let SysConfigService = class SysConfigService extends BaseService_1.BaseService {
|
|
19
20
|
async getSysConfigOne(config_code) {
|
|
20
21
|
if (!config_code) {
|
|
21
22
|
throw new Error('[getSysConfigOne] config_code required');
|
|
22
23
|
}
|
|
24
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
23
25
|
const res1 = await this.curdProService.executeCrudByCfg({
|
|
24
26
|
condition: { config_code },
|
|
25
27
|
}, {
|
|
26
28
|
sqlTable: SystemTables_1.SystemTables.sys_configs,
|
|
27
29
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
28
|
-
sqlDatabase:
|
|
29
|
-
sqlDdType:
|
|
30
|
+
sqlDatabase: SystemDbName,
|
|
31
|
+
sqlDdType: SystemDbType,
|
|
30
32
|
});
|
|
31
33
|
return res1.getOneObj();
|
|
32
34
|
}
|
|
@@ -18,20 +18,22 @@ const functions_1 = require("../libs/utils/functions");
|
|
|
18
18
|
const exceptions_1 = require("../libs/crud-pro/exceptions");
|
|
19
19
|
const SystemTables_1 = require("../models/SystemTables");
|
|
20
20
|
const common_dto_1 = require("../libs/utils/common-dto");
|
|
21
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
21
22
|
let UserAccountService = class UserAccountService {
|
|
22
23
|
/**
|
|
23
24
|
* 查询用户: 根据loginName查询
|
|
24
25
|
* @param loginName
|
|
25
26
|
*/
|
|
26
27
|
async queryUserAccountByLoginName(loginName) {
|
|
28
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
27
29
|
const query = await this.curdMixService.executeCrudByCfg({
|
|
28
30
|
condition: { login_name: loginName },
|
|
29
31
|
}, {
|
|
30
32
|
method: 'UserAccountService.queryUserAccountByLoginName',
|
|
31
33
|
sqlTable: SystemTables_1.SystemTables.sys_user_account,
|
|
32
34
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
33
|
-
sqlDatabase:
|
|
34
|
-
sqlDdType:
|
|
35
|
+
sqlDatabase: SystemDbName,
|
|
36
|
+
sqlDdType: SystemDbType,
|
|
35
37
|
});
|
|
36
38
|
const { row } = query.getResModel();
|
|
37
39
|
return row;
|
|
@@ -45,6 +47,7 @@ let UserAccountService = class UserAccountService {
|
|
|
45
47
|
if (!accountIdList || accountIdList.length === 0) {
|
|
46
48
|
return [];
|
|
47
49
|
}
|
|
50
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
48
51
|
const accountIds = accountIdList.map(userId => {
|
|
49
52
|
return `${userId}`;
|
|
50
53
|
});
|
|
@@ -52,8 +55,8 @@ let UserAccountService = class UserAccountService {
|
|
|
52
55
|
method: 'UserAccountService.queryAccountBasicInfoByIds',
|
|
53
56
|
sqlTable: SystemTables_1.SystemTables.sys_user_account,
|
|
54
57
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
55
|
-
sqlDatabase:
|
|
56
|
-
sqlDdType:
|
|
58
|
+
sqlDatabase: SystemDbName,
|
|
59
|
+
sqlDdType: SystemDbType,
|
|
57
60
|
};
|
|
58
61
|
const reqJson = {
|
|
59
62
|
columns: columns,
|
|
@@ -75,6 +78,7 @@ let UserAccountService = class UserAccountService {
|
|
|
75
78
|
if (!loginName) {
|
|
76
79
|
throw new exceptions_1.CommonException(exceptions_1.Exceptions.OTHER_EXCEPTION, 'loginName不存在');
|
|
77
80
|
}
|
|
81
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
78
82
|
const pwd_salt = (0, functions_1.createUniqueId)();
|
|
79
83
|
const pwd_md5 = md5(unsaltedPwd + pwd_salt);
|
|
80
84
|
const res1 = await this.curdMixService.executeCrudByCfg({
|
|
@@ -83,8 +87,8 @@ let UserAccountService = class UserAccountService {
|
|
|
83
87
|
}, {
|
|
84
88
|
sqlTable: SystemTables_1.SystemTables.sys_user_account,
|
|
85
89
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE,
|
|
86
|
-
sqlDatabase:
|
|
87
|
-
sqlDdType:
|
|
90
|
+
sqlDatabase: SystemDbName,
|
|
91
|
+
sqlDdType: SystemDbType,
|
|
88
92
|
});
|
|
89
93
|
return common_dto_1.CommonResult.successRes(res1.getResModel());
|
|
90
94
|
}
|
|
@@ -17,6 +17,7 @@ const SystemTables_1 = require("../models/SystemTables");
|
|
|
17
17
|
const keys_1 = require("../libs/crud-pro/models/keys");
|
|
18
18
|
const bizmodels_1 = require("../models/bizmodels");
|
|
19
19
|
const common_dto_1 = require("../libs/utils/common-dto");
|
|
20
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
20
21
|
// 3天 的秒数
|
|
21
22
|
const EXPIRE_TIME = 3 * 24 * 60 * 60;
|
|
22
23
|
const STAT_TYPES = {
|
|
@@ -31,6 +32,7 @@ let VisitStatService = class VisitStatService extends BaseService_1.BaseService
|
|
|
31
32
|
return this.flushVisitStatToDB();
|
|
32
33
|
}
|
|
33
34
|
async flushVisitStatToDB() {
|
|
35
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
34
36
|
// 统计昨天的数据。
|
|
35
37
|
const stat_date = new Date(Date.now() - 24 * 3600 * 1000).toISOString().split('T')[0];
|
|
36
38
|
const lockKey = `vs_lock_${stat_date}`;
|
|
@@ -74,8 +76,8 @@ let VisitStatService = class VisitStatService extends BaseService_1.BaseService
|
|
|
74
76
|
}
|
|
75
77
|
}, {
|
|
76
78
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
77
|
-
sqlDatabase:
|
|
78
|
-
sqlDdType:
|
|
79
|
+
sqlDatabase: SystemDbName,
|
|
80
|
+
sqlDdType: SystemDbType,
|
|
79
81
|
sqlTable: SystemTables_1.SystemTables.sys_visit_stats,
|
|
80
82
|
});
|
|
81
83
|
await client.del(key);
|
|
@@ -20,6 +20,7 @@ const exceptions_1 = require("../libs/crud-pro/exceptions");
|
|
|
20
20
|
const functions_1 = require("../libs/utils/functions");
|
|
21
21
|
const fatcms_request_1 = require("../libs/utils/fatcms-request");
|
|
22
22
|
const MixinUtils_1 = require("../libs/crud-pro/utils/MixinUtils");
|
|
23
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
23
24
|
//
|
|
24
25
|
// const lruCache = new LRUCache<string, any>({
|
|
25
26
|
// max: 500,
|
|
@@ -38,14 +39,15 @@ let WorkbenchService = class WorkbenchService extends BaseService_1.BaseService
|
|
|
38
39
|
await this.getAllWorkbenchInfoMap(true);
|
|
39
40
|
}
|
|
40
41
|
async getAllWorkbenchInfoList(isForceRefresh) {
|
|
42
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
41
43
|
let listData = lruCache.get(CACHE_KEY_WORKBENCH_LIST);
|
|
42
44
|
if (!listData || isForceRefresh === true) {
|
|
43
45
|
const reqJson = { condition: {}, pageSize: 1000, limit: 1000 };
|
|
44
46
|
const res = await this.curdProService.executeCrudByCfg(reqJson, {
|
|
45
47
|
sqlTable: SystemTables_1.SystemTables.sys_workbench,
|
|
46
48
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
47
|
-
sqlDatabase:
|
|
48
|
-
sqlDdType:
|
|
49
|
+
sqlDatabase: SystemDbName,
|
|
50
|
+
sqlDdType: SystemDbType,
|
|
49
51
|
});
|
|
50
52
|
listData = res.getResRows();
|
|
51
53
|
lruCache.set(CACHE_KEY_WORKBENCH_LIST, listData);
|
|
@@ -23,6 +23,7 @@ const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
|
|
|
23
23
|
const WorkbenchService_1 = require("../WorkbenchService");
|
|
24
24
|
const ValidateUtils_1 = require("../../libs/crud-pro/utils/ValidateUtils");
|
|
25
25
|
const ApiBaseService_1 = require("../base/ApiBaseService");
|
|
26
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
26
27
|
const lruCache = new lru_cache_1.LRUCache({
|
|
27
28
|
max: 500,
|
|
28
29
|
ttl: 1000 * 60,
|
|
@@ -65,12 +66,13 @@ let AnyApiService = class AnyApiService extends ApiBaseService_1.ApiBaseService
|
|
|
65
66
|
return anyApi;
|
|
66
67
|
}
|
|
67
68
|
async _getAnyApiMethod(methodCode) {
|
|
69
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
68
70
|
const res = await this.curdMixService.executeCrudByCfg({ condition: { method: methodCode } }, {
|
|
69
71
|
sqlTable: SystemTables_1.SystemTables.sys_anyapi,
|
|
70
72
|
method: `get_sys_anyapi_${methodCode}`,
|
|
71
73
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
72
|
-
sqlDatabase:
|
|
73
|
-
sqlDdType:
|
|
74
|
+
sqlDatabase: SystemDbName,
|
|
75
|
+
sqlDdType: SystemDbType,
|
|
74
76
|
updateCfg: {},
|
|
75
77
|
});
|
|
76
78
|
const obj = res.getOneObj();
|
|
@@ -21,6 +21,7 @@ const CrudStdRelationService_1 = require("./CrudStdRelationService");
|
|
|
21
21
|
const _ = require("lodash");
|
|
22
22
|
const ApiBaseService_1 = require("../base/ApiBaseService");
|
|
23
23
|
const DatabaseName_1 = require("../../libs/crud-pro/utils/DatabaseName");
|
|
24
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
24
25
|
exports.SPECIAL_SETTING_KEY = {
|
|
25
26
|
QUERY_LIST: 'QUERY_LIST',
|
|
26
27
|
QUERY_ONE: 'QUERY_ONE',
|
|
@@ -53,6 +54,8 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
|
|
|
53
54
|
}
|
|
54
55
|
// 根据用户配置,设置关联查询的数据信息。
|
|
55
56
|
await this.crudStdRelationService.addCfgModelColumnsRelation(cfgModel, appInfo);
|
|
57
|
+
// 业务系统自定义的修改cfgModel
|
|
58
|
+
await global_config_1.GLOBAL_STATIC_CONFIG.getConfig().addCfgModelForCrudStdService(cfgModel, appInfo);
|
|
56
59
|
return await this.curdMixService.executeCrudByCfg(params, cfgModel);
|
|
57
60
|
}
|
|
58
61
|
/**
|
|
@@ -112,12 +115,13 @@ let CrudStdService = class CrudStdService extends ApiBaseService_1.ApiBaseServic
|
|
|
112
115
|
* @private
|
|
113
116
|
*/
|
|
114
117
|
async getCrudStdAppInfo(appCode) {
|
|
118
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
115
119
|
this.logInfo('getCrudStdAppInfo', appCode);
|
|
116
120
|
const ss = {
|
|
117
121
|
sqlTable: SystemTables_1.SystemTables.sys_app,
|
|
118
122
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
119
|
-
sqlDatabase:
|
|
120
|
-
sqlDdType:
|
|
123
|
+
sqlDatabase: SystemDbName,
|
|
124
|
+
sqlDdType: SystemDbType,
|
|
121
125
|
};
|
|
122
126
|
return await this.curdMixService.executeCrudByCfg({ condition: { app_code: appCode } }, ss);
|
|
123
127
|
}
|
|
@@ -17,10 +17,12 @@ const CurdMixUtils_1 = require("./CurdMixUtils");
|
|
|
17
17
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
18
18
|
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
19
19
|
const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
|
|
20
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
20
21
|
const dictMixUtils = new CurdMixUtils_1.CrudMixUtils(CurdMixUtils_1.RelatedType.accountBasic);
|
|
21
22
|
const TMP_CTX_KEY = _.uniqueId('CurdMixByAccountService');
|
|
22
23
|
let CurdMixByAccountService = class CurdMixByAccountService {
|
|
23
24
|
async handleExecuteContextPrepare(executeContext) {
|
|
25
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
24
26
|
const relations = dictMixUtils.pickColumnRelations(executeContext);
|
|
25
27
|
if (!relations || relations.length === 0) {
|
|
26
28
|
return;
|
|
@@ -40,8 +42,8 @@ let CurdMixByAccountService = class CurdMixByAccountService {
|
|
|
40
42
|
method: 'UserAccountService.queryAccountBasicInfoByIds',
|
|
41
43
|
sqlTable: SystemTables_1.SystemTables.sys_user_account,
|
|
42
44
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
43
|
-
sqlDatabase:
|
|
44
|
-
sqlDdType:
|
|
45
|
+
sqlDatabase: SystemDbName,
|
|
46
|
+
sqlDdType: SystemDbType,
|
|
45
47
|
};
|
|
46
48
|
const reqJson = {
|
|
47
49
|
columns: ['nick_name', 'avatar', 'account_id'],
|
|
@@ -18,6 +18,7 @@ const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
|
18
18
|
const MultiKeyMap_1 = require("../../libs/crud-pro/utils/MultiKeyMap");
|
|
19
19
|
const _ = require("lodash");
|
|
20
20
|
const RedisCacheService_1 = require("../base/RedisCacheService");
|
|
21
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
21
22
|
const TMP_CTX_KEY = _.uniqueId('CurdMixByDictService');
|
|
22
23
|
const dictMixUtils = new CurdMixUtils_1.CrudMixUtils(CurdMixUtils_1.RelatedType.dict);
|
|
23
24
|
let CurdMixByDictService = class CurdMixByDictService {
|
|
@@ -38,6 +39,7 @@ let CurdMixByDictService = class CurdMixByDictService {
|
|
|
38
39
|
executeContext[TMP_CTX_KEY] = new MultiKeyMap_1.MultiKeyMap(rows, 'dict_code', 'value');
|
|
39
40
|
}
|
|
40
41
|
async getDictItemRows(codes) {
|
|
42
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
41
43
|
const noCacheCodes = [];
|
|
42
44
|
// 从缓存里面取
|
|
43
45
|
let cachedRows = [];
|
|
@@ -60,8 +62,8 @@ let CurdMixByDictService = class CurdMixByDictService {
|
|
|
60
62
|
}, {
|
|
61
63
|
sqlTable: SystemTables_1.SystemTables.sys_data_dict_item,
|
|
62
64
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
63
|
-
sqlDatabase:
|
|
64
|
-
sqlDdType:
|
|
65
|
+
sqlDatabase: SystemDbName,
|
|
66
|
+
sqlDdType: SystemDbType,
|
|
65
67
|
});
|
|
66
68
|
selectedRows = res1.getResRows();
|
|
67
69
|
//放到缓存里
|
|
@@ -18,10 +18,12 @@ const SystemTables_1 = require("../../models/SystemTables");
|
|
|
18
18
|
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
19
19
|
const MultiKeyMap_1 = require("../../libs/crud-pro/utils/MultiKeyMap");
|
|
20
20
|
const parseConfig_1 = require("../../libs/utils/parseConfig");
|
|
21
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
21
22
|
const dictMixUtils = new CurdMixUtils_1.CrudMixUtils(CurdMixUtils_1.RelatedType.sysCfgEnum);
|
|
22
23
|
const TMP_CTX_KEY = _.uniqueId('CurdMixBySysConfigService');
|
|
23
24
|
let CurdMixBySysConfigService = class CurdMixBySysConfigService {
|
|
24
25
|
async handleExecuteContextPrepare(executeContext) {
|
|
26
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
25
27
|
const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
|
|
26
28
|
if (!codes || codes.length === 0) {
|
|
27
29
|
return;
|
|
@@ -31,8 +33,8 @@ let CurdMixBySysConfigService = class CurdMixBySysConfigService {
|
|
|
31
33
|
}, {
|
|
32
34
|
sqlTable: SystemTables_1.SystemTables.sys_configs,
|
|
33
35
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
34
|
-
sqlDatabase:
|
|
35
|
-
sqlDdType:
|
|
36
|
+
sqlDatabase: SystemDbName,
|
|
37
|
+
sqlDdType: SystemDbType,
|
|
36
38
|
});
|
|
37
39
|
const rows = res1.getResRows();
|
|
38
40
|
const multiKeyMap = new MultiKeyMap_1.MultiKeyMap();
|
|
@@ -18,6 +18,7 @@ const CurdMixUtils_1 = require("./CurdMixUtils");
|
|
|
18
18
|
const SystemTables_1 = require("../../models/SystemTables");
|
|
19
19
|
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
20
20
|
const MixinUtils_1 = require("../../libs/crud-pro/utils/MixinUtils");
|
|
21
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
21
22
|
const lruCache = new lru_cache_1.LRUCache({
|
|
22
23
|
max: 500,
|
|
23
24
|
ttl: 1000 * 60 * 5,
|
|
@@ -27,6 +28,7 @@ const workbenchMixUtils = new CurdMixUtils_1.CrudMixUtils(CurdMixUtils_1.Related
|
|
|
27
28
|
const TMP_CTX_KEY = _.uniqueId('CurdMixByWorkbenchService');
|
|
28
29
|
let CurdMixByWorkbenchService = class CurdMixByWorkbenchService {
|
|
29
30
|
async loadWorkbenchListMap() {
|
|
31
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
30
32
|
let workbenchListMap = lruCache.get('workbenchListMap');
|
|
31
33
|
if (!workbenchListMap) {
|
|
32
34
|
const reqJson = {
|
|
@@ -36,8 +38,8 @@ let CurdMixByWorkbenchService = class CurdMixByWorkbenchService {
|
|
|
36
38
|
const res = await this.curdProService.executeCrudByCfg(reqJson, {
|
|
37
39
|
sqlTable: SystemTables_1.SystemTables.sys_workbench,
|
|
38
40
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
39
|
-
sqlDatabase:
|
|
40
|
-
sqlDdType:
|
|
41
|
+
sqlDatabase: SystemDbName,
|
|
42
|
+
sqlDdType: SystemDbType,
|
|
41
43
|
});
|
|
42
44
|
const workbenchList = res.getResRows();
|
|
43
45
|
workbenchListMap = MixinUtils_1.MixinUtils.toNewMap(workbenchList, (obj) => obj.workbench_code);
|
|
@@ -24,6 +24,7 @@ const WeightedRandom_1 = require("./WeightedRandom");
|
|
|
24
24
|
const WeightedRoundRobin_1 = require("./WeightedRoundRobin");
|
|
25
25
|
const WorkbenchService_1 = require("../WorkbenchService");
|
|
26
26
|
const exceptions_1 = require("../../libs/crud-pro/exceptions");
|
|
27
|
+
const global_config_1 = require("../../libs/global-config/global-config");
|
|
27
28
|
function toUpstreamInfo(config_content) {
|
|
28
29
|
const obj = (0, functions_1.parseJsonObject)(config_content);
|
|
29
30
|
if (!obj) {
|
|
@@ -79,6 +80,7 @@ let ProxyApiLoadService = class ProxyApiLoadService extends BaseService_1.BaseSe
|
|
|
79
80
|
return routeTrie;
|
|
80
81
|
}
|
|
81
82
|
async buildUpstreamMap() {
|
|
83
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
82
84
|
// biz_tag={'upstream'}
|
|
83
85
|
const res = await this.curdProService.executeCrudByCfg({
|
|
84
86
|
condition: {
|
|
@@ -86,8 +88,8 @@ let ProxyApiLoadService = class ProxyApiLoadService extends BaseService_1.BaseSe
|
|
|
86
88
|
},
|
|
87
89
|
}, {
|
|
88
90
|
sqlTable: SystemTables_1.SystemTables.sys_configs,
|
|
89
|
-
sqlDatabase:
|
|
90
|
-
sqlDdType:
|
|
91
|
+
sqlDatabase: SystemDbName,
|
|
92
|
+
sqlDdType: SystemDbType,
|
|
91
93
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
92
94
|
});
|
|
93
95
|
const upstreamMap = {};
|
|
@@ -100,12 +102,13 @@ let ProxyApiLoadService = class ProxyApiLoadService extends BaseService_1.BaseSe
|
|
|
100
102
|
return upstreamMap;
|
|
101
103
|
}
|
|
102
104
|
async loadProxyApiEntity(workbench_code, upstreamMap) {
|
|
105
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
103
106
|
const res = await this.curdProService.executeCrudByCfg({
|
|
104
107
|
condition: {},
|
|
105
108
|
}, {
|
|
106
109
|
sqlTable: SystemTables_1.SystemTables.sys_proxyapi,
|
|
107
|
-
sqlDatabase:
|
|
108
|
-
sqlDdType:
|
|
110
|
+
sqlDatabase: SystemDbName,
|
|
111
|
+
sqlDdType: SystemDbType,
|
|
109
112
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
110
113
|
});
|
|
111
114
|
const rows0 = res.getResRows();
|