Skip to content

Instantly share code, notes, and snippets.

@celery_app.task
def send_phone_code(user_id, verify_token, phone_number):
customer = Customer.objects.get(id=user_id)
#发送短信
send_message(...)
try:
# 通知任务完成
Group('phone_verify-%s' % customer.username).send({
'text': json.dumps({
'success': True,
'msg': 'new message sent'
})
})
except Exception as e:
# # 通知任务失败
Group('phone_verify-%s' % customer.username).send({
'text': json.dumps({
'success': False,
'msg': e.msg
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment