| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Module\Point\Dto;
- /**
- * 积分DTO类
- *
- * 用于传输积分相关数据
- */
- class PointDto
- {
- public int $id;
- public int $user_id;
- public int $point_id;
- public int $balance;
- public int $create_time;
- public int $update_time;
- public function __construct(array $data = [])
- {
- $this->id = $data['id'] ?? 0;
- $this->user_id = $data['user_id'] ?? 0;
- $this->point_id = $data['point_id'] ?? 0;
- $this->balance = $data['balance'] ?? 0;
- $this->create_time = $data['create_time'] ?? 0;
- $this->update_time = $data['update_time'] ?? 0;
- }
- /**
- * 转换为数组
- *
- * @return array
- */
- public function toArray(): array
- {
- return [
- 'id' => $this->id,
- 'user_id' => $this->user_id,
- 'point_id' => $this->point_id,
- 'balance' => $this->balance,
- 'create_time' => $this->create_time,
- 'update_time' => $this->update_time,
- ];
- }
- }
|