Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tour_business
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
0
Merge Requests
0
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
魏强
tour_business
Commits
1270fe0d
Commit
1270fe0d
authored
Mar 25, 2021
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增转化率查询接口
parent
3c2f578d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
1 deletions
+100
-1
Config/common_config.py
+3
-0
Controller/ReportController.py
+32
-1
Model/Garden/GardenModels.py
+65
-0
Model/Garden/__init__.py
+0
-0
No files found.
Config/common_config.py
View file @
1270fe0d
...
...
@@ -92,3 +92,6 @@ TAKEOUT_TOOL_TIPS_PHONE = [
'15279120691'
,
'13870952089'
]
# 挪出订单的景区对应编号
move_spot_ids
=
{
16
:
50
,
42
:
51
,
48
:
49
}
Controller/ReportController.py
View file @
1270fe0d
...
...
@@ -3,10 +3,12 @@ import datetime
from
flask
import
Blueprint
,
jsonify
,
request
,
g
from
Config.common_config
import
move_spot_ids
from
Libs.ErrorTips
import
BASE_RESPONSE
,
OPERATE_LEVEL_ERROR
from
Libs.Helper
import
Helper
from
Model.Base
import
db
from
Model.Customer.CustomerModel
import
Customer
from
Model.Garden.GardenModels
import
DayVisitorCountModel
from
Model.Machine.MachineModel
import
Machine
from
Model.Production.ProductionModel
import
Production
from
Service.ReportService
import
ReportService
...
...
@@ -163,7 +165,6 @@ def get_machine_rent_number():
for
info
in
machine_info
:
machines
[
str
(
info
.
id
)]
=
[
str
(
info
.
mac_no
)[
-
3
:],
0
]
move_spot_ids
=
{
16
:
50
,
42
:
51
,
48
:
49
}
sql_spot_id
=
spot_id
while
True
:
sql
=
"""
...
...
@@ -191,3 +192,33 @@ def get_machine_rent_number():
data
=
list
(
machines
.
values
())
return
jsonify
(
{
'error_code'
:
200
,
'error_message'
:
'Success'
,
'data'
:
data
})
@route_report.route
(
'/spot_visitor_user_number'
,
methods
=
[
'GET'
,
'POST'
])
def
get_spot_visitor_user_number
():
print
(
g
.
user
)
if
g
.
user
.
status
!=
1
or
g
.
user
.
level
!=
1
:
return
jsonify
(
OPERATE_LEVEL_ERROR
)
json_data
=
request
.
get_json
()
spot_id
=
int
(
json_data
[
'spot_id'
])
if
'spot_id'
in
json_data
else
0
query_date
=
json_data
.
get
(
'query_date'
,
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d"
))
sql
=
"SELECT count(1) as number FROM production WHERE"
if
move_spot_ids
.
get
(
spot_id
,
None
):
sql
+=
" (spot_id = '{}' or spot_id = '{}') "
.
format
(
spot_id
,
move_spot_ids
[
spot_id
])
else
:
sql
+=
" spot_id = '{}' "
.
format
(
spot_id
)
sql
+=
"and DATE_FORMAT(created_at, '
%
Y-
%
m-
%
d')='{}' and total>0 "
.
format
(
query_date
)
result
=
db
.
session
.
execute
(
sql
)
.
fetchone
()
if
result
:
user_num
=
result
.
number
else
:
user_num
=
0
visitor_num
=
0
result
=
DayVisitorCountModel
.
query
.
filter_by
(
spot_id
=
spot_id
,
today
=
query_date
)
.
first
()
if
result
:
visitor_num
=
result
.
left_num
return_data
=
[
user_num
,
visitor_num
]
return
jsonify
({
'error_code'
:
200
,
'error_message'
:
'Success'
,
'data'
:
return_data
})
Model/Garden/GardenModels.py
0 → 100644
View file @
1270fe0d
# -*- coding: utf-8 -*-
from
sqlalchemy
import
Column
,
Integer
,
String
from
sqlalchemy.ext.declarative
import
declarative_base
from
Model.Base
import
db
,
BaseModel
Base
=
declarative_base
()
metadata
=
Base
.
metadata
class
DaySaleCountModel
(
BaseModel
):
__tablename__
=
'day_sale_count'
id
=
Column
(
Integer
,
primary_key
=
True
,
comment
=
""
)
check_sum
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"预约上限人数"
)
total_sum
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"已预约人数"
)
week_check_sum
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"=本周预约人数"
)
lastweek_check_sum
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"上周预约人数"
)
today
=
Column
(
db
.
DateTime
,
nullable
=
False
,
comment
=
"数据日期"
)
class
DayBookCountModel
(
BaseModel
):
__tablename__
=
'day_book_count'
id
=
Column
(
Integer
,
primary_key
=
True
)
spot_id
=
Column
(
Integer
,
nullable
=
False
)
spot_name
=
Column
(
String
(
40
,
'utf8mb4_unicode_ci'
),
nullable
=
False
)
fixed_total_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"预约上限人数"
)
fixed_usable_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"预约人数"
)
individual_limit
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
team_total_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
team_usable_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
total_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"预约上限人数"
)
usable_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"可预约人数"
)
today
=
Column
(
db
.
DateTime
,
nullable
=
False
,
comment
=
"数据日期"
)
class
DayVisitorCountModel
(
BaseModel
):
__tablename__
=
'day_visitor_count'
id
=
Column
(
Integer
,
primary_key
=
True
,
comment
=
""
)
spot_id
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
spot_name
=
Column
(
String
(
40
,
'utf8mb4_unicode_ci'
),
nullable
=
False
,
comment
=
""
)
foot_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"在园人数"
)
foreigner_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
free_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
left_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"已入园人数"
)
limit_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"当日人数上限"
)
old_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
total_num
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"当日售票人数"
)
today
=
Column
(
db
.
DateTime
,
nullable
=
False
,
comment
=
"数据日期"
)
class
DaySZMuseumVisitorCountModel
(
BaseModel
):
__tablename__
=
'day_sz_museum_visitor_count'
id
=
Column
(
Integer
,
primary_key
=
True
,
comment
=
""
)
spot_id
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
spot_name
=
Column
(
String
(
40
,
'utf8mb4_unicode_ci'
),
nullable
=
False
,
comment
=
""
)
total_count
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"总接待数"
)
current_count
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"在园人数"
)
incount1
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
incount2
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
outcount1
=
Column
(
Integer
,
nullable
=
False
,
comment
=
""
)
outcount2
=
Column
(
Integer
,
nullable
=
False
,
comment
=
"出园人数"
)
today
=
Column
(
db
.
DateTime
,
nullable
=
False
,
comment
=
"数据日期"
)
Model/Garden/__init__.py
0 → 100644
View file @
1270fe0d
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