def exposed_resume_all(self): w5_timer.resume_all() Timer.where("id", "!=", "0").update({ 'status': 1, 'update_time': Time.get_date_time() })
def exposed_pause_all(self): w5_timer.pause_all() Timer.where("id", "!=", "0").update({ 'status': 0, 'update_time': Time.get_date_time() })
def exposed_remove(self, timer_app=None): if timer_app: Timer.where('timer_uuid', timer_app).delete() w5_timer.remove_job(timer_app) else: Timer.where('timer_uuid', self.w_timer_app).delete() w5_timer.remove_job(self.w_timer_app)
def update_timer(self): self.load_config() if self.config["type"] == "date": w5_timer.update_date(self.timer_app, self.config["time"]) elif self.config["type"] == "interval": w5_timer.update_interval(self.timer_app, self.config["interval_type"], int(self.config["time"]), start_date=self.config["start_date_x"], end_date=self.config["end_date_x"], jitter=self.config["jitter"]) elif self.config["type"] == "cron": w5_timer.update_cron(self.timer_app, self.config["time"], start_date=self.config["start_date_x"], end_date=self.config["end_date_x"], jitter=self.config["jitter"]) Timer.where('timer_uuid', self.timer_app).update({ "type": self.config["type"], 'interval_type': self.config["interval_type"], 'time': self.config["time"], 'start_date': self.config["start_date"], 'end_date': self.config["end_date"], 'jitter': self.config["jitter"], 'update_time': Time.get_date_time() })
def exposed_resume(self, uuid=None): if uuid: w5_timer.resume(uuid=uuid) Timer.where('timer_uuid', uuid).update({ 'status': 1, 'update_time': Time.get_date_time() }) else: w5_timer.resume(uuid=self.w_timer_app) Timer.where('timer_uuid', self.w_timer_app).update({ 'status': 1, 'update_time': Time.get_date_time() })