明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jt_backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengfanpei
jt_backend
Commits
a7cb8cb4
Commit
a7cb8cb4
authored
Nov 19, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
6482a79e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
userController.js
controller/userController.js
+7
-6
projectTable.js
db/model/project/projectTable.js
+0
-0
No files found.
controller/userController.js
View file @
a7cb8cb4
...
...
@@ -34,7 +34,7 @@ async function login(req, res, next) {
include
:
[{
model
:
DB
.
Role
,
as
:
'roles'
,
where
:
{
del
:
0
},
//
where: { del: 0 },
attributes
:
[
"id"
,
"name"
],
through
:
{
attributes
:
[]
},
include
:
[{
...
...
@@ -44,10 +44,11 @@ async function login(req, res, next) {
// attributes: ['id', 'name', 'parentId'],
through
:
{
attributes
:
[]
},
}]
},
{
},
{
model
:
DB
.
Depart
,
as
:
'departs'
,
where
:
{
del
:
0
},
// where: { del: 0 }, 当刚注册的用户 没有分配角色、部门时加上条件会查不到
attributes
:
[
"id"
,
"name"
],
through
:
{
attributes
:
[]
},
}
...
...
@@ -82,7 +83,7 @@ async function login(req, res, next) {
delete
element
.
menus
;
newRoles
.
push
(
element
);
}
user
.
roles
=
r
oles
||
[];
user
.
roles
=
newR
oles
||
[];
user
.
menus
=
utils
.
buildTree
(
menus
);
return
res
.
sendData
(
user
);
}
catch
(
error
)
{
...
...
@@ -176,13 +177,13 @@ async function updateUser(req, res, next) {
}
if
(
body
.
departs
&&
body
.
departs
.
length
)
{
//跟现有情况对比 确定增删关系
const
departIds
=
body
.
departs
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
const
departIds
=
body
.
departs
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
await
userModule
.
setUserDepart
(
user
.
id
,
departIds
,
user
.
departs
);
delete
body
.
departs
;
}
if
(
body
.
roles
&&
body
.
roles
.
length
)
{
//跟现有情况对比 确定增删关系
const
roleIds
=
body
.
roles
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
const
roleIds
=
body
.
roles
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
await
userModule
.
setUserRole
(
user
.
id
,
roleIds
,
user
.
roles
);
delete
body
.
roles
;
}
...
...
db/model/project/project
ConSca
le.js
→
db/model/project/project
Tab
le.js
View file @
a7cb8cb4
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment