Compare commits

..

No commits in common. "272459eb2da95d10617435851d3462ca2d683d27" and "bbbe62613ccf28782d3e2d802d46b75b13f55c45" have entirely different histories.

4 changed files with 7 additions and 41 deletions

View File

@ -1,6 +1,5 @@
FROM python:3.11.4 FROM python:3.11.4
USER root
ENV APP_HOME=/app ENV APP_HOME=/app
RUN mkdir $APP_HOME RUN mkdir $APP_HOME
WORKDIR $APP_HOME WORKDIR $APP_HOME

View File

@ -11,7 +11,6 @@ from apps.jqr.tasks import save_add_contact, delete_add_contact, edit_add_contac
from apps.msg.models import TbMessage from apps.msg.models import TbMessage
from apps.msg.pubsub import JQRMSGPubSub from apps.msg.pubsub import JQRMSGPubSub
from apps.qc.choices import QcCorpInfoCallbackStatusChoices from apps.qc.choices import QcCorpInfoCallbackStatusChoices
from apps.qc.models import QcQrcodes
from libs.weworkapi.callback.WXBizMsgCrypt3 import WXBizMsgCrypt, Prpcrypt from libs.weworkapi.callback.WXBizMsgCrypt3 import WXBizMsgCrypt, Prpcrypt
from utils.tools import sha1_encoder, get_attribute, camel_to_snake from utils.tools import sha1_encoder, get_attribute, camel_to_snake
import xml.etree.cElementTree as ET import xml.etree.cElementTree as ET
@ -105,17 +104,10 @@ class WechatEncryptSerializer(serializers.Serializer):
state = data.get('state') state = data.get('state')
data['corpid'] = corp.corpid data['corpid'] = corp.corpid
if state and state.startswith('mg') and '_' in state: if state and state.startswith('mg') and '_' in state:
[_, uid, qrcodeid] = state.split('_') [_, _, qrcodeid] = state.split('_')
data['qrcodeid'] = qrcodeid data['qrcodeid'] = qrcodeid
data['agentid'] = corp.agentid data['agentid'] = corp.agentid
data['uid'] = uid data['uid'] = corp.uid
qrcode = QcQrcodes.objects.filter(id=qrcodeid, uid=uid).first()
if not qrcode:
return
data['qrcodeid'] = qrcodeid
data['agentid'] = qrcode.agentid
data['uid'] = uid
data['corpid'] = qrcode.corpid
# save_add_contact.delay(data, corp.to_dict(['corpid', 'appsecret'])) # save_add_contact.delay(data, corp.to_dict(['corpid', 'appsecret']))
JQREventNewUserCallbackPubSub.publish({ JQREventNewUserCallbackPubSub.publish({
'handler': f'{save_add_contact_by_channel.__module__}.{save_add_contact_by_channel.__name__}', 'handler': f'{save_add_contact_by_channel.__module__}.{save_add_contact_by_channel.__name__}',
@ -134,17 +126,10 @@ class WechatEncryptSerializer(serializers.Serializer):
state = data.get('state') state = data.get('state')
data['corpid'] = corp.corpid data['corpid'] = corp.corpid
if state and state.startswith('mg') and '_' in state: if state and state.startswith('mg') and '_' in state:
[_, uid, qrcodeid] = state.split('_') [_, _, qrcodeid] = state.split('_')
data['qrcodeid'] = qrcodeid data['qrcodeid'] = qrcodeid
data['agentid'] = corp.agentid data['agentid'] = corp.agentid
data['uid'] = uid data['uid'] = corp.uid
qrcode = QcQrcodes.objects.filter(id=qrcodeid, uid=uid).first()
if not qrcode:
return
data['qrcodeid'] = qrcodeid
data['agentid'] = qrcode.agentid
data['uid'] = uid
data['corpid'] = qrcode.corpid
# edit_add_contact.delay(data, corp.to_dict(['corpid', 'appsecret'])) # edit_add_contact.delay(data, corp.to_dict(['corpid', 'appsecret']))
JQREventCallbackPubSub.publish({ JQREventCallbackPubSub.publish({
'handler': f'{edit_add_contact_by_channel.__module__}.{edit_add_contact_by_channel.__name__}', 'handler': f'{edit_add_contact_by_channel.__module__}.{edit_add_contact_by_channel.__name__}',
@ -163,17 +148,10 @@ class WechatEncryptSerializer(serializers.Serializer):
state = data.get('state') state = data.get('state')
data['corpid'] = corp.corpid data['corpid'] = corp.corpid
if state and state.startswith('mg') and '_' in state: if state and state.startswith('mg') and '_' in state:
[_, uid, qrcodeid] = state.split('_') [_, _, qrcodeid] = state.split('_')
data['qrcodeid'] = qrcodeid data['qrcodeid'] = qrcodeid
data['agentid'] = corp.agentid data['agentid'] = corp.agentid
data['uid'] = uid data['uid'] = corp.uid
qrcode = QcQrcodes.objects.filter(id=qrcodeid, uid=uid).first()
if not qrcode:
return
data['qrcodeid'] = qrcodeid
data['agentid'] = qrcode.agentid
data['uid'] = uid
data['corpid'] = qrcode.corpid
# save_add_contact.delay(data, corp.to_dict(['corpid', 'appsecret'])) # save_add_contact.delay(data, corp.to_dict(['corpid', 'appsecret']))
JQREventNewUserCallbackPubSub.publish({ JQREventNewUserCallbackPubSub.publish({
'handler': f'{save_add_contact_by_channel.__module__}.{save_add_contact_by_channel.__name__}', 'handler': f'{save_add_contact_by_channel.__module__}.{save_add_contact_by_channel.__name__}',
@ -192,17 +170,8 @@ class WechatEncryptSerializer(serializers.Serializer):
state = data.get('state') state = data.get('state')
data['corpid'] = corp.corpid data['corpid'] = corp.corpid
if state and state.startswith('mg') and '_' in state: if state and state.startswith('mg') and '_' in state:
[_, uid, qrcodeid] = state.split('_')
data['qrcodeid'] = qrcodeid
data['agentid'] = corp.agentid data['agentid'] = corp.agentid
data['uid'] = uid data['uid'] = corp.uid
qrcode = QcQrcodes.objects.filter(id=qrcodeid, uid=uid).first()
if not qrcode:
return
data['qrcodeid'] = qrcodeid
data['agentid'] = qrcode.agentid
data['uid'] = uid
data['corpid'] = qrcode.corpid
# delete_add_contact.delay(data, corp.to_dict(['corpid', 'appsecret'])) # delete_add_contact.delay(data, corp.to_dict(['corpid', 'appsecret']))
JQREventCallbackPubSub.publish({ JQREventCallbackPubSub.publish({
'handler': f'{delete_add_contact_by_channel.__module__}.{delete_add_contact_by_channel.__name__}', 'handler': f'{delete_add_contact_by_channel.__module__}.{delete_add_contact_by_channel.__name__}',

View File

@ -7,7 +7,6 @@ services:
context: . context: .
dockerfile: ./Dockerfile dockerfile: ./Dockerfile
command: ./start command: ./start
restart: always
environment: environment:
- api=true - api=true
volumes: volumes:

1
start
View File

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
gunicorn -c yzk_wechat_event/gunicorn.conf.py yzk_wechat_event.wsgi:application & gunicorn -c yzk_wechat_event/gunicorn.conf.py yzk_wechat_event.wsgi:application &
echo '121.41.112.68 qyapi.weixin.qq.com' >> /etc/hosts &
tail -f logs/*.log tail -f logs/*.log