steam-server/app/utils/result.py
2024-12-13 18:21:25 +08:00

20 lines
488 B
Python

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)