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
5688b2ff
Commit
5688b2ff
authored
Nov 17, 2021
by
yanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡片(充值成功+查询充值记录)
parent
6a3a759e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
myapps/sukang24h/api/nfc_card_portal.py
+38
-0
utils/error_code.py
+0
-0
No files found.
myapps/sukang24h/api/nfc_card_portal.py
View file @
5688b2ff
...
@@ -326,3 +326,40 @@ def run_nfc_card_pay_refund():
...
@@ -326,3 +326,40 @@ def run_nfc_card_pay_refund():
db
.
session
.
commit
()
db
.
session
.
commit
()
return
BaseResponse
()
return
BaseResponse
()
#查询充值记录
@nfc_card_route.route
(
'/user_pay_record'
,
methods
=
[
'POST'
])
def
run_nfc_card_user_pay_record
():
json_data
=
request
.
get_json
()
card_no
=
json_data
[
"card_no"
]
card_result
=
NfcCard
.
query
.
filter_by
(
card_no
=
card_no
,
status
=
1
)
.
first
()
if
not
card_result
:
return
jsonify
(
NFC_CARD_NOT_EXIST
)
card_result
=
NfcCardPayRecord
.
query
.
filter_by
(
card_no
=
card_no
)
.
all
()
result_data
=
[]
for
card
in
card_result
:
record
=
{
"card_no"
:
card
.
card_no
,
"user_id"
:
card
.
user_id
,
"pay_money"
:
card
.
pay_money
,
"created_at"
:
card
.
created_at
}
result_data
.
append
(
record
)
return
BaseResponse
(
data
=
result_data
)
#充值成功后改变数据库
@nfc_card_route.route
(
'/user_pay_succeed'
,
methods
=
[
'POST'
])
def
run_nfc_card_pay_succeed
():
json_data
=
request
.
get_json
()
card_no
=
json_data
[
"card_no"
]
money
=
json_data
[
"money"
]
card_result
=
NfcCard
.
query
.
filter_by
(
card_no
=
card_no
,
status
=
1
)
.
first
()
if
not
card_result
:
return
jsonify
(
NFC_CARD_NOT_EXIST
)
card_result
.
money
+=
int
(
money
)
db
.
session
.
add
(
card_result
)
db
.
session
.
commit
()
return
BaseResponse
()
\ No newline at end of file
utils/error_code.py
View file @
5688b2ff
This diff is collapsed.
Click to expand it.
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