midway-fatcms 0.0.1-beta.6 → 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/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/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/controller/base/BaseApiController.ts +13 -13
- package/src/controller/gateway/DocGatewayController.ts +9 -1
- package/src/controller/home.controller.ts +4 -6
- 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
|
@@ -5,12 +5,13 @@ import { CurdMixService } from './curd/CurdMixService';
|
|
|
5
5
|
import * as md5 from 'md5';
|
|
6
6
|
import { UserAccountService } from './UserAccountService';
|
|
7
7
|
import { createUniqueId } from '../libs/utils/functions';
|
|
8
|
-
import {IConsumerUserInfo, ISessionInfo, SYS_ACCOUNT_TYPE} from '../models/userSession';
|
|
9
|
-
import {
|
|
8
|
+
import { IConsumerUserInfo, ISessionInfo, SYS_ACCOUNT_TYPE } from '../models/userSession';
|
|
9
|
+
import { SystemTables } from '../models/SystemTables';
|
|
10
10
|
import { UserSessionService } from './UserSessionService';
|
|
11
11
|
import { CommonResult } from '../libs/utils/common-dto';
|
|
12
12
|
import { isEnableSuperAdmin } from "../libs/utils/fatcms-request";
|
|
13
|
-
import {CommonException} from "../libs/crud-pro/exceptions";
|
|
13
|
+
import { CommonException } from "../libs/crud-pro/exceptions";
|
|
14
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
15
|
|
|
15
16
|
@Provide()
|
|
16
17
|
export class AuthService {
|
|
@@ -94,7 +95,7 @@ export class AuthService {
|
|
|
94
95
|
nickName: consumerUserInfo.nickName,
|
|
95
96
|
avatar: consumerUserInfo.avatar,
|
|
96
97
|
roleCodes: [],
|
|
97
|
-
functionCodes:[],
|
|
98
|
+
functionCodes: [],
|
|
98
99
|
loginName: consumerUserInfo.loginName,
|
|
99
100
|
sessionId,
|
|
100
101
|
accountId: consumerUserInfo.accountId,
|
|
@@ -203,6 +204,8 @@ export class AuthService {
|
|
|
203
204
|
* @private
|
|
204
205
|
*/
|
|
205
206
|
private async queryUserRoleCodeList(accountId: string): Promise<string[]> {
|
|
207
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
208
|
+
|
|
206
209
|
const res = await this.curdMixService.executeCrudByCfg(
|
|
207
210
|
{
|
|
208
211
|
condition: { account_id: accountId },
|
|
@@ -232,6 +235,8 @@ export class AuthService {
|
|
|
232
235
|
return [];
|
|
233
236
|
}
|
|
234
237
|
|
|
238
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
239
|
+
|
|
235
240
|
const res = await this.curdMixService.executeCrudByCfg(
|
|
236
241
|
{
|
|
237
242
|
condition: { role_code: { $in: roleCodeList } },
|
|
@@ -259,7 +264,7 @@ export class AuthService {
|
|
|
259
264
|
const oldSessionId = sessionInfo.sessionId;
|
|
260
265
|
|
|
261
266
|
const sessionId = createUniqueId();
|
|
262
|
-
const newSessionInfo: ISessionInfo = {...sessionInfo, sessionId};
|
|
267
|
+
const newSessionInfo: ISessionInfo = { ...sessionInfo, sessionId };
|
|
263
268
|
|
|
264
269
|
await this.userSessionService.saveUserSession(newSessionInfo);
|
|
265
270
|
|
|
@@ -3,10 +3,11 @@ import {Context} from '@midwayjs/koa';
|
|
|
3
3
|
import {KeysOfSimpleSQL} from '../libs/crud-pro/models/keys';
|
|
4
4
|
import {CurdProService} from './curd/CurdProService';
|
|
5
5
|
import {RelatedType} from './curd/CurdMixUtils';
|
|
6
|
-
import {
|
|
6
|
+
import {SystemTables} from '../models/SystemTables';
|
|
7
7
|
import {parseConfigContentToEnumInfo, IEnumInfo} from '../libs/utils/parseConfig';
|
|
8
8
|
import {RedisCacheService} from "./base/RedisCacheService";
|
|
9
9
|
import {CurdMixByLinkToCustomService} from "./curd/CurdMixByLinkToCustomService";
|
|
10
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
interface IQueryEnumInfo {
|
|
@@ -88,6 +89,8 @@ export class EnumInfoService {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
private async queryEnumInfoBySysCfgEnum(code: string): Promise<IEnumInfo[]> {
|
|
92
|
+
const {SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
93
|
+
|
|
91
94
|
const res1 = await this.curdProService.executeCrudByCfg(
|
|
92
95
|
{
|
|
93
96
|
condition: { config_code: code },
|
|
@@ -109,6 +112,8 @@ export class EnumInfoService {
|
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
private async queryEnumInfoItemByDict(code: string): Promise<IEnumInfo[]> {
|
|
115
|
+
const {SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
116
|
+
|
|
112
117
|
const res1 = await this.curdProService.executeCrudByCfg(
|
|
113
118
|
{
|
|
114
119
|
condition: { dict_code: code },
|
|
@@ -10,7 +10,7 @@ import { KeysOfSimpleSQL, KeysOfValidators } from '../libs/crud-pro/models/keys'
|
|
|
10
10
|
import { AccessType, IEntityCommonInfo, UploadCategoryType } from '../models/bizmodels';
|
|
11
11
|
import { IRequestCfgModel } from '../libs/crud-pro/interfaces';
|
|
12
12
|
import { BaseService } from './base/BaseService';
|
|
13
|
-
import {
|
|
13
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
14
|
|
|
15
15
|
function getSuffix(s: string): string {
|
|
16
16
|
if (s) {
|
|
@@ -107,6 +107,8 @@ class FileDB {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
async getFileInfo(fileKey: string): Promise<IFileInfo> {
|
|
110
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
111
|
+
|
|
110
112
|
const condition: any = { file_key: fileKey };
|
|
111
113
|
const cfgModel: IRequestCfgModel = {
|
|
112
114
|
sqlTable: 'sys_file',
|
|
@@ -123,6 +125,8 @@ class FileDB {
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
async saveFileInfo(fileInfo: IFileInfo) {
|
|
128
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
129
|
+
|
|
126
130
|
const cfgModel = {
|
|
127
131
|
sqlTable: 'sys_file',
|
|
128
132
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
@@ -141,6 +145,7 @@ class FileDB {
|
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
async saveAssetsLog(fileInfo: IFileInfo) {
|
|
148
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
144
149
|
const cfgModel = {
|
|
145
150
|
sqlTable: 'sys_assets_log',
|
|
146
151
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
@@ -151,6 +156,7 @@ class FileDB {
|
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
async deleteFileInfo(id: number) {
|
|
159
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
154
160
|
const cfgModel: IRequestCfgModel = {
|
|
155
161
|
sqlTable: 'sys_file',
|
|
156
162
|
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_DELETE,
|
|
@@ -200,7 +206,7 @@ function toUploadOriginByReferer(referer: string): string {
|
|
|
200
206
|
return 'doc-editor';
|
|
201
207
|
}
|
|
202
208
|
if (pathname.startsWith('/pages/devops/file-manage')) {
|
|
203
|
-
return
|
|
209
|
+
return 'file-manage';
|
|
204
210
|
}
|
|
205
211
|
} catch (error) {
|
|
206
212
|
console.error('toUploadOriginByReferer', error);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL} from "../libs/crud-pro/models/keys";
|
|
4
|
-
import {
|
|
5
|
-
import {BaseService} from "./base/BaseService";
|
|
6
|
-
import {CurdProService} from "./curd/CurdProService";
|
|
3
|
+
import { KeysOfSimpleSQL } from "../libs/crud-pro/models/keys";
|
|
4
|
+
import { SystemTables } from "../models/SystemTables";
|
|
5
|
+
import { BaseService } from "./base/BaseService";
|
|
6
|
+
import { CurdProService } from "./curd/CurdProService";
|
|
7
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
7
8
|
|
|
8
9
|
@Provide()
|
|
9
10
|
export class SysConfigService extends BaseService {
|
|
@@ -14,9 +15,12 @@ export class SysConfigService extends BaseService {
|
|
|
14
15
|
private curdProService: CurdProService;
|
|
15
16
|
|
|
16
17
|
async getSysConfigOne(config_code: string): Promise<any> {
|
|
17
|
-
if (!config_code){
|
|
18
|
+
if (!config_code) {
|
|
18
19
|
throw new Error('[getSysConfigOne] config_code required');
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
23
|
+
|
|
20
24
|
const res1 = await this.curdProService.executeCrudByCfg(
|
|
21
25
|
{
|
|
22
26
|
condition: { config_code },
|
|
@@ -6,8 +6,9 @@ import { CurdMixService } from './curd/CurdMixService';
|
|
|
6
6
|
import { createUniqueId } from '../libs/utils/functions';
|
|
7
7
|
import { CommonException, Exceptions } from '../libs/crud-pro/exceptions';
|
|
8
8
|
import { IRequestCfgModel, IRequestModel } from '../libs/crud-pro/interfaces';
|
|
9
|
-
import {
|
|
9
|
+
import {SystemTables} from '../models/SystemTables';
|
|
10
10
|
import { CommonResult } from '../libs/utils/common-dto';
|
|
11
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
11
12
|
|
|
12
13
|
@Provide()
|
|
13
14
|
export class UserAccountService {
|
|
@@ -21,6 +22,9 @@ export class UserAccountService {
|
|
|
21
22
|
* @param loginName
|
|
22
23
|
*/
|
|
23
24
|
public async queryUserAccountByLoginName(loginName: string) {
|
|
25
|
+
|
|
26
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
27
|
+
|
|
24
28
|
const query = await this.curdMixService.executeCrudByCfg(
|
|
25
29
|
{
|
|
26
30
|
condition: { login_name: loginName },
|
|
@@ -47,6 +51,9 @@ export class UserAccountService {
|
|
|
47
51
|
return [];
|
|
48
52
|
}
|
|
49
53
|
|
|
54
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
55
|
+
|
|
56
|
+
|
|
50
57
|
const accountIds = accountIdList.map(userId => {
|
|
51
58
|
return `${userId}`;
|
|
52
59
|
});
|
|
@@ -81,6 +88,9 @@ export class UserAccountService {
|
|
|
81
88
|
if (!loginName) {
|
|
82
89
|
throw new CommonException(Exceptions.OTHER_EXCEPTION, 'loginName不存在');
|
|
83
90
|
}
|
|
91
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
92
|
+
|
|
93
|
+
|
|
84
94
|
const pwd_salt = createUniqueId();
|
|
85
95
|
const pwd_md5 = md5(unsaltedPwd + pwd_salt);
|
|
86
96
|
const res1 = await this.curdMixService.executeCrudByCfg(
|
|
@@ -3,10 +3,11 @@ import {Context} from '@midwayjs/koa';
|
|
|
3
3
|
import {IScheduleService} from '../interface';
|
|
4
4
|
import {BaseService} from "./base/BaseService";
|
|
5
5
|
import {CurdProService} from "./curd/CurdProService";
|
|
6
|
-
import {
|
|
6
|
+
import { SystemTables} from "../models/SystemTables";
|
|
7
7
|
import {KeysOfSimpleSQL} from "../libs/crud-pro/models/keys";
|
|
8
8
|
import {FILE_GET_TYPES} from "../models/bizmodels";
|
|
9
9
|
import {CommonResult} from "../libs/utils/common-dto";
|
|
10
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
// 3天 的秒数
|
|
@@ -35,6 +36,9 @@ export class VisitStatService extends BaseService implements IScheduleService {
|
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
async flushVisitStatToDB(): Promise<any> {
|
|
39
|
+
|
|
40
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
41
|
+
|
|
38
42
|
// 统计昨天的数据。
|
|
39
43
|
const stat_date = new Date(Date.now() - 24 * 3600 * 1000).toISOString().split('T')[0];
|
|
40
44
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
3
|
import { KeysOfSimpleSQL } from '../libs/crud-pro/models/keys';
|
|
4
|
-
import {
|
|
4
|
+
import { SystemTables} from '../models/SystemTables';
|
|
5
5
|
import { BaseService } from './base/BaseService';
|
|
6
6
|
// import { LRUCache } from 'lru-cache';
|
|
7
7
|
import { CurdProService } from './curd/CurdProService';
|
|
@@ -11,6 +11,7 @@ import { IWorkbenchEntity } from '../models/SystemEntities';
|
|
|
11
11
|
import { IScheduleService } from '../interface';
|
|
12
12
|
import { getDebugWorkbenchCode } from '../libs/utils/fatcms-request';
|
|
13
13
|
import { MixinUtils } from '../libs/crud-pro/utils/MixinUtils';
|
|
14
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
15
|
//
|
|
15
16
|
// const lruCache = new LRUCache<string, any>({
|
|
16
17
|
// max: 500,
|
|
@@ -42,6 +43,10 @@ export class WorkbenchService extends BaseService implements IScheduleService {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
public async getAllWorkbenchInfoList(isForceRefresh?: boolean): Promise<IWorkbenchEntity[]> {
|
|
46
|
+
|
|
47
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
48
|
+
|
|
49
|
+
|
|
45
50
|
let listData = lruCache.get(CACHE_KEY_WORKBENCH_LIST);
|
|
46
51
|
if (!listData || isForceRefresh === true) {
|
|
47
52
|
const reqJson = { condition: {}, pageSize: 1000, limit: 1000 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
3
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
4
|
-
import {
|
|
4
|
+
import { SystemTables} from '../../models/SystemTables';
|
|
5
5
|
import { LRUCache } from 'lru-cache';
|
|
6
6
|
import { BizException } from '../../models/devops';
|
|
7
7
|
import { CurdMixService } from '../curd/CurdMixService';
|
|
@@ -13,6 +13,7 @@ import { MixinUtils } from '../../libs/crud-pro/utils/MixinUtils';
|
|
|
13
13
|
import { WorkbenchService } from '../WorkbenchService';
|
|
14
14
|
import { validateByCfgString } from '../../libs/crud-pro/utils/ValidateUtils';
|
|
15
15
|
import { API_BASE_TYPE, ApiBaseService } from '../base/ApiBaseService';
|
|
16
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
16
17
|
|
|
17
18
|
const lruCache = new LRUCache<string, any>({
|
|
18
19
|
max: 500,
|
|
@@ -80,6 +81,10 @@ export class AnyApiService extends ApiBaseService {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
private async _getAnyApiMethod(methodCode: string): Promise<ISysAnyApiEntity> {
|
|
84
|
+
|
|
85
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
86
|
+
|
|
87
|
+
|
|
83
88
|
const res = await this.curdMixService.executeCrudByCfg(
|
|
84
89
|
{ condition: { method: methodCode } },
|
|
85
90
|
{
|
|
@@ -7,12 +7,13 @@ import { parseJsonObject } from '../../libs/utils/functions';
|
|
|
7
7
|
import { ICrudStdAppInfo, ICrudStdAppInfoForSettingKey } from '../../models/bizmodels';
|
|
8
8
|
import { BizException } from '../../models/devops';
|
|
9
9
|
import { ExecuteContext } from '../../libs/crud-pro/models/ExecuteContext';
|
|
10
|
-
import {
|
|
10
|
+
import { SystemTables} from '../../models/SystemTables';
|
|
11
11
|
import { CrudStdActionService } from './CrudStdActionService';
|
|
12
12
|
import { CrudStdRelationService } from './CrudStdRelationService';
|
|
13
13
|
import * as _ from 'lodash';
|
|
14
14
|
import { ApiBaseService } from '../base/ApiBaseService';
|
|
15
15
|
import {parseDatabaseName} from "../../libs/crud-pro/utils/DatabaseName";
|
|
16
|
+
import { GLOBAL_STATIC_CONFIG } from '../../libs/global-config/global-config';
|
|
16
17
|
|
|
17
18
|
export const SPECIAL_SETTING_KEY = {
|
|
18
19
|
QUERY_LIST: 'QUERY_LIST',
|
|
@@ -67,6 +68,10 @@ export class CrudStdService extends ApiBaseService {
|
|
|
67
68
|
|
|
68
69
|
// 根据用户配置,设置关联查询的数据信息。
|
|
69
70
|
await this.crudStdRelationService.addCfgModelColumnsRelation(cfgModel, appInfo);
|
|
71
|
+
|
|
72
|
+
// 业务系统自定义的修改cfgModel
|
|
73
|
+
await GLOBAL_STATIC_CONFIG.getConfig().addCfgModelForCrudStdService(cfgModel, appInfo);
|
|
74
|
+
|
|
70
75
|
return await this.curdMixService.executeCrudByCfg(params, cfgModel);
|
|
71
76
|
}
|
|
72
77
|
|
|
@@ -133,6 +138,11 @@ export class CrudStdService extends ApiBaseService {
|
|
|
133
138
|
* @private
|
|
134
139
|
*/
|
|
135
140
|
private async getCrudStdAppInfo(appCode?: string) {
|
|
141
|
+
|
|
142
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
136
146
|
this.logInfo('getCrudStdAppInfo', appCode);
|
|
137
147
|
|
|
138
148
|
const ss = {
|
|
@@ -4,10 +4,11 @@ import * as _ from 'lodash';
|
|
|
4
4
|
import { CurdProService } from './CurdProService';
|
|
5
5
|
import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
|
|
6
6
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
7
|
-
import {
|
|
7
|
+
import { SystemTables} from '../../models/SystemTables';
|
|
8
8
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
9
9
|
import { ColumnRelation, IRequestCfgModel, IRequestModel } from '../../libs/crud-pro/interfaces';
|
|
10
10
|
import { MixinUtils } from '../../libs/crud-pro/utils/MixinUtils';
|
|
11
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
11
12
|
|
|
12
13
|
const dictMixUtils = new CrudMixUtils(RelatedType.accountBasic);
|
|
13
14
|
|
|
@@ -22,6 +23,10 @@ export class CurdMixByAccountService implements IExecuteContextHandler {
|
|
|
22
23
|
protected curdProService: CurdProService;
|
|
23
24
|
|
|
24
25
|
async handleExecuteContextPrepare(executeContext: ExecuteContext) {
|
|
26
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
25
30
|
const relations = dictMixUtils.pickColumnRelations(executeContext);
|
|
26
31
|
if (!relations || relations.length === 0) {
|
|
27
32
|
return;
|
|
@@ -3,12 +3,13 @@ import { Context } from '@midwayjs/koa';
|
|
|
3
3
|
import { CurdProService } from './CurdProService';
|
|
4
4
|
import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
|
|
5
5
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
6
|
-
import {
|
|
6
|
+
import { SystemTables} from '../../models/SystemTables';
|
|
7
7
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
8
8
|
import { MultiKeyMap } from '../../libs/crud-pro/utils/MultiKeyMap';
|
|
9
9
|
import { ColumnRelation } from '../../libs/crud-pro/interfaces';
|
|
10
10
|
import * as _ from 'lodash';
|
|
11
11
|
import {RedisCacheService} from "../base/RedisCacheService";
|
|
12
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
12
13
|
|
|
13
14
|
const TMP_CTX_KEY = _.uniqueId('CurdMixByDictService');
|
|
14
15
|
|
|
@@ -46,6 +47,11 @@ export class CurdMixByDictService implements IExecuteContextHandler {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
private async getDictItemRows(codes: string[]) {
|
|
50
|
+
|
|
51
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
49
55
|
const noCacheCodes: string[] = [];
|
|
50
56
|
|
|
51
57
|
// 从缓存里面取
|
|
@@ -4,11 +4,12 @@ import { CurdProService } from './CurdProService';
|
|
|
4
4
|
import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
|
|
5
5
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
6
6
|
import * as _ from 'lodash';
|
|
7
|
-
import {
|
|
7
|
+
import { SystemTables} from '../../models/SystemTables';
|
|
8
8
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
9
9
|
import { MultiKeyMap } from '../../libs/crud-pro/utils/MultiKeyMap';
|
|
10
10
|
import { ColumnRelation } from '../../libs/crud-pro/interfaces';
|
|
11
11
|
import { parseConfigContentToEnumInfo } from "../../libs/utils/parseConfig";
|
|
12
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
12
13
|
|
|
13
14
|
const dictMixUtils = new CrudMixUtils(RelatedType.sysCfgEnum);
|
|
14
15
|
|
|
@@ -25,6 +26,10 @@ export class CurdMixBySysConfigService implements IExecuteContextHandler {
|
|
|
25
26
|
protected curdProService: CurdProService;
|
|
26
27
|
|
|
27
28
|
async handleExecuteContextPrepare(executeContext: ExecuteContext) {
|
|
29
|
+
|
|
30
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
31
|
+
|
|
32
|
+
|
|
28
33
|
const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
|
|
29
34
|
if (!codes || codes.length === 0) {
|
|
30
35
|
return;
|
|
@@ -5,10 +5,11 @@ import { LRUCache } from 'lru-cache';
|
|
|
5
5
|
import { CurdProService } from './CurdProService';
|
|
6
6
|
import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
|
|
7
7
|
import { CrudMixUtils, RelatedType } from './CurdMixUtils';
|
|
8
|
-
import {
|
|
8
|
+
import { SystemTables } from '../../models/SystemTables';
|
|
9
9
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
10
10
|
import { ColumnRelation } from '../../libs/crud-pro/interfaces';
|
|
11
11
|
import { MixinUtils } from '../../libs/crud-pro/utils/MixinUtils';
|
|
12
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
12
13
|
|
|
13
14
|
const lruCache = new LRUCache<string, any>({
|
|
14
15
|
max: 500,
|
|
@@ -29,6 +30,9 @@ export class CurdMixByWorkbenchService implements IExecuteContextHandler {
|
|
|
29
30
|
protected curdProService: CurdProService;
|
|
30
31
|
|
|
31
32
|
private async loadWorkbenchListMap() {
|
|
33
|
+
|
|
34
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
35
|
+
|
|
32
36
|
let workbenchListMap = lruCache.get('workbenchListMap');
|
|
33
37
|
if (!workbenchListMap) {
|
|
34
38
|
const reqJson = {
|
|
@@ -5,7 +5,7 @@ import { BaseService } from '../base/BaseService';
|
|
|
5
5
|
import { getRouteTrie, RouteTrie } from './RouteTrie';
|
|
6
6
|
import { RouteHandler } from './RouteHandler';
|
|
7
7
|
import { CurdProService } from '../curd/CurdProService';
|
|
8
|
-
import {
|
|
8
|
+
import { SystemTables} from '../../models/SystemTables';
|
|
9
9
|
import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
|
|
10
10
|
import { IProxyApiEntity, IUpstreamInfo } from '../../models/SystemEntities';
|
|
11
11
|
import { parseJsonObject } from '../../libs/utils/functions';
|
|
@@ -15,6 +15,7 @@ import { WeightedRoundRobin } from './WeightedRoundRobin';
|
|
|
15
15
|
import { IScheduleService } from '../../interface';
|
|
16
16
|
import { WorkbenchService } from '../WorkbenchService';
|
|
17
17
|
import { CommonException } from '../../libs/crud-pro/exceptions';
|
|
18
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
18
19
|
|
|
19
20
|
function toUpstreamInfo(config_content: any): IUpstreamInfo {
|
|
20
21
|
const obj = parseJsonObject(config_content);
|
|
@@ -85,6 +86,9 @@ export class ProxyApiLoadService extends BaseService implements IScheduleService
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
private async buildUpstreamMap() {
|
|
89
|
+
|
|
90
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
91
|
+
|
|
88
92
|
// biz_tag={'upstream'}
|
|
89
93
|
const res = await this.curdProService.executeCrudByCfg(
|
|
90
94
|
{
|
|
@@ -110,6 +114,10 @@ export class ProxyApiLoadService extends BaseService implements IScheduleService
|
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
private async loadProxyApiEntity(workbench_code: string, upstreamMap: Record<string, IUpstreamInfo>): Promise<IProxyApiEntity[]> {
|
|
117
|
+
|
|
118
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
119
|
+
|
|
120
|
+
|
|
113
121
|
const res = await this.curdProService.executeCrudByCfg(
|
|
114
122
|
{
|
|
115
123
|
condition: {},
|