add message

This commit is contained in:
baoliang 2021-03-29 21:02:26 +08:00
parent 04641c02d3
commit b177a38d5f
15 changed files with 2 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -68,12 +68,13 @@ def create_task(request):
task=task, category=2, image=picture) task=task, category=2, image=picture)
for group in groups: for group in groups:
users = Group_user.objects.filter(group_id=group) users = Group_user.objects.filter(group_id=group)
phones = []
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) content = '%s在群组“%s”发布了任务,请查收消息' % (creater_profile, u.group.name)
Notice.create_normal_notice(u.user_id, content, group) Notice.create_normal_notice(u.user_id, content, group)
phones = [u.user.username for u in users] phones.append(u.user.username)
send_tnps(phones, '任务', content) send_tnps(phones, '任务', content)
return JsonResponse({'status': 'success'}) return JsonResponse({'status': 'success'})