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
5168613b
Commit
5168613b
authored
4 years ago
by
pengxiong@wealthgrow.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品类型字段变更
parent
480fce5d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
996 additions
and
11 deletions
+996
-11
errorhandler.py
app/controller/errorhandler.py
+4
-0
order.py
app/controller/order.py
+1
-1
curriculum_order.py
app/model/curriculum_order.py
+2
-2
order_service.py
app/service/order_service.py
+8
-8
tamp_course_order.log
logs/tamp_course_order.log
+981
-0
No files found.
app/controller/errorhandler.py
View file @
5168613b
...
...
@@ -6,6 +6,8 @@
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
import
time
import
requests
from
flask
import
jsonify
,
make_response
,
request
...
...
@@ -54,7 +56,9 @@ def add_errorhandler(app):
token
=
request
.
headers
.
get
(
'tampToken'
,
''
)
# token = 'eyJhbHQiOiJIUzI1NiIsImFsZyI6IkhTMjU2IiwidHlwIjoiSldUIn0.eyJwYXlsb2FkIjoidGFtcC8xOTM3NzkzMDc5NzY5NDE1NjgiLCJpc3MiOiJjYWl4aWFvcXVhbiIsImlhdCI6MTYwNjI5MDYzMH0.WnADEiWd27A8wr2DmOyX1kcs0dWLxpoO-k1yiF0qbBk'
url
=
config
[
env
][
'token_auth_url'
]
start
=
time
.
time
()
res
=
requests
.
get
(
url
,
{
'tampToken'
:
token
})
print
(
'token鉴权时间'
,
time
.
time
()
-
start
)
resp
=
res
.
json
()
if
resp
[
'statusCode'
]
!=
"0000"
:
raise
CustomFlaskErr
(
Errors
.
TOKEN_INVALID
)
...
...
This diff is collapsed.
Click to expand it.
app/controller/order.py
View file @
5168613b
...
...
@@ -81,7 +81,7 @@ class ConsumeOrder(Resource):
def
post
(
self
):
"""."""
self
.
parser
.
add_argument
(
'ab_
si_
type'
,
type
=
int
,
required
=
True
,
help
=
'商品类型不能为空'
)
self
.
parser
.
add_argument
(
'ab_type'
,
type
=
int
,
required
=
True
,
help
=
'商品类型不能为空'
)
self
.
parser
.
add_argument
(
'ab_proid'
,
type
=
str
,
required
=
True
,
help
=
'商品ID不能为空'
)
self
.
parser
.
add_argument
(
'prod_name'
,
type
=
str
,
required
=
True
,
help
=
'商品名称不能为空'
)
self
.
parser
.
add_argument
(
'ab_pay_mode'
,
type
=
int
,
required
=
True
,
help
=
'支付方式不能为空'
)
...
...
This diff is collapsed.
Click to expand it.
app/model/curriculum_order.py
View file @
5168613b
...
...
@@ -44,10 +44,10 @@ class OrderFlow(Base, BaseModel):
ab_payment
=
Column
(
BIGINT
,
comment
=
'支付通道付款金额'
)
ab_pay_mode
=
Column
(
String
(
3
),
comment
=
'支付方式 1:免费,2:积分,3现金,4:探普贝,5:app微信支付,6:支付宝支付,7:苹果支付'
)
ab_total_money
=
Column
(
BIGINT
,
comment
=
'订单总额'
)
ab_type
=
Column
(
String
(
3
),
comment
=
'产品类型'
)
ab_type
=
Column
(
String
(
3
),
comment
=
'产品类型
购买类型 1:栏目 3:直播 4:视频 5 音频 6:探普呗
'
)
ab_proid
=
Column
(
String
(
64
),
comment
=
'产品ID'
)
ab_pro_siid
=
Column
(
String
(
64
),
comment
=
'产品规格ID'
)
ab_si_type
=
Column
(
String
(
3
),
comment
=
'购买类型
1:栏目 3:直播 4:视频 5 音频 6 探普币订单
'
)
ab_si_type
=
Column
(
String
(
3
),
comment
=
'购买类型'
)
ab_si_name
=
Column
(
String
(
32
),
comment
=
'产品规格规格名称'
)
ab_si_code
=
Column
(
String
(
16
),
comment
=
'产品规格规格编码'
)
ab_si_pattern
=
Column
(
String
(
3
),
comment
=
'产品规格定价模式'
)
...
...
This diff is collapsed.
Click to expand it.
app/service/order_service.py
View file @
5168613b
...
...
@@ -35,7 +35,7 @@ class TopUpOrderService:
pageSize
=
args
[
'pageSize'
]
user_id
=
args
[
'user_id'
]
offset
=
(
pageNumber
-
1
)
*
pageSize
totalSize
=
len
(
tamp_user_session
.
query
(
OrderFlow
.
id
)
.
filter
(
and_
(
OrderFlow
.
createby
==
user_id
,
OrderFlow
.
ab_
si_
type
==
'6'
,
OrderFlow
.
ab_status
==
'SUCCESS'
))
.
all
())
totalSize
=
len
(
tamp_user_session
.
query
(
OrderFlow
.
id
)
.
filter
(
and_
(
OrderFlow
.
createby
==
user_id
,
OrderFlow
.
ab_type
==
'6'
,
OrderFlow
.
ab_status
==
'SUCCESS'
))
.
all
())
res
=
tamp_user_session
.
query
(
OrderFlow
)
.
filter
(
OrderFlow
.
createby
==
user_id
)
.
order_by
(
OrderFlow
.
createtime
.
desc
())
.
offset
(
offset
)
.
limit
(
pageSize
)
.
all
()
res
=
[
r
.
to_dict
()
for
r
in
res
]
...
...
@@ -100,7 +100,7 @@ class TopUpOrderService:
args
[
'ab_payment'
]
=
args
.
pop
(
'amount'
,
''
)
args
[
'ab_pay_mode'
]
=
args
.
pop
(
'pay_method'
,
''
)
args
[
'createby'
]
=
args
.
pop
(
'user_id'
,
''
)
args
[
'ab_
si_
type'
]
=
'6'
args
[
'ab_type'
]
=
'6'
order_info
=
OrderFlow
(
**
args
)
tamp_user_session
.
add
(
order_info
)
tamp_user_session
.
commit
()
...
...
@@ -127,7 +127,7 @@ class CurriculumOrderService:
orders
=
[
r
.
to_dict
()
for
r
in
res
if
r
.
to_dict
()[
'ab_status'
]
==
'SUCCESS'
]
temp_orders
=
[]
for
order
in
orders
:
prod_type
=
order
.
get
(
'ab_
si_
type'
,
''
)
prod_type
=
order
.
get
(
'ab_type'
,
''
)
prod_id
=
order
.
get
(
'ab_proid'
,
''
)
if
prod_type
==
'1'
:
order
=
{
**
order
,
**
curriculum_column
.
get
(
prod_id
,
None
)}
...
...
@@ -137,7 +137,7 @@ class CurriculumOrderService:
temp_orders
.
append
(
order
)
totalSize
=
len
(
temp_orders
)
temp_orders
=
temp_orders
[
offset
:
offset
+
pageSize
]
allowed
=
{
'id'
,
'title'
,
'cover'
,
'info'
,
'ab_
si_
type'
,
'ab_payment'
,
'ab_pay_mode'
,
'ab_ordernum'
,
'transaction_serial_no'
,
'pay_method'
,
'createtime'
,
'pay_time'
,
'complete_time'
,
allowed
=
{
'id'
,
'title'
,
'cover'
,
'info'
,
'ab_type'
,
'ab_payment'
,
'ab_pay_mode'
,
'ab_ordernum'
,
'transaction_serial_no'
,
'pay_method'
,
'createtime'
,
'pay_time'
,
'complete_time'
,
'ab_status'
}
for
r
in
temp_orders
:
keys
=
set
(
r
.
keys
())
-
allowed
...
...
@@ -163,7 +163,7 @@ class CurriculumOrderService:
notify_path
=
'/tamp_order/micro_shop/topUpOrderNotify'
pay_params
=
None
# 该用户是否重复购买同一商品
repeat_buy
=
tamp_user_session
.
query
(
OrderFlow
.
id
)
.
filter
(
and_
(
OrderFlow
.
createby
==
args
[
'u
es
r_id'
]),
OrderFlow
.
ab_proid
==
args
[
'ab_proid'
],
OrderFlow
.
ab_status
==
'SUCCESS'
)
.
all
()
repeat_buy
=
tamp_user_session
.
query
(
OrderFlow
.
id
)
.
filter
(
and_
(
OrderFlow
.
createby
==
args
[
'u
se
r_id'
]),
OrderFlow
.
ab_proid
==
args
[
'ab_proid'
],
OrderFlow
.
ab_status
==
'SUCCESS'
)
.
all
()
if
repeat_buy
:
raise
CustomFlaskErr
(
Errors
.
REPEAT_BUY
)
if
args
[
'ab_pay_mode'
]
==
4
:
...
...
@@ -311,7 +311,7 @@ def getAllOrders(args):
user_id
=
args
[
'user_id'
]
offset
=
(
pageNumber
-
1
)
*
pageSize
totalSize
=
len
(
tamp_user_session
.
query
(
OrderFlow
.
id
)
.
filter
(
and_
(
OrderFlow
.
createby
==
user_id
,
OrderFlow
.
ab_
si_
type
==
'6'
,
OrderFlow
.
ab_status
==
'SUCCESS'
))
.
all
())
and_
(
OrderFlow
.
createby
==
user_id
,
OrderFlow
.
ab_type
==
'6'
,
OrderFlow
.
ab_status
==
'SUCCESS'
))
.
all
())
res
=
tamp_user_session
.
query
(
OrderFlow
)
.
filter
(
OrderFlow
.
createby
==
user_id
)
.
order_by
(
OrderFlow
.
createtime
.
desc
())
.
all
()
topup_res
=
[
r
.
to_dict
()
for
r
in
res
]
...
...
@@ -333,7 +333,7 @@ def getAllOrders(args):
orders
=
[
r
.
to_dict
()
for
r
in
res
if
r
.
to_dict
()[
'ab_status'
]
==
'SUCCESS'
]
temp_orders
=
[]
for
order
in
orders
:
prod_type
=
order
.
get
(
'ab_
si_
type'
,
''
)
prod_type
=
order
.
get
(
'ab_type'
,
''
)
prod_id
=
order
.
get
(
'ab_proid'
,
''
)
if
prod_type
==
'1'
:
order
=
{
**
order
,
**
curriculum_column
.
get
(
prod_id
,
None
)}
...
...
@@ -342,7 +342,7 @@ def getAllOrders(args):
order
=
{
**
order
,
**
curriculum_res
.
get
(
prod_id
,
None
)}
temp_orders
.
append
(
order
)
temp_orders
=
temp_orders
[
offset
:
offset
+
pageSize
]
allowed
=
{
'id'
,
'title'
,
'cover'
,
'info'
,
'ab_
si_
type'
,
'ab_payment'
,
'ab_pay_mode'
,
'ab_ordernum'
,
allowed
=
{
'id'
,
'title'
,
'cover'
,
'info'
,
'ab_type'
,
'ab_payment'
,
'ab_pay_mode'
,
'ab_ordernum'
,
'transaction_serial_no'
,
'pay_method'
,
'createtime'
,
'pay_time'
,
'complete_time'
,
'ab_status'
}
for
r
in
temp_orders
:
...
...
This diff is collapsed.
Click to expand it.
logs/tamp_course_order.log
View file @
5168613b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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