明树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
eb8b01a1
Commit
eb8b01a1
authored
Dec 01, 2025
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
name && mobile模糊检索 See merge request
!4
parents
d8d782be
922a499d
Pipeline
#103963
passed with stage
in 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
userController.js
controller/userController.js
+20
-9
No files found.
controller/userController.js
View file @
eb8b01a1
const
crypto
=
require
(
'crypto'
);
const
crypto
=
require
(
'crypto'
);
const
_
=
require
(
'lodash'
);
const
_
=
require
(
'lodash'
);
const
CryptoJS
=
require
(
'crypto-js'
);
const
CryptoJS
=
require
(
'crypto-js'
);
const
{
Op
}
=
require
(
'sequelize'
);
const
{
Op
,
where
}
=
require
(
'sequelize'
);
const
userModule
=
require
(
'../module/userModule'
);
const
userModule
=
require
(
'../module/userModule'
);
const
errorMessage
=
require
(
'../utils/errorMessage'
);
const
errorMessage
=
require
(
'../utils/errorMessage'
);
...
@@ -104,6 +104,16 @@ async function createUser(req, res, next) {
...
@@ -104,6 +104,16 @@ async function createUser(req, res, next) {
const
{
salt
,
passwordHash
}
=
utils
.
saltHashPassword
(
req
.
body
.
password
);
const
{
salt
,
passwordHash
}
=
utils
.
saltHashPassword
(
req
.
body
.
password
);
body
.
salt
=
salt
;
body
.
salt
=
salt
;
body
.
password
=
passwordHash
;
body
.
password
=
passwordHash
;
const
checkMobile
=
await
DB
.
User
.
findOne
({
where
:
{
mobile
:
body
.
mobile
}
});
console
.
log
(
"checkMobile"
,
checkMobile
);
console
.
log
(
"checkMobile"
,
checkMobile
.
length
);
if
(
checkMobile
)
{
return
res
.
sendError
(
errorMessage
.
nameDuplicated
)
}
const
ret
=
await
DB
.
User
.
create
(
body
);
const
ret
=
await
DB
.
User
.
create
(
body
);
if
(
!
(
ret
&&
ret
.
id
))
{
if
(
!
(
ret
&&
ret
.
id
))
{
return
res
.
sendError
(
errorMessage
.
databaseQueryError
);
return
res
.
sendError
(
errorMessage
.
databaseQueryError
);
...
@@ -229,15 +239,16 @@ async function listUser(req, res, next) {
...
@@ -229,15 +239,16 @@ async function listUser(req, res, next) {
let
page
=
req
.
body
.
page
||
1
;
let
page
=
req
.
body
.
page
||
1
;
let
limit
=
req
.
body
.
pageSize
||
10
;
let
limit
=
req
.
body
.
pageSize
||
10
;
let
offset
=
(
page
-
1
)
*
limit
;
let
offset
=
(
page
-
1
)
*
limit
;
if
(
req
.
body
.
name
)
{
const
body
=
req
.
body
search
.
where
=
{
const
name
=
body
.
name
?
String
(
body
.
name
).
trim
()
:
''
;
[
Op
.
or
]:
[
const
mobile
=
body
.
mobile
?
String
(
body
.
mobile
).
trim
()
:
''
;
{
name
:
{
[
Op
.
like
]:
`%
${
req
.
body
.
name
}
%`
}
},
const
where
=
{
del
:
0
};
{
mobile
:
{
[
Op
.
like
]:
`%
${
req
.
body
.
name
}
%`
}
}
if
(
name
||
mobile
)
{
],
where
[
Op
.
or
]
=
[];
del
:
0
,
if
(
name
)
where
[
Op
.
or
].
push
({
name
:
{
[
Op
.
like
]:
`%
${
name
}
%`
}
});
}
if
(
mobile
)
where
[
Op
.
or
].
push
({
mobile
:
{
[
Op
.
like
]:
`%
${
mobile
}
%`
}
});
}
}
search
.
where
=
where
search
.
limit
=
limit
;
search
.
limit
=
limit
;
search
.
offset
=
offset
;
search
.
offset
=
offset
;
search
.
include
=
[
search
.
include
=
[
...
...
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