PointAdminDto.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Module\Point\Dto;
  3. /**
  4. * 积分管理DTO类
  5. *
  6. * 用于传输积分管理相关数据
  7. */
  8. class PointAdminDto
  9. {
  10. public int $id;
  11. public int $user_id;
  12. public int $point_id;
  13. public int $admin_id;
  14. public int $total_points;
  15. public string $remark;
  16. public int $create_time;
  17. public function __construct(array $data = [])
  18. {
  19. $this->id = $data['id'] ?? 0;
  20. $this->user_id = $data['user_id'] ?? 0;
  21. $this->point_id = $data['point_id'] ?? 0;
  22. $this->admin_id = $data['admin_id'] ?? 0;
  23. $this->total_points = $data['total_points'] ?? 0;
  24. $this->remark = $data['remark'] ?? '';
  25. $this->create_time = $data['create_time'] ?? 0;
  26. }
  27. /**
  28. * 转换为数组
  29. *
  30. * @return array
  31. */
  32. public function toArray(): array
  33. {
  34. return [
  35. 'id' => $this->id,
  36. 'user_id' => $this->user_id,
  37. 'point_id' => $this->point_id,
  38. 'admin_id' => $this->admin_id,
  39. 'total_points' => $this->total_points,
  40. 'remark' => $this->remark,
  41. 'create_time' => $this->create_time,
  42. ];
  43. }
  44. }