| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace App\Module\Task\Events;
- /**
- * 任务奖励领取事件
- *
- * 当用户领取任务奖励时触发此事件
- */
- class TaskRewardClaimedEvent
- {
- /**
- * 用户ID
- *
- * @var int
- */
- public int $userId;
-
- /**
- * 任务ID
- *
- * @var int
- */
- public int $taskId;
-
- /**
- * 任务名称
- *
- * @var string
- */
- public string $taskName;
-
- /**
- * 实际发放的奖励
- *
- * @var array
- */
- public array $rewards;
-
- /**
- * 领取时间
- *
- * @var string
- */
- public string $claimedAt;
-
- /**
- * 奖励是否成功发放
- *
- * @var bool
- */
- public bool $isSuccess;
-
- /**
- * 创建一个新的事件实例
- *
- * @param int $userId 用户ID
- * @param int $taskId 任务ID
- * @param string $taskName 任务名称
- * @param array $rewards 实际发放的奖励
- * @param string $claimedAt 领取时间
- * @param bool $isSuccess 奖励是否成功发放
- */
- public function __construct(
- int $userId,
- int $taskId,
- string $taskName,
- array $rewards,
- string $claimedAt,
- bool $isSuccess
- ) {
- $this->userId = $userId;
- $this->taskId = $taskId;
- $this->taskName = $taskName;
- $this->rewards = $rewards;
- $this->claimedAt = $claimedAt;
- $this->isSuccess = $isSuccess;
- }
- }
|