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
0023e52a
Commit
0023e52a
authored
Jan 14, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
09261a14
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
5 deletions
+66
-5
README.md
+1
-1
config/commen_config.py
+1
-1
myapps/automat/api/rent_portal.py
+61
-0
myapps/pc_management/api/machine_portal.py
+2
-2
sukang_app_management.py
+1
-1
No files found.
README.md
View file @
0023e52a
sukang24h
automat
config/commen_config.py
View file @
0023e52a
...
...
@@ -61,5 +61,5 @@ ACCOUNT_STATUS = {
DISCOUNTS_TYPES
=
{
0
:
"暂无折扣"
,
1
:
"每日
收
单免费"
,
1
:
"每日
首
单免费"
,
}
myapps/automat/api/rent_portal.py
View file @
0023e52a
...
...
@@ -65,6 +65,67 @@ def create_rent():
if
not
machine
:
return
jsonify
(
MACHINE_NOT_EXIST_ERROR
)
if
machine
.
discounts_id
==
1
:
rent
=
Rent
.
query
.
filter
(
db
.
cast
(
Rent
.
created_at
,
db
.
DATE
)
==
db
.
cast
(
datetime
.
datetime
.
now
(),
db
.
DATE
))
.
first
()
if
not
rent
:
if
len
(
productions
)
!=
1
:
return
jsonify
(
HATCH_COUNT_ERROR
)
total_fee
=
0
for
id
,
count
in
productions
.
items
():
count
=
int
(
count
)
if
count
!=
1
:
return
jsonify
(
HATCH_COUNT_ERROR
)
id
=
int
(
id
)
# 根据给的仓号去获取商品信息
open_hatch
=
Hatch
.
query
.
filter
(
Hatch
.
machine_no
==
machine_no
,
Hatch
.
production_id
==
id
,
Hatch
.
left_count
>=
1
)
.
order_by
(
func
.
random
())
.
first
()
if
not
open_hatch
:
print
(
"...."
)
return
jsonify
(
HATCH_NOT_EXIST_ERROR
)
break
rent_no
=
RentService
.
create_order_no
()
rent
=
Rent
()
rent
.
rent_no
=
rent_no
rent
.
machine_no
=
machine
.
machine_no
rent
.
user_id
=
g
.
user
.
id
rent
.
place_id
=
machine
.
place_id
rent
.
total
=
total_fee
rent
.
add_time
=
datetime
.
datetime
.
now
()
rent
.
is_pay
=
1
rent
.
pay_time
=
datetime
.
datetime
.
now
()
rent
.
rent_type
=
type
rent
.
mch_platform
=
machine
.
mch_platform
rent_detail
=
RentDetail
()
rent_detail
.
rent_no
=
rent_no
rent_detail
.
user_id
=
rent
.
user_id
rent_detail
.
machine_no
=
rent
.
machine_no
rent_detail
.
hatch_no
=
open_hatch
.
hatch_no
rent_detail
.
production_id
=
open_hatch
.
production_id
rent_detail
.
name
=
open_hatch
.
name
rent_detail
.
title
=
open_hatch
.
title
rent_detail
.
brand_id
=
open_hatch
.
brand_id
rent_detail
.
brand_name
=
open_hatch
.
brand_name
rent_detail
.
cate_id
=
open_hatch
.
cate_id
rent_detail
.
cate_name
=
open_hatch
.
cate_name
rent_detail
.
price
=
0
rent_detail
.
rent_count
=
1
rent_detail
.
img
=
open_hatch
.
img
rent_detail
.
tags
=
open_hatch
.
tags
rent_detail
.
content
=
open_hatch
.
content
rent_detail
.
summary
=
open_hatch
.
summary
open_hatch
.
left_count
-=
1
if
open_hatch
.
left_count
<=
0
:
open_hatch
.
status
=
2
db
.
session
.
add
(
rent
)
db
.
session
.
add
(
rent_detail
)
db
.
session
.
commit
()
return
BaseResponse
()
total_fee
=
0
open_hatchs
=
{}
for
id
,
count
in
productions
.
items
():
...
...
myapps/pc_management/api/machine_portal.py
View file @
0023e52a
...
...
@@ -70,7 +70,7 @@ def run_machine_list():
"mac"
:
info
.
mac
,
"power"
:
info
.
power
,
"hatch_number"
:
info
.
hatch_number
,
"type"
:
info
.
type
,
"status"
:
info
.
status
,
"place_id"
:
info
.
place_id
,
"discounts_id"
:
info
.
discounts_id
,
"discounts_name"
:
DISCOUNTS_TYPES
[
int
(
info
.
discounts_id
)]
,
"discounts_name"
:
DISCOUNTS_TYPES
.
get
(
int
(
info
.
discounts_id
),
"无此优惠"
)
,
})
return
BaseResponse
({
"list"
:
return_data
,
"page"
:
page
,
"pageSize"
:
page_size
,
"total_count"
:
total_count
})
...
...
@@ -197,6 +197,6 @@ def get_machine_detail():
"mac"
:
info
.
mac
,
"power"
:
info
.
power
,
"hatch_number"
:
info
.
hatch_number
,
"type"
:
info
.
type
,
"status"
:
info
.
status
,
"place_id"
:
info
.
place_id
,
"discounts_id"
:
info
.
discounts_id
,
"discounts_name"
:
DISCOUNTS_TYPES
[
int
(
info
.
discounts_id
)]
,
"discounts_name"
:
DISCOUNTS_TYPES
.
get
(
int
(
info
.
discounts_id
),
"无此优惠"
)
,
})
sukang_app_management.py
View file @
0023e52a
...
...
@@ -13,4 +13,4 @@ app = create_app('prod')
logger
.
info
(
"run server"
)
if
__name__
==
'__main__'
:
app
.
run
(
'127.0.0.1'
,
8893
,
debug
=
Fals
e
)
app
.
run
(
'127.0.0.1'
,
8893
,
debug
=
Tru
e
)
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