Commit 733c8590 by 王昆

gsb

parent 2a92bd1a
......@@ -38,6 +38,9 @@ class UserCtl extends CtlBase {
loginUser = loginUser.data;
// 处理用户菜单
this.buildMenu(loginUser);
var xggadminsid = await this.setLogin(loginUser);
return system.getResultSuccess(xggadminsid);
} catch (error) {
......@@ -46,6 +49,35 @@ class UserCtl extends CtlBase {
}
}
buildMenu(loginUser) {
if (!loginUser || !loginUser.menus || loginUser.menus.length == 0) {
return;
}
let menus = loginUser.menus;
let sysMenus = [];
for (let menu of menus) {
let sm = {
name: menu.name || "",
icon: menu.icon || "",
}
let team = [];
if(menu.childs) {
for (let child of menu.childs) {
team.push({
name: child.name || "",
path: child.path || "",
});
}
}
sm.team = team;
sysMenus.push(sm);
}
loginUser.menus = sysMenus;
}
async setLogin(user) {
var xggadminsid = "pt_" + uuidv4();
xggadminsid = "pt_" + "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
......@@ -90,10 +122,12 @@ class UserCtl extends CtlBase {
return system.getResult(null, "请选择用户组织机构");
}
if (user.uctype != 1) {
user.org_id = null;
user.roles = [];
}
user.roles = this.transRoles(user.roles);
return await this.userSve.addUser(user);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
......@@ -136,7 +170,7 @@ class UserCtl extends CtlBase {
user.org_id = null;
user.roles = [];
}
user.roles = this.transRoles(user.roles);
try {
return await this.userSve.updUser(user);
} catch (error) {
......@@ -218,5 +252,16 @@ class UserCtl extends CtlBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
transRoles(roles) {
let rs = [];
if (!roles || roles.length == 0) {
return;
}
for (let role of roles) {
rs.push({role_id: role});
}
return rs;
}
}
module.exports = UserCtl;
\ No newline at end of file
......@@ -189,7 +189,7 @@ class System {
// invoice: "http://127.0.0.1:3105" + path,
// 发票服务
uc: domain + ":3106" + path,
uc: domain + ":3106" + path ,
// uc: "http://127.0.0.1:3106" + path,
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment