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
6256c4df
Commit
6256c4df
authored
Jan 19, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d3b7e5d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
myapps/pc_management/api/machine_portal.py
+15
-9
No files found.
myapps/pc_management/api/machine_portal.py
View file @
6256c4df
...
...
@@ -32,17 +32,19 @@ def run_machine_list():
:return:
"""
json_data
=
request
.
get_json
()
page
=
json_data
.
get
(
"page"
,
None
)
page_size
=
json_data
.
get
(
"pageSize"
,
None
)
page
=
json_data
.
get
(
"page"
,
1
)
page_size
=
json_data
.
get
(
"pageSize"
,
10
)
keyword
=
json_data
.
get
(
"keyword"
,
None
)
admin
=
g
.
user
select_sql
=
"""select machine.id, machine.machine_no, machine.device_id, machine.qrcode_no,machine.status,
machine.mac, machine.power, machine.hatch_number, machine.type,machine.place_id,
place.place_name, machine.discounts_id
place.place_name, machine.discounts_id
, machine.business_id,business.business_name
"""
count_sql
=
"select count(machine.id) as total_count"
from_sql
=
""" from machine left join place on machine.place_id = place.id
from_sql
=
""" from machine
left join place on machine.place_id = place.id
left join business on machine.business_id = business.id
where machine.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1)
"""
.
format
(
user_id
=
admin
.
id
)
...
...
@@ -72,6 +74,7 @@ def run_machine_list():
"status"
:
info
.
status
,
"place_id"
:
info
.
place_id
,
"discounts_id"
:
info
.
discounts_id
,
"discounts_name"
:
DISCOUNTS_TYPES
.
get
(
int
(
info
.
discounts_id
),
"无此优惠"
),
"business_id"
:
info
.
business_id
,
"business_name"
:
info
.
business_name
})
return
BaseResponse
({
"list"
:
return_data
,
"page"
:
page
,
"pageSize"
:
page_size
,
"total_count"
:
total_count
})
...
...
@@ -180,11 +183,13 @@ def get_machine_detail():
admin
=
g
.
user
select_sql
=
"""select machine.id, machine.machine_no, machine.device_id, machine.qrcode_no,machine.status,
machine.mac, machine.power, machine.hatch_number, machine.type,machine.place_id,
place.place_name, machine.discounts_id
place.place_name, machine.discounts_id
,machine.business_id,business.business_name
"""
from_sql
=
""" from machine left join place on machine.place_id = place.id
where machine.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1)
from_sql
=
""" from machine
left join place on machine.place_id = place.id
left join business on machine.business_id = business.id
where machine.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1)
"""
.
format
(
user_id
=
admin
.
id
)
where_sql
=
" and machine.machine_no = {}"
.
format
(
machine_no
)
...
...
@@ -198,7 +203,8 @@ def get_machine_detail():
"mac"
:
info
.
mac
,
"power"
:
info
.
power
,
"hatch_number"
:
info
.
hatch_number
,
"type"
:
info
.
type
,
"status"
:
info
.
status
,
"place_id"
:
info
.
place_id
,
"discounts_id"
:
info
.
discounts_id
,
"discounts_name"
:
DISCOUNTS_TYPES
.
get
(
int
(
info
.
discounts_id
),
"无此优惠"
)
"discounts_name"
:
DISCOUNTS_TYPES
.
get
(
int
(
info
.
discounts_id
),
"无此优惠"
),
"business_id"
:
info
.
business_id
,
"business_name"
:
info
.
business_name
})
...
...
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