from data import MySQLTool import hashlib import uuid import TokenUtils from returnTemp import get_template, get_error_message import json from datetime import datetime class TikTask: def __init__(self, action, data, logger): self.action = action self.data = data self.logger = logger def tik_task_router(self): if self.action == "create": return self.create() elif self.action == "status": return self.status() elif self.action == "signcheck": return self.signcheck() elif self.action == "signset": return self.signset() else: return self.test() def create(self): print("---create---") return create(self.data) def status(self): print("---status----") return status(self.data) def signcheck(self): print("---signcheck----") return signcheck() def signset(self): print("---signset----") return signset(self.data) def test(self): return self.data def signcheck(): with open('needsign.json') as json_file: r = json.load(json_file) return r def signset(data): with open('needsign.json', 'w') as json_file: json.dump(data, json_file) with open('needsign.json') as json_file: r = json.load(json_file) now = datetime.now() formatted_time = now.strftime("%Y-%m-%d %H:%M:%S") r["changetime"] = formatted_time return r def create(data): return data def status(data): return data