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
f53ff517
Commit
f53ff517
authored
Nov 04, 2020
by
魏强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
弹出数量超过五台,短信提醒;
parent
77b3c9b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
Controller/ToolController.py
+15
-0
Service/SMSService.py
+11
-0
No files found.
Controller/ToolController.py
View file @
f53ff517
...
@@ -11,7 +11,9 @@ from Model.Base import db
...
@@ -11,7 +11,9 @@ 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.Machine.TakeoutToolModel
import
TakeoutTool
from
Model.Power.PowerModel
import
Power
from
Model.Power.PowerModel
import
Power
from
Model.Spot.SpotModel
import
Spot
from
Redis_Cache
import
redis
from
Redis_Cache
import
redis
from
Service.SMSService
import
SMSService
from
Service.ToolService
import
ToolService
from
Service.ToolService
import
ToolService
from
Config.common_config
import
NEW_ONENET_CONFIG
as
new_onenet_config
,
ONENET_CONFIG
as
onenet_config
,
\
from
Config.common_config
import
NEW_ONENET_CONFIG
as
new_onenet_config
,
ONENET_CONFIG
as
onenet_config
,
\
TAKEOUT_RECORD_MAC_NO
TAKEOUT_RECORD_MAC_NO
...
@@ -120,6 +122,19 @@ def take_out_multiple():
...
@@ -120,6 +122,19 @@ def take_out_multiple():
db
.
session
.
add
(
takeout_tool
)
db
.
session
.
add
(
takeout_tool
)
db
.
session
.
commit
()
db
.
session
.
commit
()
time
.
sleep
(
3
)
time
.
sleep
(
3
)
# 当弹出充电宝数量大于5台时,给管理员手机发送短信
cur_take_out_num
=
len
(
hatch_no_list
)
if
cur_take_out_num
>=
5
:
cur_user_name
=
g
.
user
.
user_name
cur_user_phone
=
g
.
user
.
phone
cur_spot_name
=
Spot
.
query
.
filter_by
(
id
=
machine_info
.
spot_id
)
.
first
()
.
spotname
# 发短信
sms
=
SMSService
()
sms
.
phoneSendTips
(
cur_user_name
,
cur_spot_name
,
mac_no
,
cur_take_out_num
,
cur_user_phone
,
'18068402080'
,
'灰兔智能'
)
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
:
redis_result
=
redis
.
get
(
'M_TKO_C_{}'
.
format
(
machine_info
.
mac_no
))
redis_result
=
redis
.
get
(
'M_TKO_C_{}'
.
format
(
machine_info
.
mac_no
))
...
...
Service/SMSService.py
View file @
f53ff517
...
@@ -62,6 +62,17 @@ class SMSService():
...
@@ -62,6 +62,17 @@ class SMSService():
print
(
e
)
print
(
e
)
return
return
def
phoneSendTips
(
self
,
user_name
,
spot_name
,
mac_no
,
num
,
from_phone
,
to_phone
,
sign
=
'灰兔智能'
):
params
=
[
user_name
,
spot_name
,
mac_no
,
num
,
from_phone
]
try
:
result
=
self
.
ssender
.
send_with_param
(
86
,
to_phone
,
766214
,
params
,
sign
=
sign
,
extend
=
""
,
ext
=
''
)
return
result
except
HTTPError
as
e
:
print
(
e
)
except
Exception
as
e
:
print
(
e
)
return
def
phoneSendCodeWithContent
(
self
,
phoneNumber
,
tempId
,
Content
,
sign
=
'灰兔智能'
):
def
phoneSendCodeWithContent
(
self
,
phoneNumber
,
tempId
,
Content
,
sign
=
'灰兔智能'
):
'''
'''
发送验证码
发送验证码
...
...
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