明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
letian_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
letian_backend
Commits
83a1ca9d
Commit
83a1ca9d
authored
Sep 13, 2024
by
zengfanpei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d46725c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
departController.js
controller/departController.js
+7
-0
userController.js
controller/userController.js
+3
-0
No files found.
controller/departController.js
View file @
83a1ca9d
...
...
@@ -55,6 +55,9 @@ async function getDepartInfo(req, res, next) {
async
function
updateDepart
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
res
.
sendError
(
errorMessage
.
resourceNotFound
)
}
let
updateObj
=
{
...
req
.
body
,
_id
:
undefined
,
...
...
@@ -71,6 +74,10 @@ async function updateDepart(req, res, next) {
updateObj
.
parentId
=
req
.
body
.
parentId
;
updateObj
.
parentIds
=
parentIds
;
}
//如果用此接口删除
if
(
req
.
body
.
del
==
1
)
{
await
DB
.
User
.
updateMany
({
depart
:
req
.
body
.
_id
},
{
depart
:
null
})
}
let
ret
=
await
departModule
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateObj
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
...
...
controller/userController.js
View file @
83a1ca9d
...
...
@@ -331,6 +331,9 @@ async function updateRole(req, res, next) {
async
function
deleteRole
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
res
.
sendError
(
errorMessage
.
resourceNotFound
)
}
// 角色删除 将用户中的角色去掉。$pull 从数组中删除一个指定元素
await
DB
.
User
.
updateMany
({},
{
$pull
:
{
roles
:
(
req
.
body
.
_id
)}});
const
ret
=
await
DB
.
Role
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
...
...
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