FundBalanceChanged.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace App\Module\Fund\Events;
  3. class FundBalanceChanged
  4. {
  5. /**
  6. * @var int 用户ID
  7. */
  8. public int $userId;
  9. /**
  10. * @var int 资金类型
  11. */
  12. public int $fundId;
  13. /**
  14. * @var float 变动金额
  15. */
  16. public float $amount;
  17. /**
  18. * @var float 变动前余额
  19. */
  20. public float $beforeBalance;
  21. /**
  22. * @var float 变动后余额
  23. */
  24. public float $afterBalance;
  25. /**
  26. * @var string 操作类型
  27. */
  28. public string $operateType;
  29. /**
  30. * @var string 操作ID
  31. */
  32. public string $operateId;
  33. /**
  34. * @var string 备注
  35. */
  36. public string $remark;
  37. /**
  38. * @param array $data
  39. */
  40. public function __construct(array $data)
  41. {
  42. $this->userId = $data['user_id'];
  43. $this->fundId = $data['fund_id'];
  44. $this->amount = $data['amount'];
  45. $this->beforeBalance = $data['before_balance'];
  46. $this->afterBalance = $data['after_balance'];
  47. $this->operateType = $data['operate_type'];
  48. $this->operateId = $data['operate_id'];
  49. $this->remark = $data['remark'] ?? '';
  50. }
  51. }