1234567891011121314151617181920212223242526272829303132 |
- # -*- coding: utf-8 -*-
- """
- demeter web
- name:admin.py
- author:rabin
- """
- import time
- from demeter.core import *
- timeSleep = 60
- # 设置过期时间
- class Timing(object):
- def run(self):
- self.handle()
- time.sleep(timeSleep)
- # 开关设备
- def switch(self, value):
- Demeter.service('device').switchMul(value)
- def handle(self):
- model = Demeter.model('device_set_timing')
- model.status = 0
- cur = Demeter.time()
- model.zdate.assign(cur, '<=')
- data = model.select()
- if data:
- for value in data:
- self.switch(value)
- model.id = value['id']
- model.update(status=1)
|