明树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
14a5acc9
Commit
14a5acc9
authored
Mar 11, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
10d70d3a
Pipeline
#108214
passed with stage
in 4 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
roleController.js
controller/roleController.js
+6
-0
userController.js
controller/userController.js
+7
-0
errorMessage.js
utils/errorMessage.js
+10
-0
No files found.
controller/roleController.js
View file @
14a5acc9
...
...
@@ -47,6 +47,12 @@ async function updateRole(req, res, next) {
delete
body
.
menus
;
}
// sequelize 只有update 写时需要注意条件 不能为空
if
(
role
.
key
!=
req
.
body
.
key
)
{
let
rt
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
req
.
body
.
key
}});
if
(
rt
)
{
return
res
.
sendError
(
errorMessage
.
roleDuplicate
);
}
}
const
ret
=
await
DB
.
Role
.
update
(
body
,
{
where
:
{
id
:
body
.
id
}
});
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
...
...
controller/userController.js
View file @
14a5acc9
...
...
@@ -279,6 +279,13 @@ async function updateUser(req, res, next) {
await
userModule
.
setUserPosition
(
user
.
id
,
positionIds
,
user
.
positions
||
[]);
delete
body
.
roles
;
}
//
if
(
user
.
mobile
!=
req
.
body
.
mobile
)
{
let
mt
=
await
DB
.
User
.
findOne
({
where
:
{
mobile
:
req
.
body
.
mobile
}});
if
(
mt
)
{
return
res
.
sendError
(
errorMessage
.
mobileDuplicate
)
}
}
const
ret
=
await
DB
.
User
.
update
(
body
,
{
where
:
{
id
:
body
.
id
}
});
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
...
...
utils/errorMessage.js
View file @
14a5acc9
...
...
@@ -21,6 +21,16 @@ module.exports = {
code
:
40005
,
message
:
"该部门下有绑定用户,不能删除!"
},
mobileDuplicate
:
{
code
:
40006
,
message
:
"电话号码重复"
},
roleDuplicate
:
{
code
:
40007
,
message
:
"角色标识重复"
},
databaseQueryError
:
{
...
...
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