Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test_platform
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
Wallen姚文辉
test_platform
Commits
d0d0b7cc
Commit
d0d0b7cc
authored
May 17, 2024
by
Wallen姚文辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复部分bug
parent
be0d2a6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
User.py
controller/User.py
+4
-2
No files found.
controller/User.py
View file @
d0d0b7cc
...
...
@@ -91,7 +91,9 @@ def adduser():
db
.
session
.
close
()
return
jsonify
({
"code"
:
401
,
"message"
:
"用户名重复,请重试"
}),
401
create_time
=
time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
,
time
.
localtime
(
time
.
time
()))
db
.
session
.
add
(
User
(
name
=
data
.
get
(
"name"
),
password
=
generate_password_hash
(
data
.
get
(
"password"
)),
role_id
=
int
(
data
.
get
(
"role_id"
)),
organization_id
=
(
int
(
data
.
get
(
"organization_id"
))
or
None
),
create_date
=
create_time
,
create_user
=
(
session
.
get
(
"id"
)
or
0
),
if
db
.
session
.
query
(
User
)
.
filter_by
(
name
=
data
.
get
(
"name"
))
.
count
()
>
0
:
return
jsonify
({
"code"
:
503
,
"message"
:
"该用户已添加"
}),
503
db
.
session
.
add
(
User
(
name
=
data
.
get
(
"name"
),
password
=
generate_password_hash
(
data
.
get
(
"password"
)),
role_id
=
int
(
data
.
get
(
"role_id"
)),
organization_id
=
(
data
.
get
(
"organization_id"
)
or
None
),
create_date
=
create_time
,
create_user
=
(
session
.
get
(
"id"
)
or
0
),
disable
=
(
data
.
get
(
"disable"
)
or
0
),
jira_account
=
data
.
get
(
"jira_account"
),
jira_password
=
data
.
get
(
"jira_password"
),
email_address
=
(
data
.
get
(
"email_address"
)
or
None
)))
db
.
session
.
commit
()
db
.
session
.
close
()
...
...
@@ -150,7 +152,7 @@ def finduser():
data
=
request
.
args
page_size
=
int
(
data
.
get
(
"page_size"
))
page_num
=
int
(
data
.
get
(
"page_num"
))
users
=
db
.
session
.
query
(
User
.
id
,
User
.
name
,
func
.
date_format
(
User
.
create_date
,
"
%
Y-
%
m-
%
d
%
H:
%
i:
%
s"
)
.
label
(
'create_date'
),
User
.
role_id
,
Role
.
name
.
label
(
"role_name"
),
Organization
.
id
.
label
(
"organization_id"
),
Organization
.
path
)
.
join
(
Role
,
Role
.
id
==
User
.
role_id
)
.
join
(
Organization
,
Organization
.
id
==
User
.
organization_id
)
users
=
db
.
session
.
query
(
User
.
id
,
User
.
name
,
func
.
date_format
(
User
.
create_date
,
"
%
Y-
%
m-
%
d
%
H:
%
i:
%
s"
)
.
label
(
'create_date'
),
User
.
role_id
,
Role
.
name
.
label
(
"role_name"
),
Organization
.
id
.
label
(
"organization_id"
),
Organization
.
path
)
.
outerjoin
(
Role
,
Role
.
id
==
User
.
role_id
)
.
outer
join
(
Organization
,
Organization
.
id
==
User
.
organization_id
)
if
data
.
get
(
"name"
):
users
=
users
.
filter
(
User
.
name
.
like
(
"
%
"
+
data
.
get
(
"name"
)
+
"
%
"
))
if
data
.
getlist
(
'organizations[]'
):
...
...
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