Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tamp_course_order
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
tamp_course_order
Commits
09baedaa
Commit
09baedaa
authored
Nov 26, 2020
by
pengxiong@wealthgrow.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付方式一致性
parent
c7292c2e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
153 additions
and
9 deletions
+153
-9
__main__.py
app/api/__main__.py
+1
-1
engine.py
app/api/engine.py
+2
-2
account_topup_order.py
app/model/account_topup_order.py
+1
-1
order_service.py
app/service/order_service.py
+7
-5
tamp_course_order.log
logs/tamp_course_order.log
+142
-0
No files found.
app/api/__main__.py
View file @
09baedaa
...
...
@@ -9,5 +9,5 @@
from
app.api.app
import
app
if
__name__
==
'__main__'
:
app
.
run
(
'0.0.0.0'
,
port
=
80
00
,
debug
=
True
)
app
.
run
(
'0.0.0.0'
,
port
=
80
,
debug
=
True
)
app/api/engine.py
View file @
09baedaa
...
...
@@ -44,8 +44,8 @@ tamp_pay_engine = create_engine(
charset
=
"utf8"
),
echo
=
True
)
tamp_user_session
=
sessionmaker
(
bind
=
tamp_user_engine
)()
tamp_pay_session
=
sessionmaker
(
bind
=
tamp_pay_engine
)()
tamp_user_session
=
sessionmaker
(
bind
=
tamp_user_engine
,
autocommit
=
True
)()
tamp_pay_session
=
sessionmaker
(
bind
=
tamp_pay_engine
,
autocommit
=
True
)()
# redis = redis.StrictRedis(
# host=config[env]['redis']['host'],
...
...
app/model/account_topup_order.py
View file @
09baedaa
...
...
@@ -23,7 +23,7 @@ class AccountTopupOrder(Base, BaseModel):
user_id
=
Column
(
String
(
64
),
comment
=
'用户ID'
)
amount
=
Column
(
BigInteger
,
comment
=
'订单总额'
)
order_status
=
Column
(
Integer
,
server_default
=
text
(
'0'
),
comment
=
'订单状态:0:未支付,1:已支付,2:已退款'
)
pay_method
=
Column
(
Integer
,
server_default
=
text
(
'1'
),
comment
=
'支付方式:
1:探普贝,2:微信支付,3:支付宝支付,4
:苹果支付'
)
pay_method
=
Column
(
Integer
,
server_default
=
text
(
'1'
),
comment
=
'支付方式:
4:探普贝,5:app微信支付,6:支付宝支付,7
:苹果支付'
)
create_time
=
Column
(
DateTime
(
timezone
=
True
),
server_default
=
func
.
now
(),
comment
=
'创建时间'
)
pay_time
=
Column
(
DateTime
(
timezone
=
True
),
server_default
=
func
.
now
(),
comment
=
'付款时间'
)
complete_time
=
Column
(
DateTime
(
timezone
=
True
),
server_default
=
func
.
now
(),
comment
=
'完成时间'
)
...
...
app/service/order_service.py
View file @
09baedaa
...
...
@@ -8,6 +8,8 @@
# -----------------------------------------------------------------------------
import
time
from
sqlalchemy.sql.elements
import
and_
from
app.api.engine
import
tamp_pay_session
,
tamp_user_session
from
app.config.errors
import
Errors
from
app.controller.errorhandler
import
CustomFlaskErr
...
...
@@ -28,7 +30,7 @@ class TopUpOrderService:
pass
def
get_order
(
self
,
user_id
):
res
=
tamp_pay_session
.
query
(
AccountTopupOrder
)
.
filter
(
AccountTopupOrder
.
user_id
==
user_id
)
.
all
()
res
=
tamp_pay_session
.
query
(
AccountTopupOrder
)
.
filter
(
and_
(
AccountTopupOrder
.
user_id
==
user_id
,
AccountTopupOrder
.
order_status
==
1
)
)
.
all
()
return
[
r
.
to_dict
()
for
r
in
res
]
...
...
@@ -41,17 +43,17 @@ class TopUpOrderService:
out_trade_no
=
args
[
'order_no'
]
notify_path
=
'/tamp_order/micro_shop/topUpOrderNotify'
pay_params
=
None
if
args
[
'pay_method'
]
==
2
:
if
args
[
'pay_method'
]
==
5
:
# 微信支付
wx_pay
=
WXPay
(
out_trade_no
,
subject
,
args
[
'amount'
],
args
[
'remote_addr'
],
notify_path
=
notify_path
)
params
=
wx_pay
.
getReturnParams
()
pay_params
=
params
elif
args
[
'pay_method'
]
==
3
:
elif
args
[
'pay_method'
]
==
6
:
# 支付宝支付
total_amount
=
args
[
'amount'
]
/
100
res
=
prePay
(
subject
,
out_trade_no
,
total_amount
,
notify_path
=
notify_path
)
pay_params
=
res
elif
args
[
'pay_method'
]
==
4
:
elif
args
[
'pay_method'
]
==
7
:
# 苹果支付
receipt_data
=
args
.
get
(
'receipt_data'
,
''
)
if
not
apple_pay
(
receipt_data
):
...
...
@@ -85,7 +87,7 @@ class CurriculumOrderService:
res
=
tamp_user_session
.
query
(
OrderFlow
)
.
filter
(
OrderFlow
.
createby
==
user_id
)
.
all
()
curriculum_column
=
{
r
.
id
:
r
.
to_dict
()
for
r
in
curriculum_column
}
curriculum_res
=
{
r
.
id
:
r
.
to_dict
()
for
r
in
curriculum_res
}
orders
=
[
r
.
to_dict
()
for
r
in
res
]
orders
=
[
r
.
to_dict
()
for
r
in
res
if
r
.
to_dict
()[
'ab_status'
]
==
'SUCCESS'
]
for
order
in
orders
:
prod_type
=
order
.
get
(
'ab_si_type'
,
''
)
prod_id
=
order
.
get
(
'ab_proid'
,
''
)
...
...
logs/tamp_course_order.log
View file @
09baedaa
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