user post create bug

This commit is contained in:
曹前明 2022-06-23 13:45:29 +08:00
parent dac1063b81
commit 168b933945
3 changed files with 12 additions and 11 deletions

View File

@ -6,7 +6,7 @@ class EcmService:
@staticmethod
def dispatch_dahua_alarm(data:dict):
"""分发大华事件
"""分发大华报警进行处理
Args:
data (dict): 信息

View File

@ -353,18 +353,18 @@ class UserPostViewSet(CreateModelMixin, DestroyModelMixin, ListModelMixin, Custo
def perform_create(self, serializer):
instance = serializer.save()
user = instance.user
adept = UserPost.objects.filter(user=user).order_by('sort', 'create_time').first()
if adept:
user.belong_dept = adept
up = UserPost.objects.filter(user=user).order_by('sort', 'create_time').first()
if up:
user.belong_dept = up.dept
user.update_by = self.request.user
user.save()
def perform_destroy(self, instance):
user = instance.user
instance.delete(update_by=self.request.user)
fdept = UserPost.objects.filter(user=user).order_by('sort', 'create_time').first()
if fdept:
user.belong_dept = fdept
up = UserPost.objects.filter(user=user).order_by('sort', 'create_time').first()
if up:
user.belong_dept = up.dept
else:
user.belong_dept = None
user.update_by = self.request.user

View File

@ -73,6 +73,7 @@ class XxListener(stomp.ConnectionListener):
print('received an error "%s"' % frame.body)
def on_message(self, frame):
data=frame.body
print('received a message "%s"' % frame.body)
@ -183,8 +184,8 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
],
"subsystem": {
"subsystemType": 0,
"name": "10.21.25.158_8000",
"magic": "10.21.25.158_8000"
"name": "10.0.11.101_8000",
"magic": "10.0.11.101_8000"
}
}
}
@ -200,7 +201,7 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
取消事件订阅
"""
dhClient.request(**dhapis['mq_unsubscribe'],
params={'name': '10.21.25.158_8000'})
params={'name': '10.0.11.101_8000'})
return Response()
@action(methods=['post'], detail=False,