Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tour_business
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
0
Merge Requests
0
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
魏强
tour_business
Commits
7074b38a
Commit
7074b38a
authored
Jun 24, 2020
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加machine_price接口
parent
ef263373
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
Controller/RentController.py
+53
-0
No files found.
Controller/RentController.py
View file @
7074b38a
...
@@ -629,3 +629,56 @@ def rent_money_liuyuan():
...
@@ -629,3 +629,56 @@ def rent_money_liuyuan():
return
jsonify
(
BASE_RESPONSE
()
.
to_dict
())
return
jsonify
(
BASE_RESPONSE
()
.
to_dict
())
else
:
else
:
return
jsonify
(
BASE_RESPONSE
(
error_code
=-
1
,
error_message
=
'refund failed'
)
.
to_dict
())
return
jsonify
(
BASE_RESPONSE
(
error_code
=-
1
,
error_message
=
'refund failed'
)
.
to_dict
())
@route_rent.route
(
'/machine_price'
,
methods
=
[
'POST'
])
def
get_machine_price
():
json_data
=
request
.
get_json
()
mac_no
=
json_data
.
get
(
"mac_no"
,
None
)
if
not
mac_no
:
return
jsonify
(
PARAMETER_ERROR
)
# 验证机柜是否存在
machine
=
Machine
.
query
.
filter_by
(
mac_no
=
mac_no
)
.
first
()
if
not
machine
:
return
jsonify
(
MACHINE_NOT_EXIST_ERROR
)
data
=
{
"price_type"
:
machine
.
price_type
,
"one_day_price"
:
machine
.
one_day_price
,
"desposit"
:
machine
.
deposit
,
"time_price"
:
[]
}
if
machine
.
price_type
==
1
:
# 免费时间
data
[
"time_price"
]
.
append
([
str
(
0
)
+
'天'
,
0
])
max_days
=
machine
.
deposit
//
machine
.
one_day_price
+
1
i
=
1
while
i
<
max_days
:
data
[
"time_price"
]
.
append
([
str
(
i
)
+
'天'
,
machine
.
one_day_price
*
i
])
i
+=
1
data
[
"time_price"
]
.
append
([
str
(
max_days
)
+
'天'
,
machine
.
deposit
])
elif
machine
.
price_type
==
2
:
data
[
"price_type"
]
=
2
fee_minutes
=
FeeMinuteModel
.
query
.
filter_by
(
machine_id
=
machine
.
id
,
status
=
1
)
.
order_by
(
FeeMinuteModel
.
index
.
asc
())
.
all
()
data
[
"time_price"
]
.
append
([
'0分钟'
,
'0分钟'
,
0
])
max_hours
=
len
(
fee_minutes
)
n
=
0
while
n
<
max_hours
-
1
:
data
[
"time_price"
]
.
append
(
[
str
(
fee_minutes
[
n
]
.
minute
)
+
"分钟"
,
str
(
fee_minutes
[
n
+
1
]
.
minute
)
+
"分钟"
,
fee_minutes
[
n
]
.
price
])
n
+=
1
data
[
"time_price"
]
.
append
(
[
str
(
fee_minutes
[
n
]
.
minute
)
+
"分钟"
,
"1天"
,
fee_minutes
[
n
]
.
price
])
max_days
=
machine
.
deposit
//
machine
.
one_day_price
+
1
i
=
2
while
i
<
max_days
:
data
[
"time_price"
]
.
append
([
str
(
i
)
+
'天'
,
machine
.
one_day_price
*
i
])
i
+=
1
data
[
"time_price"
]
.
append
([
str
(
max_days
)
+
'天'
,
machine
.
deposit
])
else
:
pass
return
jsonify
(
BASE_RESPONSE
(
data
=
data
)
.
to_dict
())
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