class Result: code:str = "" msg:str = "" data:object = None success:bool = False def __init__(self, code:str, msg:str, data:object, success:bool) -> None: self.code = code self.msg = msg self.data = data self.success = success @staticmethod def ok(data): return Result("0000", "操作成功", data, True) @staticmethod def error(self, code:str, message:str): return Result(code, message, None, False)