Merge branch 'master' of https://e.coding.net/ctcdevteam/ehs/ehs_server
This commit is contained in:
commit
c403b9161a
|
@ -14,6 +14,7 @@ from apps.enm.tasks import cal_mpointstats_duration
|
|||
from apps.enm.services import king_sync, MpointCache
|
||||
from django.db import transaction
|
||||
from datetime import datetime
|
||||
from django.utils.timezone import localtime
|
||||
from apps.enm.services import get_analyse_data_mgroups_duration
|
||||
|
||||
|
||||
|
@ -54,9 +55,15 @@ class MpointViewSet(CustomModelViewSet):
|
|||
|
||||
@transaction.atomic
|
||||
def perform_update(self, serializer):
|
||||
instance = serializer.save()
|
||||
instance: Mpoint = serializer.save()
|
||||
if instance.code:
|
||||
MpointCache(instance.code).get(True)
|
||||
if instance.enabled is False:
|
||||
mc = MpointCache(instance.code)
|
||||
now = localtime()
|
||||
mc.set_fail(-2, now)
|
||||
|
||||
|
||||
|
||||
@action(methods=["post"], detail=False, perms_map={"post": "mpoint.create"}, serializer_class=Serializer)
|
||||
def king_sync(self, request, *args, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue