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
1314ae68
Commit
1314ae68
authored
Nov 02, 2021
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统一下单时返回要开的仓号
parent
3ed4e4f3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
myapps/sukang24h/api/rent_portal.py
+21
-12
No files found.
myapps/sukang24h/api/rent_portal.py
View file @
1314ae68
...
@@ -60,6 +60,22 @@ def create_rent():
...
@@ -60,6 +60,22 @@ def create_rent():
# 生成订单编号
# 生成订单编号
rent_no
=
RentService
.
create_order_no
()
rent_no
=
RentService
.
create_order_no
()
open_hatchs
=
[]
for
id
,
count
in
productions
.
items
():
count
=
int
(
count
)
id
=
int
(
id
)
# 根据给的仓号去获取商品信息
hatch_list
=
Hatch
.
query
.
filter
(
Hatch
.
machine_no
==
machine_no
,
Hatch
.
production_id
==
id
,
Hatch
.
status
==
1
)
.
order_by
(
func
.
random
())
.
all
()
if
not
hatch_list
:
return
jsonify
(
HATCH_NOT_EXIST_ERROR
)
if
len
(
hatch_list
)
<
count
:
return
jsonify
(
HATCH_NOT_ALL_EXIST_ERROR
)
hatch_no_list
=
[
x
.
hatch_no
for
x
in
hatch_list
[:
count
]]
open_hatchs
.
append
(
hatch_no_list
)
# 配置微信订单数据
# 配置微信订单数据
wechat_service
=
WeChatPayService
(
app_id
=
platform_appid_config_list
[
user
.
platform
],
wechat_service
=
WeChatPayService
(
app_id
=
platform_appid_config_list
[
user
.
platform
],
config_name
=
pay_config_list
[
machine
.
mch_platform
])
config_name
=
pay_config_list
[
machine
.
mch_platform
])
...
@@ -75,7 +91,8 @@ def create_rent():
...
@@ -75,7 +91,8 @@ def create_rent():
"machine_no"
:
machine_no
,
"machine_no"
:
machine_no
,
"user_id"
:
user
.
id
,
"user_id"
:
user
.
id
,
"machine_id"
:
machine
.
id
,
"machine_id"
:
machine
.
id
,
"platform"
:
machine
.
mch_platform
"platform"
:
machine
.
mch_platform
,
"open_hatchs"
:
open_hatchs
}
}
}
}
...
@@ -121,6 +138,7 @@ def wx_pay_callback():
...
@@ -121,6 +138,7 @@ def wx_pay_callback():
machine_no
=
rent_data
[
"machine_no"
]
machine_no
=
rent_data
[
"machine_no"
]
machine_id
=
rent_data
[
"machine_id"
]
machine_id
=
rent_data
[
"machine_id"
]
productions
=
rent_data
[
"productions"
]
productions
=
rent_data
[
"productions"
]
open_hatchs
=
rent_data
[
"open_hatchs"
]
user_id
=
rent_data
[
"user_id"
]
user_id
=
rent_data
[
"user_id"
]
platform
=
pay_config_list
[
platform
]
platform
=
pay_config_list
[
platform
]
wechat_service
=
WeChatPayService
(
app_id
=
callback_data
[
"appid"
],
config_name
=
platform
)
wechat_service
=
WeChatPayService
(
app_id
=
callback_data
[
"appid"
],
config_name
=
platform
)
...
@@ -166,19 +184,10 @@ def wx_pay_callback():
...
@@ -166,19 +184,10 @@ def wx_pay_callback():
rent
.
prepay_id
=
prepay_id
rent
.
prepay_id
=
prepay_id
total_fee
=
0
total_fee
=
0
for
id
,
count
in
productions
.
items
():
count
=
int
(
count
)
id
=
int
(
id
)
# 根据给的仓号去获取商品信息
hatch_list
=
Hatch
.
query
.
filter
(
Hatch
.
machine_no
==
machine_no
,
Hatch
.
production_id
==
id
,
Hatch
.
status
==
1
)
.
order_by
(
func
.
random
())
.
all
()
if
not
hatch_list
:
hatchs
=
Hatch
.
query
.
filter
(
Hatch
.
machine_no
==
machine_no
,
Hatch
.
hatch_no
.
in_
(
open_hatchs
),
return
jsonify
(
HATCH_NOT_EXIST_ERROR
)
Hatch
.
status
==
1
)
.
order_by
(
func
.
random
())
.
all
(
)
if
len
(
hatch_list
)
<
count
:
return
jsonify
(
HATCH_NOT_ALL_EXIST_ERROR
)
hatchs
=
hatch_list
[:
count
]
for
i
in
hatchs
:
for
i
in
hatchs
:
if
i
.
status
==
1
:
if
i
.
status
==
1
:
rent_detail
=
RentDetail
()
rent_detail
=
RentDetail
()
...
...
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