| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Module\Fund\Dto;
- /**
- *
- * 转账Dto
- *
- */
- class TransferDto
- {
- /**
- * @var int 转出用户ID
- */
- public int $fromUserId;
- /**
- * @var int 转入用户ID
- */
- public int $toUserId;
- /**
- * @var int 资金类型ID
- */
- public int $fundId;
- /**
- * @var float 金额
- */
- public float $amount;
- /**
- * @var string|null 备注
- */
- public ?string $remark;
- /**
- * @param array $data
- */
- public function __construct(array $data =[])
- {
- $this->fromUserId = $data['from_user_id'] ?? 0;
- $this->toUserId = $data['to_user_id'] ?? 0;
- $this->fundId = $data['fund_id'] ?? 0;
- $this->amount = $data['amount'] ?? 0.00;
- $this->remark = $data['remark'] ?? null;
- }
- /**
- * 转换为数组
- */
- public function toArray(): array
- {
- return [
- 'from_user_id' => $this->fromUserId,
- 'to_user_id' => $this->toUserId,
- 'fund_id' => $this->fundId,
- 'amount' => $this->amount,
- 'remark' => $this->remark,
- ];
- }
- }
|