| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace App\Module\Game\Events;
- use App\Module\Game\Dtos\RewardItemDto;
- use Illuminate\Broadcasting\InteractsWithSockets;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- /**
- * 奖励发放事件
- *
- * 当奖励成功发放给用户时触发
- */
- class RewardGrantedEvent
- {
- use Dispatchable, InteractsWithSockets, SerializesModels;
- /**
- * 用户ID
- *
- * @var int
- */
- public int $userId;
- /**
- * 奖励组ID
- *
- * @var int
- */
- public int $groupId;
- /**
- * 奖励组编码
- *
- * @var string
- */
- public string $groupCode;
- /**
- * 来源类型
- *
- * @var string
- */
- public string $sourceType;
- /**
- * 来源ID
- *
- * @var int
- */
- public int $sourceId;
- /**
- * 发放的奖励项
- *
- * @var RewardItemDto[]
- */
- public array $items;
- /**
- * 创建一个新的事件实例
- *
- * @param int $userId 用户ID
- * @param int $groupId 奖励组ID
- * @param string $groupCode 奖励组编码
- * @param string $sourceType 来源类型
- * @param int $sourceId 来源ID
- * @param RewardItemDto[] $items 发放的奖励项
- */
- public function __construct(int $userId, int $groupId, string $groupCode, string $sourceType, int $sourceId, array $items)
- {
- $this->userId = $userId;
- $this->groupId = $groupId;
- $this->groupCode = $groupCode;
- $this->sourceType = $sourceType;
- $this->sourceId = $sourceId;
- $this->items = $items;
- }
- }
|