PetRemouldEvent.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Module\Pet\Events;
  3. use Illuminate\Broadcasting\InteractsWithSockets;
  4. use Illuminate\Foundation\Events\Dispatchable;
  5. use Illuminate\Queue\SerializesModels;
  6. /**
  7. * 宠物洗髓事件
  8. *
  9. * 当宠物进行洗髓操作时触发此事件,允许其他系统响应宠物品阶的变化。
  10. * 此事件可用于更新宠物属性、记录洗髓日志、处理品阶变化效果等。
  11. */
  12. class PetRemouldEvent
  13. {
  14. use Dispatchable, InteractsWithSockets, SerializesModels;
  15. /**
  16. * 用户ID
  17. *
  18. * @var int
  19. */
  20. public int $userId;
  21. /**
  22. * 宠物ID
  23. *
  24. * @var int
  25. */
  26. public int $petId;
  27. /**
  28. * 旧品阶
  29. *
  30. * @var int
  31. */
  32. public int $oldGrade;
  33. /**
  34. * 新品阶
  35. *
  36. * @var int
  37. */
  38. public int $newGrade;
  39. /**
  40. * 创建一个新的事件实例
  41. *
  42. * @param int $userId 用户ID
  43. * @param int $petId 宠物ID
  44. * @param int $oldGrade 旧品阶
  45. * @param int $newGrade 新品阶
  46. * @return void
  47. */
  48. public function __construct(int $userId, int $petId, int $oldGrade, int $newGrade)
  49. {
  50. $this->userId = $userId;
  51. $this->petId = $petId;
  52. $this->oldGrade = $oldGrade;
  53. $this->newGrade = $newGrade;
  54. }
  55. }