明树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
99a08ce9
Commit
99a08ce9
authored
Dec 01, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
024d3073
Pipeline
#103958
passed with stage
in 3 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
userController.js
controller/userController.js
+4
-3
No files found.
controller/userController.js
View file @
99a08ce9
...
@@ -193,26 +193,27 @@ async function updateUser(req, res, next) {
...
@@ -193,26 +193,27 @@ async function updateUser(req, res, next) {
],
],
raw
:
true
,
raw
:
true
,
});
});
console
.
log
(
user
)
if
(
!
(
user
&&
user
.
id
))
{
if
(
!
(
user
&&
user
.
id
))
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
if
(
body
.
departs
&&
body
.
departs
.
length
)
{
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
);
await
userModule
.
setUserDepart
(
user
.
id
,
departIds
,
user
.
departs
||
[]
);
console
.
log
(
'user.departs'
,
user
.
departs
);
console
.
log
(
'user.departs'
,
user
.
departs
);
delete
body
.
departs
;
delete
body
.
departs
;
}
}
if
(
body
.
roles
&&
body
.
roles
.
length
)
{
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
);
await
userModule
.
setUserRole
(
user
.
id
,
roleIds
,
user
.
roles
||
[]
);
delete
body
.
roles
;
delete
body
.
roles
;
}
}
if
(
body
.
positions
&&
body
.
positions
.
length
)
{
if
(
body
.
positions
&&
body
.
positions
.
length
)
{
//跟现有情况对比 确定增删关系
//跟现有情况对比 确定增删关系
const
positionIds
=
body
.
positions
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
const
positionIds
=
body
.
positions
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
await
userModule
.
setUserPosition
(
user
.
id
,
positionIds
,
user
.
positions
);
await
userModule
.
setUserPosition
(
user
.
id
,
positionIds
,
user
.
positions
||
[]
);
delete
body
.
roles
;
delete
body
.
roles
;
}
}
const
ret
=
await
DB
.
User
.
update
(
body
,
{
where
:
{
id
:
body
.
id
}
});
const
ret
=
await
DB
.
User
.
update
(
body
,
{
where
:
{
id
:
body
.
id
}
});
...
...
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