You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
692 B

class MobileCodePresenter:
"""
MobileCodePresenter 类用于将手机验证码数据封装成字典形式。
该类接收一个验证码数据,并提供一个方法将其转换为适合展示或传输的字典格式。
"""
def __init__(self, data):
"""
初始化 MobileCodePresenter 类的实例。
Args:
data: 要封装的手机验证码数据。
"""
self.data = data
def as_dict(self):
"""
将手机验证码数据转换为字典形式。
Returns:
dict: 包含手机验证码的字典,键为 "code"
"""
return {
"code": self.data
}