1234567891011121314151617181920212223242526272829 |
- # -*- coding: utf-8 -*-
- """
- demeter web
- name:admin.py
- author:rabin
- """
- import time
- from demeter.core import *
- timeSleep = 60
- # 更改设备状态(离线)
- class Device(object):
- def run(self):
- self.handle()
- time.sleep(timeSleep)
- def handle(self):
- model = Demeter.model('device_info')
- cur = Demeter.time() - 1800
- model.cdate.assign(cur, '<=')
- model.status = True
- data = model.select()
- for v in data:
- model.id = v['id']
- if v['hardware_type'] == 5:
- model.update(value='0', status=False)
- elif v['hardware_type'] != 7 and v['hardware_type'] != 6:
- model.update(status=False)
|