user.py 339 B

1234567891011121314
  1. class User:
  2. """用户模型"""
  3. def __init__(self, id, username, email):
  4. self.id = id
  5. self.username = username
  6. self.email = email
  7. def to_dict(self):
  8. """转换为字典"""
  9. return {
  10. 'id': self.id,
  11. 'username': self.username,
  12. 'email': self.email
  13. }