Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Automat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯佳佳
Automat
Commits
1c2ba62f
Commit
1c2ba62f
authored
Feb 17, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1dc8aa7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletions
+36
-1
models/models.py
+12
-0
myapps/pc_management/api/admin_portal.py
+24
-1
No files found.
models/models.py
View file @
1c2ba62f
...
...
@@ -86,6 +86,18 @@ class AdminMachine(Base):
updated_at
=
Column
(
DateTime
,
nullable
=
False
,
server_default
=
text
(
"CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
))
class
AdminOpenid
(
Base
):
__tablename__
=
'admin_openid'
id
=
Column
(
INTEGER
(
11
),
primary_key
=
True
)
user_id
=
Column
(
INTEGER
(
11
),
nullable
=
False
)
user_no
=
Column
(
String
(
25
,
'utf8mb4_unicode_ci'
),
nullable
=
False
)
openid
=
Column
(
String
(
40
,
'utf8mb4_unicode_ci'
),
nullable
=
False
)
status
=
Column
(
INTEGER
(
1
),
default
=
1
,
nullable
=
False
)
created_at
=
Column
(
DateTime
,
nullable
=
False
,
server_default
=
text
(
"CURRENT_TIMESTAMP"
))
updated_at
=
Column
(
DateTime
,
nullable
=
False
,
server_default
=
text
(
"CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
))
class
AdminPlace
(
Base
):
__tablename__
=
'admin_place'
...
...
myapps/pc_management/api/admin_portal.py
View file @
1c2ba62f
...
...
@@ -14,7 +14,8 @@ from utils.error_code import ACCOUNT_AGENT_SPOT_NULL_ERROR, ACCOUNT_NOT_EXISTS_E
from
utils.error_code
import
PHONE_NOT_NULL_ERROR
,
PHONE_NOT_VALID_ERROR
,
TOKEN_NOT_VALID_ERROR
,
\
VERIFICATION_CODE_INVALID_ERROR
,
VERIFICATION_CODE_ERROR
,
PASSWORD_ERROR
from
models.base_model
import
db
,
Base
from
models.models
import
AdminAccount
,
AdminLoginRecord
,
AdminMachine
,
AdminPlace
,
Place
,
Business
,
AdminBusiness
from
models.models
import
AdminAccount
,
AdminLoginRecord
,
AdminMachine
,
AdminPlace
,
Place
,
Business
,
AdminBusiness
,
\
AdminOpenid
from
utils.jwt_util
import
verify_jwt
,
generate_jwt
from
utils.my_response
import
BaseResponse
from
service.sms_service
import
SMSService
...
...
@@ -259,3 +260,25 @@ def delete_user():
db
.
session
.
commit
()
return
BaseResponse
()
@admin_route.route
(
'/edit_openid'
,
methods
=
[
'GET'
,
'POST'
])
def
run_edit_openid
():
json_data
=
request
.
get_json
()
openids
=
json_data
[
'openids'
]
AdminOpenid
.
query
.
filter_by
(
user_id
=
g
.
user
.
id
)
.
update
({
"status"
:
-
1
})
for
openid
in
openids
:
rs
=
AdminOpenid
.
query
.
filter_by
(
user_id
=
g
.
user
.
id
,
openid
=
openid
)
.
first
()
if
rs
:
rs
.
status
=
1
db
.
session
.
add
(
rs
)
else
:
ao_model
=
AdminOpenid
()
ao_model
.
user_id
=
g
.
user
.
id
ao_model
.
user_no
=
g
.
user
.
user_no
ao_model
.
openid
=
openid
ao_model
.
status
=
1
db
.
session
.
add
(
ao_model
)
db
.
session
.
commit
()
return
BaseResponse
()
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