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
8c564c9c
Commit
8c564c9c
authored
Apr 23, 2020
by
魏强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update;
parent
f0c3428e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
2 deletions
+47
-2
Controller/RentController.py
+20
-2
Service/RentService.py
+27
-0
No files found.
Controller/RentController.py
View file @
8c564c9c
...
@@ -342,11 +342,11 @@ def force_refund():
...
@@ -342,11 +342,11 @@ def force_refund():
if
action_pwd
!=
ACTION_PWD
:
if
action_pwd
!=
ACTION_PWD
:
return
jsonify
(
ACTION_CODE_ERROR
)
return
jsonify
(
ACTION_CODE_ERROR
)
refund_type
=
json_data
.
get
(
'type'
,
None
)
rent_no
=
json_data
.
get
(
'rent_no'
,
None
)
rent_no
=
json_data
.
get
(
'rent_no'
,
None
)
money
=
json_data
.
get
(
'money'
,
None
)
comment
=
json_data
.
get
(
'comment'
,
None
)
comment
=
json_data
.
get
(
'comment'
,
None
)
if
not
re
nt_no
or
not
money
or
not
comment
:
if
not
re
fund_type
or
not
rent_no
or
not
comment
:
return
jsonify
(
PARAMETER_ERROR
)
return
jsonify
(
PARAMETER_ERROR
)
rent_info
=
db
.
session
.
query
(
Production
,
Rent
)
.
join
(
Rent
,
Rent
.
id
==
Production
.
rent_id
)
.
filter
(
rent_info
=
db
.
session
.
query
(
Production
,
Rent
)
.
join
(
Rent
,
Rent
.
id
==
Production
.
rent_id
)
.
filter
(
...
@@ -355,6 +355,24 @@ def force_refund():
...
@@ -355,6 +355,24 @@ def force_refund():
if
not
rent_info
:
if
not
rent_info
:
return
jsonify
(
REFUND_NOT_PRODUCTION_INFO
)
return
jsonify
(
REFUND_NOT_PRODUCTION_INFO
)
if
refund_type
==
'1'
:
# 扣15元
money
=
1500
elif
refund_type
==
'2'
:
# 扣25元
money
=
2500
elif
refund_type
==
'3'
:
# 扣99元
money
=
9900
elif
refund_type
==
'4'
:
# 按时间扣款
back_time
=
json_data
.
get
(
'back_time'
,
None
)
money
=
RentService
.
check_fee_liuyuan
(
rent_info
.
Rent
.
pay_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
back_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
rent_info
.
Rent
.
one_day_price
,
rent_info
.
Rent
.
free_time
)
else
:
return
jsonify
({
'code'
:
-
1
,
'msg'
:
'refund type error!'
})
rent_info
.
Rent
.
back_money
=
rent_info
.
Rent
.
back_money
+
int
(
money
)
rent_info
.
Rent
.
back_money
=
rent_info
.
Rent
.
back_money
+
int
(
money
)
rent_info
.
Rent
.
total
=
rent_info
.
Rent
.
total
-
int
(
money
)
rent_info
.
Rent
.
total
=
rent_info
.
Rent
.
total
-
int
(
money
)
rent_info
.
Rent
.
real_total
=
rent_info
.
Rent
.
real_total
-
int
(
money
)
rent_info
.
Rent
.
real_total
=
rent_info
.
Rent
.
real_total
-
int
(
money
)
...
...
Service/RentService.py
View file @
8c564c9c
...
@@ -275,6 +275,33 @@ class RentService():
...
@@ -275,6 +275,33 @@ class RentService():
total
=
one_day_price
*
(
days
+
1
)
total
=
one_day_price
*
(
days
+
1
)
return
{
'total'
:
total
,
'use_m'
:
use_m
}
return
{
'total'
:
total
,
'use_m'
:
use_m
}
@classmethod
def
check_fee_liuyuan
(
cls
,
rent_time
,
back_time
,
one_day_price
,
free_time
):
back_time_date
=
datetime
.
datetime
.
strptime
(
back_time
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
rent_time_date
=
datetime
.
datetime
.
strptime
(
rent_time
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
use_time
=
(
back_time_date
-
rent_time_date
)
.
total_seconds
()
total
=
0
use_m
=
round
(
use_time
/
60
,
2
)
if
use_time
>
free_time
*
60
:
days
=
(
datetime
.
datetime
(
back_time_date
.
year
,
back_time_date
.
month
,
back_time_date
.
day
)
-
datetime
.
datetime
(
rent_time_date
.
year
,
rent_time_date
.
month
,
rent_time_date
.
day
))
.
days
# 超过一天的,按天收费,天数*25
if
days
>=
1
:
total
=
(
days
+
1
)
*
one_day_price
else
:
# 60分钟以内,不收费
if
use_time
<=
60
*
60
:
total
=
0
# 超时15分钟以内的,收费15元
elif
use_time
<=
(
60
+
15
)
*
60
:
total
=
1500
# 超时15分钟以上的,按25元/天收费
else
:
total
=
2500
return
{
'total'
:
total
,
'use_m'
:
use_m
}
@staticmethod
@staticmethod
def
create_refund_no
():
def
create_refund_no
():
'''
'''
...
...
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