本文整理汇总了Python中sensor.Sensor.delSensor方法的典型用法代码示例。如果您正苦于以下问题:Python Sensor.delSensor方法的具体用法?Python Sensor.delSensor怎么用?Python Sensor.delSensor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sensor.Sensor
的用法示例。
在下文中一共展示了Sensor.delSensor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delStation
# 需要导入模块: from sensor import Sensor [as 别名]
# 或者: from sensor.Sensor import delSensor [as 别名]
def delStation(inData):
'''
:param: inData
:return: {1:'success', 2:'failed', 3:'permission denied', 4:'param wrong'}
'''
from user import User
from sensor import Sensor
if(('UserId' in inData) and ('StationId' in inData)):
updateUserLevel = session.query(User.level).filter(User.id == inData['UserId'], User.valid == 1).first()
if(updateUserLevel == None or int(updateUserLevel[0] != 0)):
return 3
else:
session.query(Station).filter(Station.id == inData['StationId'], Station.valid == 1).update({'valid':0, 'time':datetime.now()})
delSensorId = session.query(Sensor.id).filter(Sensor.stationId == inData['StationId'], Sensor.valid == 1).all()
for sensorId in delSensorId:
Sensor.delSensor({'UserId':inData['UserId'], 'SensorId':int(sensorId[0])})
session.commit()
return 1
else:
return 4
示例2:
# 需要导入模块: from sensor import Sensor [as 别名]
# 或者: from sensor.Sensor import delSensor [as 别名]
from sensor import Sensor
#ret=Sensor.check('sensor-name-test', 'sensor-number-test', 'sesnor-ip-test', 'sensor-mac-test', 1)
#ret = Sensor.check('')
#ret = Sensor.updateSensor({'UserId':2,'SensorId':2, 'Mac':'qe:rq:tq'})
ret = Sensor.delSensor({'UserId':2, 'SensorId':2})
print(ret)
#tmp=Sensor.info({})
#print('111')
#print(tmp)