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
9ac16817
Commit
9ac16817
authored
Sep 15, 2020
by
Aeolus
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
3ccce0e1
ec7f590e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
2 deletions
+36
-2
Controller/AccountController.py
+4
-0
Controller/ToolController.py
+12
-1
Model/Machine/TakeoutToolModel.py
+17
-0
Service/ReportService.py
+2
-1
Service/SpotService.py
+1
-0
No files found.
Controller/AccountController.py
View file @
9ac16817
...
@@ -35,6 +35,7 @@ def edit_user():
...
@@ -35,6 +35,7 @@ def edit_user():
user_name
=
json_data
[
'name'
]
if
'name'
in
json_data
else
'SSW'
user_name
=
json_data
[
'name'
]
if
'name'
in
json_data
else
'SSW'
password
=
json_data
[
'password'
]
if
'password'
in
json_data
else
''
password
=
json_data
[
'password'
]
if
'password'
in
json_data
else
''
comment
=
json_data
[
'comment'
]
if
'comment'
in
json_data
else
''
comment
=
json_data
[
'comment'
]
if
'comment'
in
json_data
else
''
level
=
json_data
[
'level'
]
if
'level'
in
json_data
else
''
spot_list
=
json_data
[
'spot_list'
]
if
'spot_list'
in
json_data
else
[]
spot_list
=
json_data
[
'spot_list'
]
if
'spot_list'
in
json_data
else
[]
if
not
old_phone
:
if
not
old_phone
:
return
jsonify
(
BASE_RESPONSE
(
error_code
=-
1
,
error_message
=
'old phone is null'
)
.
to_dict
())
return
jsonify
(
BASE_RESPONSE
(
error_code
=-
1
,
error_message
=
'old phone is null'
)
.
to_dict
())
...
@@ -57,6 +58,9 @@ def edit_user():
...
@@ -57,6 +58,9 @@ def edit_user():
agent_info
.
phone
=
new_phone
agent_info
.
phone
=
new_phone
agent_info
.
comment
=
comment
agent_info
.
comment
=
comment
if
level
:
agent_info
.
level
=
int
(
level
)
if
password
:
if
password
:
salt
=
AgentService
.
gene_salt
()
salt
=
AgentService
.
gene_salt
()
agent_info
.
salt_pwd
=
salt
agent_info
.
salt_pwd
=
salt
...
...
Controller/ToolController.py
View file @
9ac16817
...
@@ -2,13 +2,14 @@
...
@@ -2,13 +2,14 @@
import
datetime
import
datetime
import
time
import
time
from
flask
import
Blueprint
,
jsonify
,
request
from
flask
import
Blueprint
,
jsonify
,
request
,
g
from
Libs.ErrorTips
import
MACHINE_NOT_EXIST_ERROR
,
MACHINE_HATCH_NOT_ILLEGAL
,
MACHINE_NOT_ONLINE
,
BASE_RESPONSE
from
Libs.ErrorTips
import
MACHINE_NOT_EXIST_ERROR
,
MACHINE_HATCH_NOT_ILLEGAL
,
MACHINE_NOT_ONLINE
,
BASE_RESPONSE
from
Libs.Onenet.Message.Message
import
CommandMessage
from
Libs.Onenet.Message.Message
import
CommandMessage
from
Libs.Onenet.OneNetApi
import
OneNetApi
from
Libs.Onenet.OneNetApi
import
OneNetApi
from
Model.Base
import
db
from
Model.Base
import
db
from
Model.Machine.MachineModel
import
Machine
from
Model.Machine.MachineModel
import
Machine
from
Model.Machine.TakeoutToolModel
import
TakeoutTool
from
Model.Power.PowerModel
import
Power
from
Model.Power.PowerModel
import
Power
from
Redis_Cache
import
redis
from
Redis_Cache
import
redis
from
Service.ToolService
import
ToolService
from
Service.ToolService
import
ToolService
...
@@ -95,19 +96,29 @@ def take_out_multiple():
...
@@ -95,19 +96,29 @@ def take_out_multiple():
else
:
else
:
one_api
=
OneNetApi
(
onenet_config
[
"api_key"
],
onenet_config
[
"url"
])
one_api
=
OneNetApi
(
onenet_config
[
"api_key"
],
onenet_config
[
"url"
])
result
=
one_api
.
send_data_to_edp
(
command_message
.
get_device_id
(),
1
,
0
,
command_message
.
pack
())
result
=
one_api
.
send_data_to_edp
(
command_message
.
get_device_id
(),
1
,
0
,
command_message
.
pack
())
takeout_tool
=
TakeoutTool
()
takeout_tool
.
customer_id
=
g
.
user
.
id
takeout_tool
.
mac_no
=
mac_no
takeout_tool
.
spot_id
=
machine_info
.
spot_id
takeout_tool
.
hatch_no
=
i
if
'errno'
in
result
.
keys
()
and
result
[
'errno'
]
==
0
:
if
'errno'
in
result
.
keys
()
and
result
[
'errno'
]
==
0
:
if
result
[
'error'
]
==
'succ'
:
if
result
[
'error'
]
==
'succ'
:
data
[
i
]
=
'success'
data
[
i
]
=
'success'
Power
.
query
.
filter_by
(
hatch_no
=
i
,
machine_id
=
machine_info
.
id
)
.
update
({
'status'
:
8
,
'has_power'
:
0
})
Power
.
query
.
filter_by
(
hatch_no
=
i
,
machine_id
=
machine_info
.
id
)
.
update
({
'status'
:
8
,
'has_power'
:
0
})
db
.
session
.
commit
()
db
.
session
.
commit
()
take_out_success_number
+=
1
take_out_success_number
+=
1
takeout_tool
.
status
=
1
else
:
else
:
data
[
i
]
=
'fail'
data
[
i
]
=
'fail'
takeout_tool
.
status
=
0
else
:
else
:
if
'error_message'
in
result
.
keys
():
if
'error_message'
in
result
.
keys
():
data
[
i
]
=
result
[
'error_message'
]
data
[
i
]
=
result
[
'error_message'
]
else
:
else
:
data
[
i
]
=
'fail'
data
[
i
]
=
'fail'
takeout_tool
.
status
=
0
db
.
session
.
add
(
takeout_tool
)
db
.
session
.
commit
()
time
.
sleep
(
3
)
time
.
sleep
(
3
)
try
:
try
:
if
take_out_success_number
>
0
and
machine_info
.
mac_no
in
TAKEOUT_RECORD_MAC_NO
:
if
take_out_success_number
>
0
and
machine_info
.
mac_no
in
TAKEOUT_RECORD_MAC_NO
:
...
...
Model/Machine/TakeoutToolModel.py
0 → 100644
View file @
9ac16817
# -*- coding: utf-8 -*-
__author__
=
'weiqiang'
__date__
=
'2020/9/10 11:07'
from
sqlalchemy
import
Column
,
Integer
,
FetchedValue
,
String
from
Model.Base
import
BaseModel
class
TakeoutTool
(
BaseModel
):
__tablename__
=
'takeout_tool'
id
=
Column
(
Integer
,
primary_key
=
True
)
customer_id
=
Column
(
Integer
,
nullable
=
False
,
comment
=
'用户id'
)
mac_no
=
Column
(
String
(
16
,
'utf8mb4_unicode_ci'
),
nullable
=
False
,
comment
=
'机柜编号'
)
spot_id
=
Column
(
Integer
,
nullable
=
False
,
comment
=
'景点id'
)
hatch_no
=
Column
(
Integer
,
nullable
=
False
,
comment
=
'弹出的仓口号'
)
status
=
Column
(
Integer
,
nullable
=
False
,
server_default
=
FetchedValue
(),
comment
=
'状态:0弹出失败,1弹出成功'
)
Service/ReportService.py
View file @
9ac16817
...
@@ -220,6 +220,7 @@ class ReportService():
...
@@ -220,6 +220,7 @@ class ReportService():
Rent
.
spot_id
==
spot_id
,
Rent
.
spot_id
==
spot_id
,
}
}
income
=
0
income
=
0
total
=
0
if
data_type
==
1
:
if
data_type
==
1
:
where
.
add
(
Rent
.
created_at
>=
date
+
' 00:00:00'
)
where
.
add
(
Rent
.
created_at
>=
date
+
' 00:00:00'
)
where
.
add
(
Rent
.
created_at
<=
date
+
' 23:59:59'
)
where
.
add
(
Rent
.
created_at
<=
date
+
' 23:59:59'
)
...
@@ -243,4 +244,4 @@ class ReportService():
...
@@ -243,4 +244,4 @@ class ReportService():
}
}
data
.
append
(
tmp
)
data
.
append
(
tmp
)
return
income
,
total
_rent
,
data
return
income
,
total
,
data
Service/SpotService.py
View file @
9ac16817
...
@@ -35,6 +35,7 @@ class SpotService():
...
@@ -35,6 +35,7 @@ class SpotService():
cur_info
[
'agent_name'
]
=
info
.
AgentAccount
.
user_name
cur_info
[
'agent_name'
]
=
info
.
AgentAccount
.
user_name
cur_info
[
'phone'
]
=
info
.
AgentAccount
.
phone
cur_info
[
'phone'
]
=
info
.
AgentAccount
.
phone
cur_info
[
'comment'
]
=
info
.
AgentAccount
.
comment
cur_info
[
'comment'
]
=
info
.
AgentAccount
.
comment
cur_info
[
'level'
]
=
info
.
AgentAccount
.
level
cur_info
[
'spot_info'
]
=
SpotService
.
get_spot_agent
(
info
.
AgentAccount
.
id
)
cur_info
[
'spot_info'
]
=
SpotService
.
get_spot_agent
(
info
.
AgentAccount
.
id
)
total_info
.
append
(
cur_info
)
total_info
.
append
(
cur_info
)
return
total_info
return
total_info
...
...
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