Commit 782cfe67 authored by 宋柯's avatar 宋柯

监控新的美购同步队列

parent abccff50
...@@ -8,6 +8,7 @@ import redis ...@@ -8,6 +8,7 @@ import redis
from send_msg_to_dingding.send_msg import send_msg_to_dingtalk from send_msg_to_dingding.send_msg import send_msg_to_dingtalk
import datetime, time import datetime, time
token_dict = { token_dict = {
'gaia-dbmw': {'secret': "SECba5212dadad3794b3da51c903c828f60ab8342897af2675f1f48fceb8858eb5c", 'gaia-dbmw': {'secret': "SECba5212dadad3794b3da51c903c828f60ab8342897af2675f1f48fceb8858eb5c",
'access_token': "df546521ce46bfb35025ca266efc2d7e8d708d1c8ada9b15ae487786ad06ad12"}, 'access_token': "df546521ce46bfb35025ca266efc2d7e8d708d1c8ada9b15ae487786ad06ad12"},
...@@ -23,6 +24,8 @@ token_dict = { ...@@ -23,6 +24,8 @@ token_dict = {
'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"}, 'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"},
"graces-es6-tapir-doctor": {'secret': "SEC65d8ac5f9c92677cf0c98624810abc407cf433fd4f2713649dc41310b4658fb5", "graces-es6-tapir-doctor": {'secret': "SEC65d8ac5f9c92677cf0c98624810abc407cf433fd4f2713649dc41310b4658fb5",
'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"}, 'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"},
"graces-es6-tapir-merchant": {'secret': "SEC62645fa89b9a7b910624be1e84bd8fc1a4d59ac79c45f258ab4cee3114fe40ca",
'access_token': "55e2076c095f67939cda6c4e568dddf17fc07977195014696f225e4f66639715"},
"mentha-tapir-answer": {'secret': "SECba5212dadad3794b3da51c903c828f60ab8342897af2675f1f48fceb8858eb5c", "mentha-tapir-answer": {'secret': "SECba5212dadad3794b3da51c903c828f60ab8342897af2675f1f48fceb8858eb5c",
'access_token': "df546521ce46bfb35025ca266efc2d7e8d708d1c8ada9b15ae487786ad06ad12"}, 'access_token': "df546521ce46bfb35025ca266efc2d7e8d708d1c8ada9b15ae487786ad06ad12"},
"graces-tapir-card": {'secret': "SECa54a42411200fd7c642921c35b7d0fe5a71c93e7305091413292bb6cc6cb318c", "graces-tapir-card": {'secret': "SECa54a42411200fd7c642921c35b7d0fe5a71c93e7305091413292bb6cc6cb318c",
...@@ -78,10 +81,10 @@ def len_list_and_send_msg(redis_clint, key_name, rules, per_sec=10): ...@@ -78,10 +81,10 @@ def len_list_and_send_msg(redis_clint, key_name, rules, per_sec=10):
if str_res: if str_res:
if key_name in ["graces-tapir-card","graces-es6-tapir-lbs"]: if key_name in ["graces-tapir-card","graces-es6-tapir-lbs"]:
send_msg_to_dingtalk(str_res, mobiles=["19566173658"], secret=token_dict[key_name]['secret'], send_msg_to_dingtalk(str_res, mobiles=["19566173658"], secret=token_dict[key_name]['secret'],
access_token=token_dict[key_name]['access_token']) access_token=token_dict[key_name]['access_token'],isAtAll=True)
else: else:
send_msg_to_dingtalk(str_res,mobiles=["13552564745","17813268931"], secret=token_dict[key_name]['secret'], send_msg_to_dingtalk(str_res,mobiles=["13552564745","17813268931"], secret=token_dict[key_name]['secret'],
access_token=token_dict[key_name]['access_token']) access_token=token_dict[key_name]['access_token'],isAtAll=True)
if __name__ == "__main__": if __name__ == "__main__":
...@@ -95,12 +98,13 @@ if __name__ == "__main__": ...@@ -95,12 +98,13 @@ if __name__ == "__main__":
"graces-es6-tapir-service": redis_new_gaia, "graces-es6-tapir-service": redis_new_gaia,
"graces-es6-tapir-service_pre": redis_new_gaia, "graces-es6-tapir-service_pre": redis_new_gaia,
"graces-es6-tapir-doctor": redis_new_gaia, "graces-es6-tapir-doctor": redis_new_gaia,
"graces-es6-tapir-merchant": redis_new_gaia,
"mentha-tapir-answer": redis_new_mimas, "mentha-tapir-answer": redis_new_mimas,
"graces-tapir-card":redis_new_gaia, "graces-tapir-card":redis_new_gaia,
"graces-es6-tapir-lbs": redis_new_gaia, "graces-es6-tapir-lbs": redis_new_gaia,
"mentha-tapir-tractate": redis_new_mimas, "mentha-tapir-tractate": redis_new_mimas,
} }
per_sec = 60 * 5 per_sec = 60
last_time = time.time() last_time = time.time()
while True: while True:
now = time.time() now = time.time()
......
...@@ -12,7 +12,7 @@ import json ...@@ -12,7 +12,7 @@ import json
import requests import requests
def send_msg_to_dingtalk(msg, mobiles=[],access_token="",secret=""): def send_msg_to_dingtalk(msg, mobiles=[],access_token="",secret="",isAtAll=False):
try: try:
# secret = "SECba5212dadad3794b3da51c903c828f60ab8342897af2675f1f48fceb8858eb5c" # secret = "SECba5212dadad3794b3da51c903c828f60ab8342897af2675f1f48fceb8858eb5c"
timestamp = str(round(time.time() * 1000)) timestamp = str(round(time.time() * 1000))
...@@ -25,7 +25,7 @@ def send_msg_to_dingtalk(msg, mobiles=[],access_token="",secret=""): ...@@ -25,7 +25,7 @@ def send_msg_to_dingtalk(msg, mobiles=[],access_token="",secret=""):
headers = {"Content-Type": "application/json"} headers = {"Content-Type": "application/json"}
data = {"msgtype": "text", "text": {"content": msg}} data = {"msgtype": "text", "text": {"content": msg}}
if mobiles: if mobiles:
data = {"msgtype": "text", "text": {"content": msg}, "at": {"atMobiles": mobiles, "isAtAll": False}} data = {"msgtype": "text", "text": {"content": msg}, "at": {"atMobiles": mobiles, "isAtAll": isAtAll}}
json_data = json.dumps(data) json_data = json.dumps(data)
# "https://oapi.dingtalk.com/robot/send?access_token=df546521ce46bfb35025ca266efc2d7e8d708d1c8ada9b15ae487786ad06ad12&sign={}&timestamp={}" # "https://oapi.dingtalk.com/robot/send?access_token=df546521ce46bfb35025ca266efc2d7e8d708d1c8ada9b15ae487786ad06ad12&sign={}&timestamp={}"
url = "https://oapi.dingtalk.com/robot/send?access_token={}&sign={}&timestamp={}".format(access_token, url = "https://oapi.dingtalk.com/robot/send?access_token={}&sign={}&timestamp={}".format(access_token,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment