Browse Source

修改通道名接口

locky 5 months ago
parent
commit
84536d90ef
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Controller/EquipmentManagerV3.py

+ 5 - 1
Controller/EquipmentManagerV3.py

@@ -769,7 +769,11 @@ class EquipmentManagerV3(View):
             return response.json(444)
         try:
             # 更新通道名
-            UidChannelSetModel.objects.filter(uid__uid=uid, channel=int(channel)).update(channel_name=channel_name)
+            channel = int(channel) + 1
+            uid_channel_set_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel)
+            if not uid_channel_set_qs.exists():
+                return response.json(173)
+            uid_channel_set_qs.update(channel_name=channel_name)
             return response.json(0)
         except Exception as e:
             return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))