事件回调修改
This commit is contained in:
parent
238e00d2fc
commit
1a3b8a6751
|
@ -59,8 +59,8 @@ class JQRQrcodeCallbackPubSub:
|
|||
handler(qrcodeid, userid, externaluserid, corpinfo)
|
||||
|
||||
|
||||
# if not settings.DEBUG:
|
||||
t = Thread(target=JQREventCallbackPubSub.event_callback_listener)
|
||||
t.start()
|
||||
t2 = Thread(target=JQRQrcodeCallbackPubSub.qrcode_callback_listener)
|
||||
t2.start()
|
||||
if not settings.DEBUG:
|
||||
t = Thread(target=JQREventCallbackPubSub.event_callback_listener)
|
||||
t.start()
|
||||
t2 = Thread(target=JQRQrcodeCallbackPubSub.qrcode_callback_listener)
|
||||
t2.start()
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db.models import Count, Sum, When, Case, Value
|
|||
|
||||
from apps.jqr.choices import JqrWechatbizuserinfoDeleteTypeChoices, JqrAddTypeChoices
|
||||
from apps.jqr.pubsub import JQRQrcodeCallbackPubSub
|
||||
from apps.jqr.ws import WS
|
||||
from apps.qc.choices import QcWechatbizeventAddcontactIsDeleteChoices, QcQrcodesEditLogOperateTypeChoices, \
|
||||
QcQrcodesEditLogTypeChoices
|
||||
from apps.qc.models import QcWechatbizeventAddcontact, QcQrcodes, QcWechatbizuserinfo, QcQrcodesEditLog, QcCorpinfo
|
||||
|
@ -76,7 +77,7 @@ def save_add_contact_by_channel(data, corpinfo, *args, **kwargs):
|
|||
})
|
||||
# 修复客户关系
|
||||
edit_add_contact(data, corpinfo, *args, **kwargs)
|
||||
# TODO 请求API 发送消息
|
||||
WS.transfer_external_userid_to_vid(f'{corpid}_{userid}', externaluserid)
|
||||
|
||||
|
||||
@shared_task(name='edit_add_contact', queue='contact')
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
import requests
|
||||
|
||||
|
||||
class WS:
|
||||
BASE_URL = f'http://ws.xbtool.cn'
|
||||
|
||||
@classmethod
|
||||
def transfer_external_userid_to_vid(cls, client_id, external_user_ids):
|
||||
payload = {
|
||||
"clientId": client_id,
|
||||
"externalUserIds": external_user_ids
|
||||
}
|
||||
url = f'{cls.BASE_URL}/api/hook/websocket/transferexternaluseridtovid'
|
||||
response = requests.post(url, json=payload)
|
||||
|
||||
@classmethod
|
||||
def transfer_groupid_to_roomid(cls, client_id, group_ids):
|
||||
payload = {
|
||||
"clientId": client_id,
|
||||
"groupIds": group_ids
|
||||
}
|
||||
url = f'{cls.BASE_URL}/api/hook/websocket/transferexternaluseridtovid'
|
||||
response = requests.post(url, json=payload)
|
||||
|
||||
@classmethod
|
||||
def send_wx_work_msg(cls):
|
||||
url = f'{cls.BASE_URL}/api/hook/websocket/sendwxworkmsg'
|
|
@ -43,6 +43,6 @@ class JQRMSGPubSub:
|
|||
cls.msg_list.clear()
|
||||
|
||||
|
||||
# if not settings.DEBUG:
|
||||
t = Thread(target=JQRMSGPubSub.listen)
|
||||
t.start()
|
||||
if not settings.DEBUG:
|
||||
t = Thread(target=JQRMSGPubSub.listen)
|
||||
t.start()
|
||||
|
|
Loading…
Reference in New Issue