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
2bd4ad76
Commit
2bd4ad76
authored
Apr 21, 2020
by
魏强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
留园退款接口;
parent
fb374149
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
Controller/RentController.py
+55
-0
No files found.
Controller/RentController.py
View file @
2bd4ad76
...
@@ -333,3 +333,58 @@ def rent_money_refund():
...
@@ -333,3 +333,58 @@ def rent_money_refund():
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
(
'/force_refund'
,
methods
=
[
'GET'
,
'POST'
])
def
force_refund
():
json_data
=
request
.
get_json
()
action_pwd
=
json_data
.
get
(
'action_pwd'
,
None
)
if
action_pwd
!=
ACTION_PWD
:
return
jsonify
(
ACTION_CODE_ERROR
)
rent_no
=
json_data
.
get
(
'rent_no'
,
None
)
money
=
json_data
.
get
(
'money'
,
None
)
comment
=
json_data
.
get
(
'comment'
,
None
)
if
not
rent_no
or
not
money
or
not
comment
:
return
jsonify
(
PARAMETER_ERROR
)
rent_info
=
db
.
session
.
query
(
Production
,
Rent
)
.
join
(
Rent
,
Rent
.
id
==
Production
.
rent_id
)
.
filter
(
Rent
.
rent_no
==
rent_no
)
.
first
()
if
not
rent_info
:
return
jsonify
(
REFUND_NOT_PRODUCTION_INFO
)
rent_info
.
Rent
.
back_money
=
int
(
money
)
rent_info
.
Rent
.
total
=
9900
-
int
(
money
)
rent_info
.
real_total
=
9900
-
int
(
money
)
rent_refund_no
=
RentService
.
create_refund_no
()
data
=
{
"out_refund_no"
:
rent_refund_no
,
"out_trade_no"
:
rent_info
.
rent_no
,
"total_fee"
:
rent_info
.
deposit
,
"refund_fee"
:
int
(
money
)
}
result
=
WeChatService
()
.
refund
(
data
)
if
result
:
try
:
rent_refund
=
RentRefund
()
rent_refund
.
refund_no
=
rent_refund_no
rent_refund
.
production_id
=
rent_info
.
Production
.
id
rent_refund
.
fee
=
int
(
money
)
rent_refund
.
comment
=
comment
rent_refund
.
created_at
=
datetime
.
datetime
.
now
()
rent_refund
.
updated_at
=
datetime
.
datetime
.
now
()
db
.
session
.
add
(
rent_refund
)
db
.
session
.
commit
()
except
SQLAlchemyError
as
e
:
db
.
session
.
rollback
()
raise
e
return
jsonify
(
BASE_RESPONSE
()
.
to_dict
())
else
:
return
jsonify
(
BASE_RESPONSE
(
error_code
=-
1
,
error_message
=
'refund failed!'
)
.
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