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
03dec1dc
Commit
03dec1dc
authored
Sep 01, 2020
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关帝庙机柜弹出数量通知
parent
e4150830
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
2 deletions
+46
-2
Config/common_config.py
+1
-1
Service/SMSService.py
+5
-1
takeout_number_notice.py
+40
-0
No files found.
Config/common_config.py
View file @
03dec1dc
...
...
@@ -75,4 +75,4 @@ ACCOUNT_STATUS = {
'delete'
:
2
}
TAKEOUT_RECORD_MAC_NO
=
(
'1909033201020158'
,
'1909033201020159'
)
TAKEOUT_RECORD_MAC_NO
=
(
'1909033201020158'
,
'1909033201020159'
,
)
Service/SMSService.py
View file @
03dec1dc
...
...
@@ -2,7 +2,7 @@
import
random
import
string
from
qcloudsms_py
import
SmsSingleSender
from
qcloudsms_py
import
SmsSingleSender
,
SmsMultiSender
from
qcloudsms_py.httpclient
import
HTTPError
from
Config.common_config
import
SMS_CONFIG
from
Libs.Logger
import
logger
...
...
@@ -15,6 +15,7 @@ class SMSService():
self
.
appKey
=
SMS_CONFIG
[
'app_key'
]
try
:
self
.
ssender
=
SmsSingleSender
(
self
.
appid
,
self
.
appKey
)
self
.
msender
=
SmsMultiSender
(
self
.
appid
,
self
.
appKey
)
except
Exception
as
e
:
print
(
e
)
...
...
@@ -70,6 +71,9 @@ class SMSService():
:return:
'''
try
:
if
isinstance
(
phoneNumber
,
list
):
result
=
self
.
msender
.
send_with_param
(
86
,
phoneNumber
,
tempId
,
Content
,
sign
=
sign
,
extend
=
""
,
ext
=
''
)
else
:
result
=
self
.
ssender
.
send_with_param
(
86
,
phoneNumber
,
tempId
,
Content
,
sign
=
sign
,
extend
=
""
,
ext
=
''
)
return
result
except
HTTPError
as
e
:
...
...
takeout_number_notice.py
0 → 100644
View file @
03dec1dc
import
datetime
import
os
from
logging
import
getLogger
,
DEBUG
,
StreamHandler
,
Formatter
from
redis
import
StrictRedis
from
Config.common_config
import
TAKEOUT_RECORD_MAC_NO
from
Service.SMSService
import
SMSService
logger
=
getLogger
(
__name__
)
logger
.
setLevel
(
DEBUG
)
console_handler
=
StreamHandler
()
console_handler
.
setLevel
(
DEBUG
)
formatter
=
Formatter
(
"
%(asctime)
s -
%(filename)
s -[line:
%(lineno)
d] -
%(levelname)
s:
%(message)
s"
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
console_handler
.
setFormatter
(
formatter
)
logger
.
addHandler
(
console_handler
)
is_prod
=
os
.
getenv
(
"RUN_ENV"
,
"test"
)
==
'prod'
# is_prod = True
if
is_prod
:
redis
=
StrictRedis
(
host
=
'172.17.0.5'
,
port
=
6379
,
db
=
0
,
password
=
'Boosal2014'
)
else
:
redis
=
StrictRedis
(
host
=
'49.235.36.102'
,
port
=
16379
,
db
=
0
,
password
=
'Boosal2014'
)
try
:
for
mac_no
in
TAKEOUT_RECORD_MAC_NO
:
redis_result
=
redis
.
get
(
'M_TKO_C_{}'
.
format
(
mac_no
))
logger
.
info
(
redis_result
)
if
redis_result
:
take_out_date
,
take_out_number
=
str
(
redis_result
,
encoding
=
'utf-8'
)
.
split
(
'_'
)
take_out_number
=
int
(
take_out_number
)
today_date
=
datetime
.
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
if
take_out_date
==
today_date
:
Content
=
[
mac_no
,
take_out_number
]
phone_number
=
[
18068402080
,
15103485838
]
sms
=
SMSService
()
result
=
sms
.
phoneSendCodeWithContent
(
phone_number
,
707999
,
Content
)
print
(
result
)
except
Exception
as
e
:
logger
.
info
(
e
)
exit
(
1
)
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