Commit 96ec2a51 authored by TesterYao's avatar TesterYao

增加流量线测试群提醒

parent d4a12bdc
from time import sleep
import requests import requests
URL = 'https://engine.tuia.cn/apollo/getIdMapStrByKeyStr?keyStr=onlin.watch.list' URL = 'https://engine.tuia.cn/apollo/getIdMapStrByKeyStr?keyStr=onlin.watch.list'
...@@ -9,7 +11,9 @@ def get_watcher_list(business): ...@@ -9,7 +11,9 @@ def get_watcher_list(business):
print(r.json()) print(r.json())
return r.json().get(business) return r.json().get(business)
else: else:
sleep(1500)
get_watcher_list('cx') get_watcher_list('cx')
except: except:
sleep(1500)
get_watcher_list('cx') get_watcher_list('cx')
...@@ -44,49 +44,61 @@ class Task: ...@@ -44,49 +44,61 @@ class Task:
@classmethod @classmethod
def zhiban(cls): def zhiban(cls):
ll_zhibanren = get_watcher_list('media') ll_zhibanren = get_watcher_list('media')
ll_pepole = [i for i in ll_zhibanren.keys()]
ll_num = [i for i in ll_zhibanren.values()]
gg_zhibanren = get_watcher_list('advert') gg_zhibanren = get_watcher_list('advert')
gg_pepole = [i for i in gg_zhibanren.keys()]
gg_num = [i for i in gg_zhibanren.values()]
cx_zhibanren = get_watcher_list('cx') cx_zhibanren = get_watcher_list('cx')
cx_pepole = [i for i in cx_zhibanren.keys()]
cx_num = [i for i in cx_zhibanren.values()]
bq_zhibanren = get_watcher_list('bq') bq_zhibanren = get_watcher_list('bq')
bq_pepole = [i for i in bq_zhibanren.keys()]
bq_num = [i for i in bq_zhibanren.values()]
# 获取当天日期 # 获取当天日期
currentdate = datetime.date.today() currentdate = datetime.date.today()
currentday = calendar.weekday(currentdate.year, currentdate.month, currentdate.day) currentday = calendar.weekday(currentdate.year, currentdate.month, currentdate.day)
ll_text = '今日技术值班人:' + get_watcher_list('media')[currentday][0] + ',请关注问题反馈群,及时跟进群任务' ll_text = '今日技术值班人:' + ll_pepole[currentday] + ',请关注问题反馈群,及时跟进群任务'
ll_at = {'atMobiles': [ll_zhibanren[currentday][1]]} ll_at = {'atMobiles': [ll_num[currentday]]}
Remind.send_messages(ll_token, ll_secret, ll_text, ll_at) Remind.send_messages(ll_token, ll_secret, ll_text, ll_at)
gg_text = '今日技术值班人:' + gg_zhibanren[currentday][0] + ',请关注问题反馈群,及时跟进群任务' gg_text = '今日技术值班人:' + gg_pepole[currentday] + ',请关注问题反馈群,及时跟进群任务'
gg_at = {'atMobiles': [gg_zhibanren[currentday][1]]} gg_at = {'atMobiles': [gg_num[currentday]]}
Remind.send_messages(gg_token, gg_secret, gg_text, gg_at) Remind.send_messages(gg_token, gg_secret, gg_text, gg_at)
cx_text = '今日技术值班人:' + cx_zhibanren[currentday][0] + ',请关注问题反馈群,及时跟进群任务' cx_text = '今日技术值班人:' + cx_pepole[currentday] + ',请关注问题反馈群,及时跟进群任务'
cx_at = {'atMobiles': [cx_zhibanren[currentday][1]]} cx_at = {'atMobiles': [cx_num[currentday]]}
Remind.send_messages(cx_token, cx_secret, cx_text, cx_at) Remind.send_messages(cx_token, cx_secret, cx_text, cx_at)
bq_text = '今日技术值班人:' + bq_zhibanren[currentday][0] + ',请关注问题反馈群,及时跟进群任务' bq_text = '今日技术值班人:' + bq_pepole[currentday] + ',请关注问题反馈群,及时跟进群任务'
bq_at = {'atMobiles': [bq_zhibanren[currentday][1]]} bq_at = {'atMobiles': [bq_num[currentday]]}
Remind.send_messages(bq_token, bq_secret, bq_text, bq_at) Remind.send_messages(bq_token, bq_secret, bq_text, bq_at)
@classmethod @classmethod
def zhiban1(cls): def zhiban1(cls):
ll_zhibanren = get_watcher_list('media') ll_zhibanren = get_watcher_list('media')
ll_num = [i for i in ll_zhibanren.values()]
gg_zhibanren = get_watcher_list('advert') gg_zhibanren = get_watcher_list('advert')
gg_num = [i for i in gg_zhibanren.values()]
cx_zhibanren = get_watcher_list('cx') cx_zhibanren = get_watcher_list('cx')
cx_num = [i for i in cx_zhibanren.values()]
bq_zhibanren = get_watcher_list('bq') bq_zhibanren = get_watcher_list('bq')
bq_num = [i for i in bq_zhibanren.values()]
# 获取当天日期 # 获取当天日期
currentdate = datetime.date.today() currentdate = datetime.date.today()
currentday = calendar.weekday(currentdate.year, currentdate.month, currentdate.day) currentday = calendar.weekday(currentdate.year, currentdate.month, currentdate.day)
ll_text = '@'+ll_zhibanren[currentday][1]+',值班同学辛苦啦~ ' \ ll_text = '@'+ll_num[currentday]+',值班同学辛苦啦~ ' \
'\n> **不要忘记发值班日报并记录值班问题哦~** [去记录](http://cf.dui88.com/pages/viewpage.action?pageId=99955951) ' '\n> **不要忘记发值班日报并记录值班问题哦~** [去记录](http://cf.dui88.com/pages/viewpage.action?pageId=99955951) '
ll_at = {'atMobiles': [ll_zhibanren[currentday][1]]} ll_at = {'atMobiles': [ll_num[currentday]]}
Remind.send_markdown(ll_token, ll_secret, '值班提醒', ll_text, ll_at) Remind.send_markdown(ll_token, ll_secret, '值班提醒', ll_text, ll_at)
gg_text = '@' + gg_zhibanren[currentday][1] + ',值班同学辛苦啦~ ' \ gg_text = '@' + gg_num[currentday] + ',值班同学辛苦啦~ ' \
'\n> **不要忘记发值班日报并记录值班问题哦~** [去记录](http://cf.dui88.com/pages/viewpage.action?pageId=99951008) ' '\n> **不要忘记发值班日报并记录值班问题哦~** [去记录](http://cf.dui88.com/pages/viewpage.action?pageId=99951008) '
gg_at = {'atMobiles': [gg_zhibanren[currentday][1]]} gg_at = {'atMobiles': [gg_num[currentday]]}
Remind.send_markdown(gg_token, gg_secret, '值班提醒', gg_text, gg_at) Remind.send_markdown(gg_token, gg_secret, '值班提醒', gg_text, gg_at)
cx_text = '@' + cx_zhibanren[currentday][1] + ',值班同学辛苦啦~ ' \ cx_text = '@' + cx_num[currentday] + ',值班同学辛苦啦~ ' \
'\n> **不要忘记发值班日报并记录值班问题哦~** [去记录](http://cf.dui88.com/pages/viewpage.action?pageId=111230681) ' '\n> **不要忘记发值班日报并记录值班问题哦~** [去记录](http://cf.dui88.com/pages/viewpage.action?pageId=111230681) '
cx_at = {'atMobiles': [cx_zhibanren[currentday][1]]} cx_at = {'atMobiles': [cx_num[currentday]]}
Remind.send_markdown(cx_token, cx_secret, '值班提醒', cx_text, cx_at) Remind.send_markdown(cx_token, cx_secret, '值班提醒', cx_text, cx_at)
bq_text = '@' + bq_zhibanren[currentday][1] + ',值班同学辛苦啦~ ' \ bq_text = '@' + bq_num[currentday] + ',值班同学辛苦啦~ ' \
'\n> **不要忘记发值班日报并记录值班问题哦~** [去记录](http://cf.dui88.com/pages/viewpage.action?pageId=92509345) ' '\n> **不要忘记发值班日报并记录值班问题哦~** [去记录](http://cf.dui88.com/pages/viewpage.action?pageId=92509345) '
bq_at = {'atMobiles': [bq_zhibanren[currentday][1]]} bq_at = {'atMobiles': [bq_num[currentday]]}
Remind.send_markdown(bq_token, bq_secret, '值班提醒', bq_text, bq_at) Remind.send_markdown(bq_token, bq_secret, '值班提醒', bq_text, bq_at)
@classmethod @classmethod
......
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