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
1dc8aa7f
Commit
1dc8aa7f
authored
Feb 17, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
84b18909
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
6 deletions
+41
-6
myapps/pc_management/api/business_portal.py
+41
-6
No files found.
myapps/pc_management/api/business_portal.py
View file @
1dc8aa7f
...
@@ -174,10 +174,46 @@ def get_business_account_list():
...
@@ -174,10 +174,46 @@ def get_business_account_list():
return_data
.
append
({
"user_name"
:
info
.
user_name
,
"user_id"
:
info
.
id
,
"user_no"
:
info
.
user_no
,
return_data
.
append
({
"user_name"
:
info
.
user_name
,
"user_id"
:
info
.
id
,
"user_no"
:
info
.
user_no
,
"phone"
:
info
.
phone
,
"level"
:
info
.
level
,
"rate"
:
info
.
rate
"phone"
:
info
.
phone
,
"level"
:
info
.
level
,
"rate"
:
info
.
rate
})
})
super_sql
=
""" where admin_business.business_id = '{}' and admin_business.status = '1'
return
BaseResponse
({
"list"
:
return_data
,
"page"
:
page
,
"pageSize"
:
page_size
,
and admin_account.status = '1' and admin_account.level < '{}'
"total_count"
:
total_count
})
"""
.
format
(
business_id
,
admin
.
level
)
super_result
=
db
.
session
.
execute
(
select_sql
+
from_sql
+
super_sql
)
.
fetchall
()
@business_route.route
(
"business_super_account_list"
,
methods
=
[
"POST"
])
def
get_business_super_account_list
():
"""
:return:
"""
json_data
=
request
.
get_json
()
page
=
json_data
.
get
(
"page"
,
1
)
page_size
=
json_data
.
get
(
"pageSize"
,
10
)
business_id
=
json_data
[
"business_id"
]
admin
=
g
.
user
if
g
.
user
.
level
!=
1
:
result
=
AdminBusiness
.
query
.
filter_by
(
business_id
=
business_id
,
user_id
=
admin
.
id
,
status
=
1
)
.
first
()
if
not
result
:
return
jsonify
(
ADMIN_BUSINESS_NOT_EXIST
)
select_sql
=
"""select admin_account.id, admin_account.user_no,admin_account.user_name, admin_account.phone,
admin_account.level, admin_business.rate """
count_sql
=
"select count(admin_account.id) as total_count"
from_sql
=
""" from admin_account left join admin_business on admin_account.id = admin_business.user_id """
where_sql
=
""" where admin_business.business_id = '{}' and admin_business.status = '1'
and admin_account.status = '1' and admin_account.level < '{}'
"""
.
format
(
business_id
,
admin
.
level
)
order_sql
=
" ORDER BY admin_account.id ASC, admin_account.level ASC"
# limit_sql = " LIMIT {offset} , {page_size} ".format(offset=(page - 1) * page_size, page_size=page_size)
count_result
=
db
.
session
.
execute
(
count_sql
+
from_sql
+
where_sql
)
.
fetchone
()
if
not
count_result
:
return
BaseResponse
(
data
=
{
"list"
:
[],
"page"
:
page
,
"pageSize"
:
page_size
,
"total_count"
:
0
})
else
:
total_count
=
count_result
.
total_count
super_result
=
db
.
session
.
execute
(
select_sql
+
from_sql
+
where_sql
+
order_sql
)
.
fetchall
()
if
not
super_result
:
return
BaseResponse
({
"list"
:
[]})
super_data
=
[{
"user_name"
:
"咻咻科技"
,
"user_id"
:
0
,
"user_no"
:
'0'
,
"phone"
:
"0"
,
"level"
:
1
,
"rate"
:
0
}]
super_data
=
[{
"user_name"
:
"咻咻科技"
,
"user_id"
:
0
,
"user_no"
:
'0'
,
"phone"
:
"0"
,
"level"
:
1
,
"rate"
:
0
}]
for
info
in
super_result
:
for
info
in
super_result
:
if
info
.
level
in
(
1
,
3
):
if
info
.
level
in
(
1
,
3
):
...
@@ -186,8 +222,7 @@ def get_business_account_list():
...
@@ -186,8 +222,7 @@ def get_business_account_list():
super_data
.
append
({
"user_name"
:
info
.
user_name
,
"user_id"
:
info
.
id
,
"user_no"
:
info
.
user_no
,
super_data
.
append
({
"user_name"
:
info
.
user_name
,
"user_id"
:
info
.
id
,
"user_no"
:
info
.
user_no
,
"phone"
:
info
.
phone
,
"level"
:
info
.
level
,
"rate"
:
info
.
rate
"phone"
:
info
.
phone
,
"level"
:
info
.
level
,
"rate"
:
info
.
rate
})
})
return
BaseResponse
({
"super_list"
:
super_data
,
"list"
:
return_data
,
"page"
:
page
,
"pageSize"
:
page_size
,
return
BaseResponse
({
"list"
:
super_data
})
"total_count"
:
total_count
})
@business_route.route
(
"edit_admin_account"
,
methods
=
[
"POST"
])
@business_route.route
(
"edit_admin_account"
,
methods
=
[
"POST"
])
...
...
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