add message

This commit is contained in:
baoliang 2021-04-07 18:49:36 +08:00
parent b177a38d5f
commit b39a8e6664
2 changed files with 7 additions and 6 deletions

View File

@ -167,12 +167,12 @@ if __name__ == '__main__':
# 'https://mp.weixin.qq.com/s/EhX0Pm1e0FAfse0zz9ow8Q') # 'https://mp.weixin.qq.com/s/EhX0Pm1e0FAfse0zz9ow8Q')
# og_title, og_description, og_url, og_image = parse( # og_title, og_description, og_url, og_image = parse(
# 'https://m.toutiao.com/i6883651337003729420/?tt_from=weixin&utm_campaign=client_share&app=news_article&utm_source=weixin&iid=1494959660475024&utm_medium=toutiao_android&wxshare_count=1') # 'https://m.toutiao.com/i6883651337003729420/?tt_from=weixin&utm_campaign=client_share&app=news_article&utm_source=weixin&iid=1494959660475024&utm_medium=toutiao_android&wxshare_count=1')
# og_title, og_description, og_url, og_image = parse( og_title, og_description, og_url, og_image = parse(
# 'http://www.gov.cn/xinwen/2020-10/13/content_5550906.htm') 'http://www.gov.cn/fuwu/2021-04/07/content_5598150.htm')
# og_title, og_description, og_url, og_image = parse( # og_title, og_description, og_url, og_image = parse(
# 'http://gansu.gansudaily.com.cn/system/2021/01/25/030261998.shtml') # 'http://gansu.gansudaily.com.cn/system/2021/01/25/030261998.shtml')
# print(og_title, og_description, og_url, og_image) print(og_title, og_description, og_url, og_image)
# print(send_voice_notify('13993199566')) # print(send_voice_notify('13993199566'))
r = send_tnps(['13609346975'], 'title with content', 'content 通知') # r = send_tnps(['13609346975'], 'title with content', 'content 通知')
print(r.status_code, r.text) # print(r.status_code, r.text)

View File

@ -72,7 +72,8 @@ def create_task(request):
for u in users: for u in users:
profile = Userprofile.objects.filter(user_id=u.user_id).first() profile = Userprofile.objects.filter(user_id=u.user_id).first()
if profile and profile.status == 1: if profile and profile.status == 1:
content = '%s在群组“%s”发布了任务,请查收消息' % (creater_profile, u.group.name) g = Group.objects.get(id=group)
content = '%s在群组“%s”发布了任务,请查收消息' % (creater_profile, g.name)
Notice.create_normal_notice(u.user_id, content, group) Notice.create_normal_notice(u.user_id, content, group)
phones.append(u.user.username) phones.append(u.user.username)
send_tnps(phones, '任务', content) send_tnps(phones, '任务', content)