TeamProfitCreatedEvent.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Module\Farm\Events;
  3. use App\Module\Farm\Models\FarmHarvestLog;
  4. use App\Module\Farm\Models\FarmTeamProfit;
  5. use Illuminate\Broadcasting\InteractsWithSockets;
  6. use Illuminate\Foundation\Events\Dispatchable;
  7. use Illuminate\Queue\SerializesModels;
  8. /**
  9. * 团队收益创建事件
  10. *
  11. * 当团队成员收获作物产生团队收益时触发
  12. */
  13. class TeamProfitCreatedEvent
  14. {
  15. use Dispatchable, InteractsWithSockets, SerializesModels;
  16. /**
  17. * 获得收益的用户ID
  18. *
  19. * @var int
  20. */
  21. public $userId;
  22. /**
  23. * 团队成员ID
  24. *
  25. * @var int
  26. */
  27. public $teamMemberId;
  28. /**
  29. * 收获记录
  30. *
  31. * @var FarmHarvestLog
  32. */
  33. public $harvestLog;
  34. /**
  35. * 团队收益记录
  36. *
  37. * @var FarmTeamProfit
  38. */
  39. public $teamProfit;
  40. /**
  41. * 创建一个新的事件实例
  42. *
  43. * @param int $userId
  44. * @param int $teamMemberId
  45. * @param FarmHarvestLog $harvestLog
  46. * @param FarmTeamProfit $teamProfit
  47. * @return void
  48. */
  49. public function __construct(
  50. int $userId,
  51. int $teamMemberId,
  52. FarmHarvestLog $harvestLog,
  53. FarmTeamProfit $teamProfit
  54. ) {
  55. $this->userId = $userId;
  56. $this->teamMemberId = $teamMemberId;
  57. $this->harvestLog = $harvestLog;
  58. $this->teamProfit = $teamProfit;
  59. }
  60. }