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