perf: 优化

This commit is contained in:
2025-02-17 11:46:12 +08:00
parent 0bf31c94b7
commit 0144f94edd
3 changed files with 7 additions and 3 deletions

View File

@@ -213,6 +213,7 @@ app
ctx.body = {
key: app.key,
version: app.version,
appManager: am
};
})
.addTo(app);

View File

@@ -167,8 +167,11 @@ app
if (!orgUser) {
ctx.throw('org user not found');
}
if (orgUser.type !== 'org') {
ctx.throw('change user is not org, please check');
if (orgUser.type === 'user') {
// 想转换的type===org, 但实际上这个用户名是一个用户, 比如org调用switchOrg root
const token = await orgUser.createToken(null, loginType);
ctx.body = token;
return;
}
const user = await Org.findOne({ where: { username } });
const users = user.users;