rabin 8 年 前
コミット
e06e73eddf
1 ファイル変更6 行追加6 行削除
  1. 6 6
      service/device.py

+ 6 - 6
service/device.py

@@ -55,16 +55,16 @@ class Device(object):
 		model = Demeter.model('device_info')
 		model.id = device_id
 		info = model.select(type='fetchone')
+		# 如果有批量控制,还要保存mul的id
+		if mul:
+			model = Demeter.model('device_mul_queue')
+			model.mul_id = mul
+			model.device_id = info['id']
+			model.insert()
 		if info and info['status'] == True:
 			# 设置为loading状态,cxnum保存当前的值
 			model.id = device_id
 			model.update(exp='-1', cxnum=switch)
-			# 如果有批量控制,还要保存mul的id
-			if mul:
-				model = Demeter.model('device_mul_queue')
-				model.mul_id = mul
-				model.device_id = info['id']
-				model.insert()
 
 			model = Demeter.model('device_gateway')
 			model.id = info['gateway_id']