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
197d295b
Commit
197d295b
authored
Jan 10, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d351ecd1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
66 deletions
+69
-66
mongodb_collections/__init__.py
+11
-0
mongodb_collections/agent_modules.py
+21
-0
mongodb_collections/base_collection.py
+22
-0
myapps/pc_management/api/admin_portal.py
+15
-66
No files found.
mongodb_collections/__init__.py
0 → 100644
View file @
197d295b
#!usr/bin/env python
#-*- coding:utf-8 _*-
"""
@version:
author:Aeolus
@time: 2021/07/02
@file: __init__.py.py
@function:
@modify:
"""
\ No newline at end of file
mongodb_collections/agent_modules.py
0 → 100644
View file @
197d295b
#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@version:
author:Aeolus
@time: 2021/07/02
@file: agent_modules.py
@function:
@modify:
"""
from
mongodb_collections.base_collection
import
BaseCollection
class
AdminModules
(
BaseCollection
):
def
__init__
(
self
):
super
()
.
__init__
(
collection_name
=
"admin_modules"
)
class
Modules
(
BaseCollection
):
def
__init__
(
self
):
super
()
.
__init__
(
collection_name
=
"modules"
)
mongodb_collections/base_collection.py
0 → 100644
View file @
197d295b
#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@version:
author:Aeolus
@time: 2021/07/02
@file: base_collection.py
@function:
@modify:
"""
from
pymongo
import
MongoClient
from
config.base_config
import
MONGO_DATABASE_URI
class
BaseCollection
(
object
):
def
__init__
(
self
,
collection_name
,
db_name
=
"suishenwan"
,
):
mongodatabase
=
MongoClient
(
MONGO_DATABASE_URI
)
.
get_database
(
db_name
)
self
.
collection
=
mongodatabase
.
get_collection
(
collection_name
)
def
find_one
(
self
,
where
):
return
self
.
collection
.
find_one
(
where
)
myapps/pc_management/api/admin_portal.py
View file @
197d295b
...
@@ -9,11 +9,11 @@ from config.commen_config import LOGIN_TYPE, ACCOUNT_STATUS
...
@@ -9,11 +9,11 @@ from config.commen_config import LOGIN_TYPE, ACCOUNT_STATUS
from
service.admin_service
import
AdminService
from
service.admin_service
import
AdminService
from
utils.error_code
import
ACCOUNT_AGENT_SPOT_NULL_ERROR
,
ACCOUNT_NOT_EXISTS_ERROR
,
\
from
utils.error_code
import
ACCOUNT_AGENT_SPOT_NULL_ERROR
,
ACCOUNT_NOT_EXISTS_ERROR
,
\
ACCOUNT_ALREADY_EXISTS_ERROR
,
ACCOUNT_ALREADY_DELETE_ERROR
,
AGNET_MODULES_ERROR
,
MODULES_NOT_EXISTS_ERROR
,
\
ACCOUNT_ALREADY_EXISTS_ERROR
,
ACCOUNT_ALREADY_DELETE_ERROR
,
AGNET_MODULES_ERROR
,
MODULES_NOT_EXISTS_ERROR
,
\
OPERATE_LEVEL_ERROR
OPERATE_LEVEL_ERROR
,
Param_Invalid_Error
from
utils.error_code
import
PHONE_NOT_NULL_ERROR
,
PHONE_NOT_VALID_ERROR
,
TOKEN_NOT_VALID_ERROR
,
\
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
VERIFICATION_CODE_INVALID_ERROR
,
VERIFICATION_CODE_ERROR
,
PASSWORD_ERROR
from
models.base_model
import
db
from
models.base_model
import
db
from
models.models
import
AdminAccount
,
AdminLoginRecord
,
AdminMachine
from
models.models
import
AdminAccount
,
AdminLoginRecord
,
AdminMachine
,
AdminPlace
,
Place
from
utils.jwt_util
import
verify_jwt
,
generate_jwt
from
utils.jwt_util
import
verify_jwt
,
generate_jwt
from
utils.my_response
import
BaseResponse
from
utils.my_response
import
BaseResponse
from
service.sms_service
import
SMSService
from
service.sms_service
import
SMSService
...
@@ -206,22 +206,6 @@ def get_account_detail():
...
@@ -206,22 +206,6 @@ def get_account_detail():
user_info
[
"level"
]
=
agent_info
.
level
user_info
[
"level"
]
=
agent_info
.
level
user_info
[
"status"
]
=
ACCOUNT_STATUS
[
'on_use'
]
user_info
[
"status"
]
=
ACCOUNT_STATUS
[
'on_use'
]
user_info
[
"comment"
]
=
agent_info
.
comment
user_info
[
"comment"
]
=
agent_info
.
comment
agent_spot_list
=
AgentSpot
.
query
.
filter_by
(
agent_no
=
agent_info
.
id
,
status
=
1
)
.
all
()
if
agent_spot_list
:
spot_no_list
=
[
i
.
spot_no
for
i
in
agent_spot_list
]
else
:
user_info
[
"spot_list"
]
=
[]
return
BaseResponse
(
data
=
user_info
)
spot_list
=
db
.
session
.
query
(
Spot
)
.
filter
(
Spot
.
id
.
in_
(
spot_no_list
))
.
all
()
if
spot_list
:
spot_data_list
=
[
{
"spot_name"
:
i
.
spotname
,
"spot_id"
:
i
.
id
,
"business_id"
:
i
.
business_id
,
"spot_address"
:
i
.
address
}
for
i
in
spot_list
]
else
:
spot_data_list
=
[]
user_info
[
"spot_list"
]
=
spot_data_list
return
BaseResponse
(
data
=
user_info
)
return
BaseResponse
(
data
=
user_info
)
...
@@ -235,7 +219,6 @@ def edit_user():
...
@@ -235,7 +219,6 @@ def edit_user():
comment
=
json_data
[
'comment'
]
if
'comment'
in
json_data
else
''
comment
=
json_data
[
'comment'
]
if
'comment'
in
json_data
else
''
level
=
json_data
[
'level'
]
if
'level'
in
json_data
else
''
level
=
json_data
[
'level'
]
if
'level'
in
json_data
else
''
status
=
json_data
[
'status'
]
if
'status'
in
json_data
else
''
status
=
json_data
[
'status'
]
if
'status'
in
json_data
else
''
spot_list
=
json_data
[
'spot_list'
]
if
'spot_list'
in
json_data
else
[]
if
not
old_phone
:
if
not
old_phone
:
return
BaseResponse
(
error_code
=-
1
,
error_message
=
'old phone is null'
)
return
BaseResponse
(
error_code
=-
1
,
error_message
=
'old phone is null'
)
...
@@ -245,51 +228,22 @@ def edit_user():
...
@@ -245,51 +228,22 @@ def edit_user():
if
not
status
:
if
not
status
:
return
BaseResponse
(
**
Param_Invalid_Error
)
return
BaseResponse
(
**
Param_Invalid_Error
)
result
=
Helper
.
check_phone
(
new_phone
)
admin_info
=
AdminAccount
.
query
.
filter_by
(
phone
=
old_phone
)
.
first
()
if
not
result
:
if
not
admin_info
:
return
BaseResponse
(
**
PHONE_NOT_VALID_ERROR
)
if
not
spot_list
:
return
BaseResponse
(
**
ACCOUNT_AGENT_SPOT_NULL_ERROR
)
agent_info
=
AdminAccount
.
query
.
filter_by
(
phone
=
old_phone
)
.
first
()
if
not
agent_info
:
return
BaseResponse
(
**
ACCOUNT_NOT_EXISTS_ERROR
)
return
BaseResponse
(
**
ACCOUNT_NOT_EXISTS_ERROR
)
a
gent
_info
.
user_name
=
user_name
a
dmin
_info
.
user_name
=
user_name
a
gent
_info
.
phone
=
new_phone
a
dmin
_info
.
phone
=
new_phone
a
gent
_info
.
status
=
status
a
dmin
_info
.
status
=
status
a
gent
_info
.
comment
=
comment
a
dmin
_info
.
comment
=
comment
if
level
:
if
level
:
a
gent
_info
.
level
=
int
(
level
)
a
dmin
_info
.
level
=
int
(
level
)
if
password
:
if
password
:
salt
=
AgentService
.
gene_salt
()
admin_info
.
password
=
password
agent_info
.
salt_pwd
=
salt
agent_info
.
password
=
AgentService
.
gene_pwd
(
password
,
salt
)
db
.
session
.
add
(
agent_info
)
agent_spot_info
=
AgentSpot
.
query
.
filter_by
(
agent_no
=
agent_info
.
id
)
.
all
()
for
info
in
agent_spot_info
:
info
.
status
=
ACCOUNT_STATUS
[
'delete'
]
db
.
session
.
add
(
info
)
for
i
in
spot_list
:
cur_spot_info
=
AgentSpot
.
query
.
filter_by
(
agent_no
=
agent_info
.
id
,
spot_no
=
i
)
.
first
()
if
not
cur_spot_info
:
cur_agent_spot
=
AgentSpot
()
cur_agent_spot
.
agent_no
=
agent_info
.
id
cur_agent_spot
.
spot_no
=
i
cur_agent_spot
.
status
=
ACCOUNT_STATUS
[
'on_use'
]
cur_agent_spot
.
created_at
=
datetime
.
datetime
.
now
()
cur_agent_spot
.
updated_at
=
datetime
.
datetime
.
now
()
db
.
session
.
add
(
cur_agent_spot
)
else
:
cur_spot_info
.
status
=
ACCOUNT_STATUS
[
'on_use'
]
db
.
session
.
add
(
cur_spot_info
)
db
.
session
.
add
(
admin_info
)
db
.
session
.
commit
()
db
.
session
.
commit
()
return
BaseResponse
()
return
BaseResponse
()
...
@@ -301,17 +255,12 @@ def delete_user():
...
@@ -301,17 +255,12 @@ def delete_user():
if
not
phone
:
if
not
phone
:
return
BaseResponse
(
**
PHONE_NOT_NULL_ERROR
)
return
BaseResponse
(
**
PHONE_NOT_NULL_ERROR
)
a
gent
_info
=
AdminAccount
.
query
.
filter_by
(
phone
=
phone
)
.
first
()
a
dmin
_info
=
AdminAccount
.
query
.
filter_by
(
phone
=
phone
)
.
first
()
if
not
a
gent
_info
:
if
not
a
dmin
_info
:
return
BaseResponse
(
**
ACCOUNT_NOT_EXISTS_ERROR
)
return
BaseResponse
(
**
ACCOUNT_NOT_EXISTS_ERROR
)
agent_spot_info
=
AgentSpot
.
query
.
filter_by
(
agent_no
=
agent_info
.
id
)
.
all
()
admin_info
.
status
=
ACCOUNT_STATUS
[
'delete'
]
for
info
in
agent_spot_info
:
db
.
session
.
add
(
admin_info
)
info
.
status
=
ACCOUNT_STATUS
[
'delete'
]
db
.
session
.
add
(
info
)
agent_info
.
status
=
ACCOUNT_STATUS
[
'delete'
]
db
.
session
.
add
(
agent_info
)
db
.
session
.
commit
()
db
.
session
.
commit
()
return
BaseResponse
()
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