test_speaker 接口
This commit is contained in:
parent
a0f11e8af7
commit
33775bf669
|
@ -17,6 +17,7 @@ from apps.third.clients import dhClient
|
||||||
from apps.third.models import TDevice
|
from apps.third.models import TDevice
|
||||||
from apps.utils.sms import send_sms
|
from apps.utils.sms import send_sms
|
||||||
from apps.utils.speech import generate_voice
|
from apps.utils.speech import generate_voice
|
||||||
|
from apps.third.clients import spClient
|
||||||
|
|
||||||
from apps.utils.viewsets import CustomGenericViewSet
|
from apps.utils.viewsets import CustomGenericViewSet
|
||||||
from apps.utils.wx import wxClient
|
from apps.utils.wx import wxClient
|
||||||
|
@ -249,6 +250,12 @@ class TestViewSet(CustomGenericViewSet):
|
||||||
check_not_in_place(Opl.objects.get(id='1568880208688320512'))
|
check_not_in_place(Opl.objects.get(id='1568880208688320512'))
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
|
@action(methods=['post'], detail=False, serializer_class=Serializer)
|
||||||
|
def test_speaker(self, request, pk=None):
|
||||||
|
spClient.speak(path='/media/2022/09/11/349b3451-50b9-4501-aded-c85a76967920.mp3', sns=request.data['sns'],
|
||||||
|
v_num=2)
|
||||||
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, serializer_class=Serializer)
|
@action(methods=['post'], detail=False, serializer_class=Serializer)
|
||||||
def send_wx_msg(self, request, pk=None):
|
def send_wx_msg(self, request, pk=None):
|
||||||
"""微信模板消息发送测试
|
"""微信模板消息发送测试
|
||||||
|
|
|
@ -91,11 +91,11 @@ class XxListener(stomp.ConnectionListener):
|
||||||
print('received a message "%s"' % frame.body)
|
print('received a message "%s"' % frame.body)
|
||||||
|
|
||||||
|
|
||||||
# if settings.XX_ENABLED:
|
if settings.XX_ENABLED:
|
||||||
# c = stomp.Connection([(settings.XX_MQ_HOST, settings.XX_MQ_PORT)])
|
c = stomp.Connection([(settings.XX_MQ_HOST, settings.XX_MQ_PORT)])
|
||||||
# c.set_listener('', XxListener())
|
c.set_listener('', XxListener())
|
||||||
# c.connect(settings.XX_USERNAME, settings.XX_LICENCE)
|
c.connect(settings.XX_USERNAME, settings.XX_LICENCE)
|
||||||
# c.subscribe(settings.XX_QUEUE, id='')
|
c.subscribe(settings.XX_QUEUE, id='')
|
||||||
|
|
||||||
|
|
||||||
class XxCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
class XxCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
||||||
|
|
Loading…
Reference in New Issue