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
4407a699
Commit
4407a699
authored
Nov 17, 2021
by
yanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡片充值
parent
5688b2ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
myapps/sukang24h/api/nfc_card_portal.py
+16
-13
No files found.
myapps/sukang24h/api/nfc_card_portal.py
View file @
4407a699
...
...
@@ -336,14 +336,15 @@ def run_nfc_card_user_pay_record():
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
()
card_result
=
NfcCardPayRecord
.
query
.
filter_by
(
card_no
=
card_no
,
is_pay
=
1
)
.
all
()
result_data
=
[]
for
card
in
card_result
:
record
=
{
"card_no"
:
card
.
card_no
,
"
user_id"
:
card
.
user_
id
,
"
id"
:
card
.
id
,
"pay_money"
:
card
.
pay_money
,
"created_at"
:
card
.
created_at
"created_at"
:
card
.
created_at
,
"updated_at"
:
card
.
updated_at
}
result_data
.
append
(
record
)
...
...
@@ -353,13 +354,16 @@ def run_nfc_card_user_pay_record():
@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
)
for
key
,
val
in
json_data
.
items
():
id
=
json_data
[
key
][
"id"
]
card_no
=
json_data
[
key
][
"card_no"
]
pay_money
=
json_data
[
key
][
"pay_money"
]
card_result
=
NfcCard
.
query
.
filter_by
(
card_no
=
card_no
)
.
first
()
# 查询到卡号
card_record
=
NfcCardPayRecord
.
query
.
filter_by
(
id
=
id
)
.
first
()
#查询到充值记录
card_result
.
money
+=
pay_money
card_record
.
is_pay
=
2
db
.
session
.
add
(
card_record
,
card_record
)
db
.
session
.
commit
()
return
BaseResponse
()
card_result
.
money
+=
int
(
money
)
db
.
session
.
add
(
card_result
)
db
.
session
.
commit
()
return
BaseResponse
()
\ No newline at end of file
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