Compare commits

...

10 Commits

Author SHA1 Message Date
AKW 272459eb2d 添加正向代理 2024-01-12 15:17:25 +08:00
AKW 6d05cf0f8e 添加正向代理 2024-01-12 15:17:13 +08:00
AKW 7501df4da8 添加正向代理 2024-01-12 15:15:12 +08:00
AKW 9087bf70ef 添加正向代理 2024-01-12 15:11:05 +08:00
AKW 7bf9cc5656 添加正向代理 2024-01-12 15:10:11 +08:00
AKW f51830377d 添加正向代理 2024-01-12 15:08:20 +08:00
AKW 85c0a2fefb 添加正向代理 2024-01-12 14:58:47 +08:00
AKW f3884b89e5 修改 2024-01-11 14:09:43 +08:00
AKW 90b9e947c8 修改 2024-01-04 14:33:08 +08:00
AKW 7765a378fd 修改 2024-01-04 14:04:24 +08:00
4 changed files with 41 additions and 7 deletions

View File

@ -1,5 +1,6 @@
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,6 +11,7 @@ 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
@ -104,10 +105,17 @@ 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:
[_, _, qrcodeid] = state.split('_') [_, uid, qrcodeid] = state.split('_')
data['qrcodeid'] = qrcodeid data['qrcodeid'] = qrcodeid
data['agentid'] = corp.agentid data['agentid'] = corp.agentid
data['uid'] = corp.uid data['uid'] = 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__}',
@ -126,10 +134,17 @@ 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:
[_, _, qrcodeid] = state.split('_') [_, uid, qrcodeid] = state.split('_')
data['qrcodeid'] = qrcodeid data['qrcodeid'] = qrcodeid
data['agentid'] = corp.agentid data['agentid'] = corp.agentid
data['uid'] = corp.uid data['uid'] = 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__}',
@ -148,10 +163,17 @@ 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:
[_, _, qrcodeid] = state.split('_') [_, uid, qrcodeid] = state.split('_')
data['qrcodeid'] = qrcodeid data['qrcodeid'] = qrcodeid
data['agentid'] = corp.agentid data['agentid'] = corp.agentid
data['uid'] = corp.uid data['uid'] = 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__}',
@ -170,8 +192,17 @@ 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'] = corp.uid data['uid'] = 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,6 +7,7 @@ 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,4 +1,5 @@
#!/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