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