midway-fatcms 0.0.1-beta.1 → 0.0.1-beta.10
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 +52 -15
- package/dist/controller/base/BaseApiController.js +9 -6
- package/dist/controller/gateway/CrudMtdGatewayController.js +3 -0
- package/dist/controller/gateway/DocGatewayController.js +13 -8
- package/dist/controller/gateway/StaticController.d.ts +3 -0
- package/dist/controller/gateway/StaticController.js +41 -21
- 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/manage/UserAccountManageApi.d.ts +1 -1
- package/dist/controller/manage/UserAccountManageApi.js +5 -0
- package/dist/controller/myinfo/AuthController.d.ts +0 -4
- package/dist/controller/myinfo/AuthController.js +0 -53
- package/dist/controller/render/AppRenderController.js +4 -2
- package/dist/index.d.ts +28 -4
- package/dist/index.js +28 -4
- package/dist/libs/global-config/global-config.d.ts +39 -0
- package/dist/libs/global-config/global-config.js +32 -0
- package/dist/models/SystemTables.d.ts +0 -3
- package/dist/models/SystemTables.js +1 -4
- 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/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 +12 -6
- 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/curd/CurdMixUtils.d.ts +7 -0
- package/dist/service/curd/CurdMixUtils.js +31 -1
- 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 +5 -1
- package/src/config/config.default.ts +58 -27
- package/src/controller/base/BaseApiController.ts +13 -13
- package/src/controller/gateway/CrudMtdGatewayController.ts +5 -1
- package/src/controller/gateway/DocGatewayController.ts +9 -1
- package/src/controller/gateway/StaticController.ts +50 -25
- 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/manage/UserAccountManageApi.ts +6 -0
- package/src/controller/myinfo/AuthController.ts +4 -66
- package/src/controller/render/AppRenderController.ts +17 -14
- package/src/index.ts +33 -4
- package/src/libs/global-config/global-config.ts +72 -0
- package/src/models/SystemTables.ts +0 -4
- package/src/service/AuthService.ts +11 -6
- 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 +4 -1
- package/src/service/crudstd/CrudStdService.ts +11 -1
- package/src/service/curd/CurdMixByAccountService.ts +13 -5
- 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/curd/CurdMixUtils.ts +42 -12
- package/src/service/proxyapi/ProxyApiLoadService.ts +9 -1
- 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/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
|
@@ -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().bizUpdateCfgModelForCrudStd(params, cfgModel, appInfo, this.ctx);
|
|
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, toFatcmsUserAccountId } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
24
26
|
const relations = dictMixUtils.pickColumnRelations(executeContext);
|
|
25
27
|
if (!relations || relations.length === 0) {
|
|
26
28
|
return;
|
|
@@ -28,9 +30,13 @@ let CurdMixByAccountService = class CurdMixByAccountService {
|
|
|
28
30
|
const accountIds = new Set();
|
|
29
31
|
dictMixUtils.forEachRowAndColumnsRelation(executeContext, (row, columnRelation) => {
|
|
30
32
|
const { sourceColumn } = columnRelation;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
if (sourceColumn) {
|
|
34
|
+
const accountId = _.get(row, sourceColumn);
|
|
35
|
+
if (accountId) {
|
|
36
|
+
const fatcmsUserAccountId = toFatcmsUserAccountId(accountId);
|
|
37
|
+
accountIds.add(fatcmsUserAccountId);
|
|
38
|
+
row['__fatcmsUserAccountId__'] = fatcmsUserAccountId;
|
|
39
|
+
}
|
|
34
40
|
}
|
|
35
41
|
});
|
|
36
42
|
if (accountIds.size === 0) {
|
|
@@ -40,8 +46,8 @@ let CurdMixByAccountService = class CurdMixByAccountService {
|
|
|
40
46
|
method: 'UserAccountService.queryAccountBasicInfoByIds',
|
|
41
47
|
sqlTable: SystemTables_1.SystemTables.sys_user_account,
|
|
42
48
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
43
|
-
sqlDatabase:
|
|
44
|
-
sqlDdType:
|
|
49
|
+
sqlDatabase: SystemDbName,
|
|
50
|
+
sqlDdType: SystemDbType,
|
|
45
51
|
};
|
|
46
52
|
const reqJson = {
|
|
47
53
|
columns: ['nick_name', 'avatar', 'account_id'],
|
|
@@ -69,7 +75,7 @@ let CurdMixByAccountService = class CurdMixByAccountService {
|
|
|
69
75
|
{ from: 'avatar', to: `${sourceColumn}_user.avatar` },
|
|
70
76
|
];
|
|
71
77
|
}
|
|
72
|
-
dictMixUtils.
|
|
78
|
+
dictMixUtils.copyUserInfoToRowNoRelatedCode(row, userInfoMap, columnRelation);
|
|
73
79
|
});
|
|
74
80
|
}
|
|
75
81
|
};
|
|
@@ -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,5 +24,12 @@ declare class CrudMixUtils {
|
|
|
24
24
|
* @param columnRelation
|
|
25
25
|
*/
|
|
26
26
|
copyColumnRelationToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation): void;
|
|
27
|
+
/**
|
|
28
|
+
* 专门COPY用户信息到row上面。无relatedCode模式
|
|
29
|
+
* @param row
|
|
30
|
+
* @param map
|
|
31
|
+
* @param columnRelation
|
|
32
|
+
*/
|
|
33
|
+
copyUserInfoToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation): void;
|
|
27
34
|
}
|
|
28
35
|
export { CrudMixUtils, RelatedType, FuncRowColumnRelation };
|
|
@@ -67,7 +67,7 @@ function copyByArraySourceValue(row, sourceValue, targetColumns, getValue) {
|
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
69
|
const dictAttrValue = _.get(codeObject, targetColumn.from);
|
|
70
|
-
if (typeof dictAttrValue !==
|
|
70
|
+
if (typeof dictAttrValue !== 'undefined' && dictAttrValue !== null) {
|
|
71
71
|
const toStr = targetColumn.to.replace('$ARRAY_INDEX', `${codeIndex}`);
|
|
72
72
|
_.set(row, toStr, dictAttrValue);
|
|
73
73
|
isSetArray = true;
|
|
@@ -197,5 +197,35 @@ class CrudMixUtils {
|
|
|
197
197
|
copyBySingleSourceValue(row, sourceValue, targetColumns, getValue);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* 专门COPY用户信息到row上面。无relatedCode模式
|
|
202
|
+
* @param row
|
|
203
|
+
* @param map
|
|
204
|
+
* @param columnRelation
|
|
205
|
+
*/
|
|
206
|
+
copyUserInfoToRowNoRelatedCode(row, map, columnRelation) {
|
|
207
|
+
const { targetColumns } = columnRelation;
|
|
208
|
+
if (!targetColumns) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const tmpSourceColumn = '__fatcmsUserAccountId__';
|
|
212
|
+
const sourceValue = _.get(row, tmpSourceColumn);
|
|
213
|
+
if (!sourceValue) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const getValue = (code) => {
|
|
217
|
+
if (!map) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
if (typeof map.get === 'function') {
|
|
221
|
+
return map.get(`${code}`);
|
|
222
|
+
}
|
|
223
|
+
return map[code];
|
|
224
|
+
};
|
|
225
|
+
const isSetArray = copyByArraySourceValue(row, sourceValue, targetColumns, getValue);
|
|
226
|
+
if (!isSetArray) {
|
|
227
|
+
copyBySingleSourceValue(row, sourceValue, targetColumns, getValue);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
200
230
|
}
|
|
201
231
|
exports.CrudMixUtils = CrudMixUtils;
|
|
@@ -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();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<html dir="ltr" lang="zh">
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="color-scheme" content="light dark">
|
|
5
|
+
<meta name="theme-color" content="#fff">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
7
|
+
<title>无法访问此应用</title>
|
|
8
|
+
<link rel="stylesheet" href="https://cdnjsx.oss-cn-shanghai.aliyuncs.com/styles/chrome-error.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body class="neterror" style="font-family: system-ui,PingFang SC,STHeiti,sans-serif; font-size: 75%">
|
|
11
|
+
|
|
12
|
+
<div id="content">
|
|
13
|
+
<div id="main-frame-error" class="interstitial-wrapper ">
|
|
14
|
+
<div id="main-content">
|
|
15
|
+
<div class="icon icon-generic"></div>
|
|
16
|
+
<div id="main-message">
|
|
17
|
+
<h1><span>无法访问此应用</span></h1>
|
|
18
|
+
<p>此应用存在如下可能的状态导致无法访问:应用不存在、应用已下线、站点不支持</p>
|
|
19
|
+
<p>appCode: <%=appCode%></p>
|
|
20
|
+
<div>
|
|
21
|
+
<p>errorMsg: <%=errorMsg%></p>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
30
|
+
|
|
31
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<html dir="ltr" lang="zh">
|
|
2
|
+
<head>
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="color-scheme" content="light dark">
|
|
5
|
+
<meta name="theme-color" content="#fff">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
7
|
+
<title>无法访问此网站</title>
|
|
8
|
+
<link rel="stylesheet" href="https://cdnjsx.oss-cn-shanghai.aliyuncs.com/styles/chrome-error.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body class="neterror" style="font-family: system-ui,PingFang SC,STHeiti,sans-serif; font-size: 75%">
|
|
11
|
+
|
|
12
|
+
<div id="content">
|
|
13
|
+
<div id="main-frame-error" class="interstitial-wrapper ">
|
|
14
|
+
<div id="main-content">
|
|
15
|
+
<div class="icon icon-generic"></div>
|
|
16
|
+
<div id="main-message">
|
|
17
|
+
<h1>
|
|
18
|
+
<span>无法访问此网站</span>
|
|
19
|
+
</h1>
|
|
20
|
+
<p>检查 <span id="domain_span"><%-host%></span> 中是否有拼写错误。</p>
|
|
21
|
+
<div class="error-code" style="text-transform: none;"><%-errorInfo%></div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<script>
|
|
27
|
+
setTimeout(function () {
|
|
28
|
+
document.getElementById('domain_span').innerHTML = location.host
|
|
29
|
+
}, 10)
|
|
30
|
+
</script>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
33
|
+
|
|
34
|
+
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "midway-fatcms",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.10",
|
|
4
4
|
"description": "This is a midway component sample",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -17,8 +17,12 @@
|
|
|
17
17
|
"dist/**/*.txt",
|
|
18
18
|
"dist/**/*.js",
|
|
19
19
|
"dist/**/*.d.ts",
|
|
20
|
+
"dist/**/*.html",
|
|
21
|
+
"dist/**/*.ico",
|
|
20
22
|
"src/**/*.ts",
|
|
21
23
|
"src/**/*.txt",
|
|
24
|
+
"src/**/*.html",
|
|
25
|
+
"src/**/*.ico",
|
|
22
26
|
"index.d.ts"
|
|
23
27
|
],
|
|
24
28
|
"license": "MIT",
|