midway-fatcms 0.0.1-beta.24 → 0.0.1-beta.26
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/models/RedisKeys.d.ts +1 -0
- package/dist/models/RedisKeys.js +2 -1
- package/dist/service/EnumInfoService.js +2 -1
- package/dist/service/anyapi/AnyApiSandboxService.js +12 -12
- package/dist/service/asyncTask/AsyncTaskRunnerService.js +3 -3
- package/dist/service/asyncTask/handler/ExportExcelAsyncTaskHandler.js +36 -17
- package/package.json +1 -1
- package/src/models/AsyncTaskModel.ts +82 -82
- package/src/models/RedisKeys.ts +2 -1
- package/src/service/AuthService.ts +272 -275
- package/src/service/EnumInfoService.ts +5 -4
- package/src/service/FileCenterService.ts +4 -4
- package/src/service/anyapi/AnyApiSandboxService.ts +121 -121
- package/src/service/anyapi/AnyApiService.ts +186 -187
- package/src/service/asyncTask/AsyncTaskRunnerService.ts +3 -3
- package/src/service/asyncTask/handler/ExportExcelAsyncTaskHandler.ts +37 -16
|
@@ -1,275 +1,272 @@
|
|
|
1
|
-
import { Inject, Provide, Config } from '@midwayjs/core';
|
|
2
|
-
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL } from '
|
|
4
|
-
import { CurdMixService } from './curd/CurdMixService';
|
|
5
|
-
import * as md5 from 'md5';
|
|
6
|
-
import { UserAccountService } from './UserAccountService';
|
|
7
|
-
import { createUniqueId } from '
|
|
8
|
-
import { IConsumerUserInfo, ISessionInfo, SYS_ACCOUNT_TYPE } from '
|
|
9
|
-
import { SystemTables } from '
|
|
10
|
-
import { UserSessionService } from './UserSessionService';
|
|
11
|
-
import { CommonResult } from '
|
|
12
|
-
import { isEnableSuperAdmin } from
|
|
13
|
-
import { CommonException } from
|
|
14
|
-
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
15
|
-
|
|
16
|
-
@Provide()
|
|
17
|
-
export class AuthService {
|
|
18
|
-
@Inject()
|
|
19
|
-
private ctx: Context;
|
|
20
|
-
|
|
21
|
-
@Config('superAdminList')
|
|
22
|
-
private superAdminList: any[];
|
|
23
|
-
|
|
24
|
-
@Inject()
|
|
25
|
-
private curdMixService: CurdMixService;
|
|
26
|
-
|
|
27
|
-
@Inject()
|
|
28
|
-
private userService: UserAccountService;
|
|
29
|
-
|
|
30
|
-
@Inject()
|
|
31
|
-
private userSessionService: UserSessionService;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 明文密码转unsaltedPwd密码
|
|
35
|
-
* @param plainPwd
|
|
36
|
-
* @param loginName
|
|
37
|
-
*/
|
|
38
|
-
public toUnsaltedPwd(plainPwd: string, loginName: string) {
|
|
39
|
-
const pw2 = md5(md5(plainPwd) + '_' + loginName);
|
|
40
|
-
return pw2;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* front: pw1 = md5(md5(input_pw) + "_" + loginName)
|
|
45
|
-
* db: pw2 = md5(pwd_salt + pw1)
|
|
46
|
-
* 检查用户名密码是否正确
|
|
47
|
-
* @param loginName
|
|
48
|
-
* @param unsaltedPwd
|
|
49
|
-
*/
|
|
50
|
-
public async checkLoginPassword(loginName: string, unsaltedPwd: string): Promise<CommonResult> {
|
|
51
|
-
const message = '用户名或密码错误';
|
|
52
|
-
const errorCode = 'USERNAME_OR_PASSWORD_IS_INCORRECT';
|
|
53
|
-
|
|
54
|
-
if (!loginName) {
|
|
55
|
-
return CommonResult.errorRes(message, errorCode, '!loginName');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!unsaltedPwd) {
|
|
59
|
-
return CommonResult.errorRes(message, errorCode, '!unsaltedPwd');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const userAccount = await this.queryUserAccountByLoginName(loginName);
|
|
63
|
-
if (!userAccount) {
|
|
64
|
-
return CommonResult.errorRes(message, errorCode, '!userAccount');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (userAccount.status !== 1) {
|
|
68
|
-
return CommonResult.errorRes(message, errorCode, 'userAccount.status !== 1');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!userAccount.pwd_md5) {
|
|
72
|
-
return CommonResult.errorRes(message, errorCode, '!userAccount.pwd_md5');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const pwd_salt = userAccount.pwd_salt;
|
|
76
|
-
const pwd_md5 = md5(unsaltedPwd + pwd_salt);
|
|
77
|
-
|
|
78
|
-
if (userAccount['pwd_md5'] !== pwd_md5) {
|
|
79
|
-
return CommonResult.errorRes(message, errorCode, "userAccount['pwd_md5'] !== pwd_md5");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return CommonResult.successRes();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
*
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return newSessionInfo;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
1
|
+
import { Inject, Provide, Config } from '@midwayjs/core';
|
|
2
|
+
import { Context } from '@midwayjs/koa';
|
|
3
|
+
import { KeysOfSimpleSQL } from '@/libs/crud-pro/models/keys';
|
|
4
|
+
import { CurdMixService } from './curd/CurdMixService';
|
|
5
|
+
import * as md5 from 'md5';
|
|
6
|
+
import { UserAccountService } from './UserAccountService';
|
|
7
|
+
import { createUniqueId } from '@/libs/utils/functions';
|
|
8
|
+
import { IConsumerUserInfo, ISessionInfo, SYS_ACCOUNT_TYPE } from '@/models/userSession';
|
|
9
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
10
|
+
import { UserSessionService } from './UserSessionService';
|
|
11
|
+
import { CommonResult } from '@/libs/utils/common-dto';
|
|
12
|
+
import { isEnableSuperAdmin } from '@/libs/utils/fatcms-request';
|
|
13
|
+
import { CommonException } from '@/libs/crud-pro/exceptions';
|
|
14
|
+
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
15
|
+
|
|
16
|
+
@Provide()
|
|
17
|
+
export class AuthService {
|
|
18
|
+
@Inject()
|
|
19
|
+
private ctx: Context;
|
|
20
|
+
|
|
21
|
+
@Config('superAdminList')
|
|
22
|
+
private superAdminList: any[];
|
|
23
|
+
|
|
24
|
+
@Inject()
|
|
25
|
+
private curdMixService: CurdMixService;
|
|
26
|
+
|
|
27
|
+
@Inject()
|
|
28
|
+
private userService: UserAccountService;
|
|
29
|
+
|
|
30
|
+
@Inject()
|
|
31
|
+
private userSessionService: UserSessionService;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 明文密码转unsaltedPwd密码
|
|
35
|
+
* @param plainPwd
|
|
36
|
+
* @param loginName
|
|
37
|
+
*/
|
|
38
|
+
public toUnsaltedPwd(plainPwd: string, loginName: string) {
|
|
39
|
+
const pw2 = md5(md5(plainPwd) + '_' + loginName);
|
|
40
|
+
return pw2;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* front: pw1 = md5(md5(input_pw) + "_" + loginName)
|
|
45
|
+
* db: pw2 = md5(pwd_salt + pw1)
|
|
46
|
+
* 检查用户名密码是否正确
|
|
47
|
+
* @param loginName
|
|
48
|
+
* @param unsaltedPwd
|
|
49
|
+
*/
|
|
50
|
+
public async checkLoginPassword(loginName: string, unsaltedPwd: string): Promise<CommonResult> {
|
|
51
|
+
const message = '用户名或密码错误';
|
|
52
|
+
const errorCode = 'USERNAME_OR_PASSWORD_IS_INCORRECT';
|
|
53
|
+
|
|
54
|
+
if (!loginName) {
|
|
55
|
+
return CommonResult.errorRes(message, errorCode, '!loginName');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!unsaltedPwd) {
|
|
59
|
+
return CommonResult.errorRes(message, errorCode, '!unsaltedPwd');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const userAccount = await this.queryUserAccountByLoginName(loginName);
|
|
63
|
+
if (!userAccount) {
|
|
64
|
+
return CommonResult.errorRes(message, errorCode, '!userAccount');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (userAccount.status !== 1) {
|
|
68
|
+
return CommonResult.errorRes(message, errorCode, 'userAccount.status !== 1');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!userAccount.pwd_md5) {
|
|
72
|
+
return CommonResult.errorRes(message, errorCode, '!userAccount.pwd_md5');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const pwd_salt = userAccount.pwd_salt;
|
|
76
|
+
const pwd_md5 = md5(unsaltedPwd + pwd_salt);
|
|
77
|
+
|
|
78
|
+
if (userAccount['pwd_md5'] !== pwd_md5) {
|
|
79
|
+
return CommonResult.errorRes(message, errorCode, "userAccount['pwd_md5'] !== pwd_md5");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return CommonResult.successRes();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 创建一个toC端的UserSession
|
|
87
|
+
* @param consumerUserInfo
|
|
88
|
+
*/
|
|
89
|
+
public async createUserSessionForConsumer(consumerUserInfo: IConsumerUserInfo) {
|
|
90
|
+
const sessionId = createUniqueId();
|
|
91
|
+
|
|
92
|
+
const sessionInfo: ISessionInfo = {
|
|
93
|
+
nickName: consumerUserInfo.nickName,
|
|
94
|
+
avatar: consumerUserInfo.avatar,
|
|
95
|
+
roleCodes: [],
|
|
96
|
+
functionCodes: [],
|
|
97
|
+
loginName: consumerUserInfo.loginName,
|
|
98
|
+
sessionId,
|
|
99
|
+
accountId: consumerUserInfo.accountId,
|
|
100
|
+
workbenchCode: consumerUserInfo.workbenchCode,
|
|
101
|
+
accountType: consumerUserInfo.accountType,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
await this.userSessionService.saveUserSession(sessionInfo);
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
sessionId,
|
|
108
|
+
loginName: sessionInfo.loginName,
|
|
109
|
+
accountId: sessionInfo.accountId,
|
|
110
|
+
nickName: sessionInfo.nickName,
|
|
111
|
+
avatar: sessionInfo.avatar,
|
|
112
|
+
workbenchCode: sessionInfo.workbenchCode,
|
|
113
|
+
accountType: sessionInfo.accountType,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 创建一个Session
|
|
119
|
+
* @param loginName
|
|
120
|
+
* @param workbenchCode
|
|
121
|
+
*/
|
|
122
|
+
public async createUserSession(loginName: string, workbenchCode: string) {
|
|
123
|
+
const userAccount = await this.queryUserAccountByLoginName(loginName);
|
|
124
|
+
|
|
125
|
+
if (!userAccount) {
|
|
126
|
+
throw new CommonException('USER_ACCOUNT_NOT_EXIST', '用户账号不存在');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const accountId = userAccount.account_id;
|
|
130
|
+
const sessionId = createUniqueId();
|
|
131
|
+
const roleCodes = await this.queryUserRoleCodeList(accountId);
|
|
132
|
+
const functionCodes = await this.queryFunctionCodeList(roleCodes);
|
|
133
|
+
|
|
134
|
+
const sessionInfo: ISessionInfo = {
|
|
135
|
+
nickName: userAccount.nick_name,
|
|
136
|
+
avatar: userAccount.avatar,
|
|
137
|
+
roleCodes,
|
|
138
|
+
functionCodes,
|
|
139
|
+
loginName,
|
|
140
|
+
sessionId,
|
|
141
|
+
accountId,
|
|
142
|
+
workbenchCode,
|
|
143
|
+
accountType: SYS_ACCOUNT_TYPE,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
await this.userSessionService.saveUserSession(sessionInfo);
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
sessionId,
|
|
150
|
+
loginName,
|
|
151
|
+
accountId,
|
|
152
|
+
nickName: userAccount.nick_name,
|
|
153
|
+
avatar: userAccount.avatar,
|
|
154
|
+
workbenchCode: sessionInfo.workbenchCode,
|
|
155
|
+
accountType: sessionInfo.accountType,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 获取用户
|
|
161
|
+
* @param loginName
|
|
162
|
+
* @private
|
|
163
|
+
*/
|
|
164
|
+
private async queryUserAccountByLoginName(loginName: string) {
|
|
165
|
+
const superAdminList = this.superAdminList;
|
|
166
|
+
const findFromSuperAdmin = () => {
|
|
167
|
+
if (!isEnableSuperAdmin(this.ctx)) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!Array.isArray(superAdminList)) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
for (let i = 0; i < superAdminList.length; i++) {
|
|
176
|
+
const element = superAdminList[i];
|
|
177
|
+
if (element && element.login_name === loginName) {
|
|
178
|
+
const nick_name = 'SA' + i;
|
|
179
|
+
return {
|
|
180
|
+
nick_name: element.nick_name || nick_name,
|
|
181
|
+
avatar: '',
|
|
182
|
+
account_id: nick_name,
|
|
183
|
+
status: 1,
|
|
184
|
+
login_name: element.login_name,
|
|
185
|
+
pwd_salt: element.pwd_salt,
|
|
186
|
+
pwd_md5: element.pwd_md5,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const superAdmin = findFromSuperAdmin();
|
|
192
|
+
if (superAdmin) {
|
|
193
|
+
return superAdmin;
|
|
194
|
+
}
|
|
195
|
+
return this.userService.queryUserAccountByLoginName(loginName);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 查询此accountId下关联的角色code列表
|
|
200
|
+
* @param accountId
|
|
201
|
+
* @private
|
|
202
|
+
*/
|
|
203
|
+
private async queryUserRoleCodeList(accountId: string): Promise<string[]> {
|
|
204
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
205
|
+
|
|
206
|
+
const res = await this.curdMixService.executeCrudByCfg(
|
|
207
|
+
{
|
|
208
|
+
condition: { account_id: accountId },
|
|
209
|
+
limit: 10000,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
sqlTable: SystemTables.sys_perm_user_role,
|
|
213
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
214
|
+
sqlDatabase: SystemDbName,
|
|
215
|
+
sqlDbType: SystemDbType,
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
const rows = res.getResModel().rows || [];
|
|
219
|
+
const roleCodes: string[] = rows.map(({ role_code }) => {
|
|
220
|
+
return role_code as string;
|
|
221
|
+
});
|
|
222
|
+
return [...new Set(roleCodes)];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* 查询此roleCodeList下面关联的所有功能点列表
|
|
227
|
+
* @param roleCodeList
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
private async queryFunctionCodeList(roleCodeList: string[]): Promise<string[]> {
|
|
231
|
+
if (!roleCodeList || roleCodeList.length === 0) {
|
|
232
|
+
return [];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
|
|
236
|
+
|
|
237
|
+
const res = await this.curdMixService.executeCrudByCfg(
|
|
238
|
+
{
|
|
239
|
+
condition: { role_code: { $in: roleCodeList } },
|
|
240
|
+
limit: 10000,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
sqlTable: SystemTables.sys_perm_role_func,
|
|
244
|
+
sqlSimpleName: KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
245
|
+
sqlDatabase: SystemDbName,
|
|
246
|
+
sqlDbType: SystemDbType,
|
|
247
|
+
}
|
|
248
|
+
);
|
|
249
|
+
const rows = res.getResModel().rows || [];
|
|
250
|
+
const funcCodes: string[] = rows.map(({ func_code }) => {
|
|
251
|
+
return func_code;
|
|
252
|
+
});
|
|
253
|
+
return [...new Set(funcCodes)];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async removeUserSession(sessionId: string) {
|
|
257
|
+
return this.userSessionService.removeUserSession(sessionId);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async refreshSession(sessionInfo: ISessionInfo): Promise<ISessionInfo> {
|
|
261
|
+
const oldSessionId = sessionInfo.sessionId;
|
|
262
|
+
|
|
263
|
+
const sessionId = createUniqueId();
|
|
264
|
+
const newSessionInfo: ISessionInfo = { ...sessionInfo, sessionId };
|
|
265
|
+
|
|
266
|
+
await this.userSessionService.saveUserSession(newSessionInfo);
|
|
267
|
+
|
|
268
|
+
await this.removeUserSession(oldSessionId);
|
|
269
|
+
|
|
270
|
+
return newSessionInfo;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Inject, Provide } from '@midwayjs/core';
|
|
2
2
|
import { Context } from '@midwayjs/koa';
|
|
3
|
-
import { KeysOfSimpleSQL } from '
|
|
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 { SystemTables } from '
|
|
7
|
-
import { parseConfigContentToEnumInfo, IEnumInfo } from '
|
|
6
|
+
import { SystemTables } from '@/models/SystemTables';
|
|
7
|
+
import { parseConfigContentToEnumInfo, IEnumInfo } from '@/libs/utils/parseConfig';
|
|
8
8
|
import { RedisCacheService } from './base/RedisCacheService';
|
|
9
9
|
import { CurdMixByLinkToCustomService } from './curd/CurdMixByLinkToCustomService';
|
|
10
10
|
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
11
|
+
import { RedisKeys } from '@/models/RedisKeys';
|
|
11
12
|
|
|
12
13
|
interface IQueryEnumInfo {
|
|
13
14
|
type: RelatedType;
|
|
@@ -42,7 +43,7 @@ export class EnumInfoService {
|
|
|
42
43
|
const result = [];
|
|
43
44
|
for (let i = 0; i < codeList.length; i++) {
|
|
44
45
|
const { code, type } = codeList[i];
|
|
45
|
-
const cacheKey =
|
|
46
|
+
const cacheKey = `${RedisKeys.QUERY_ENUM_INFO_PREFIX}${type}@@${code}`;
|
|
46
47
|
const emums = refreshCache ? null : await this.redisCacheService.getJsonObject(cacheKey);
|
|
47
48
|
if (!Array.isArray(emums) || emums.length === 0) {
|
|
48
49
|
let values;
|
|
@@ -4,11 +4,11 @@ import * as mime from 'mime-types';
|
|
|
4
4
|
import * as md5 from 'md5';
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import * as util from 'util';
|
|
7
|
-
import { BizException } from '
|
|
7
|
+
import { BizException } from '@/models/devops';
|
|
8
8
|
import { CurdMixService } from './curd/CurdMixService';
|
|
9
|
-
import { KeysOfSimpleSQL, KeysOfValidators } from '
|
|
10
|
-
import { AccessType, IEntityCommonInfo, UploadCategoryType } from '
|
|
11
|
-
import { IRequestCfgModel } from '
|
|
9
|
+
import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
|
|
10
|
+
import { AccessType, IEntityCommonInfo, UploadCategoryType } from '@/models/bizmodels';
|
|
11
|
+
import { IRequestCfgModel } from '@/libs/crud-pro/interfaces';
|
|
12
12
|
import { BaseService } from './base/BaseService';
|
|
13
13
|
import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
|
|
14
14
|
|