| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <?php
- namespace App\Module\Farm\Events;
- use App\Module\Farm\Models\FarmLand;
- use App\Module\Farm\Models\FarmCrop;
- use App\Module\Farm\Models\FarmCropLog;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- /**
- * 作物摘取事件
- * 当作物被摘取时触发此事件
- */
- class CropPickedEvent
- {
- use Dispatchable, SerializesModels;
- /**
- * 摘取者ID
- *
- * @var int
- */
- public int $pickerId;
- /**
- * 农场主ID(通过作物获取)
- *
- * @var int
- */
- public int $ownerId;
- /**
- * 土地ID(通过作物获取)
- *
- * @var int
- */
- public int $landId;
- /**
- * 作物ID(摘取目标)
- *
- * @var int
- */
- public int $cropId;
- /**
- * 摘取的物品ID
- *
- * @var int
- */
- public int $itemId;
- /**
- * 摘取数量
- *
- * @var int
- */
- public int $pickAmount;
- /**
- * 摘取前总数量
- *
- * @var int
- */
- public int $originalAmount;
- /**
- * 摘取后剩余数量
- *
- * @var int
- */
- public int $remainingAmount;
- /**
- * 摘取来源
- *
- * @var string
- */
- public string $pickSource;
- /**
- * 来源ID
- *
- * @var int|null
- */
- public ?int $sourceId;
- /**
- * 土地信息对象
- *
- * @var FarmLand
- */
- public FarmLand $land;
- /**
- * 作物信息对象
- *
- * @var FarmCrop
- */
- public FarmCrop $crop;
- /**
- * 作物日志记录对象
- *
- * @var FarmCropLog
- */
- public FarmCropLog $cropLog;
- /**
- * 创建新的事件实例
- *
- * @param int $pickerId 摘取者ID
- * @param int $ownerId 农场主ID
- * @param int $landId 土地ID
- * @param int $cropId 作物ID
- * @param int $itemId 摘取的物品ID
- * @param int $pickAmount 摘取数量
- * @param int $originalAmount 摘取前总数量
- * @param int $remainingAmount 摘取后剩余数量
- * @param string $pickSource 摘取来源
- * @param int|null $sourceId 来源ID
- * @param FarmLand $land 土地信息对象
- * @param FarmCrop $crop 作物信息对象
- * @param FarmCropLog $cropLog 作物日志记录对象
- */
- public function __construct(
- int $pickerId,
- int $ownerId,
- int $landId,
- int $cropId,
- int $itemId,
- int $pickAmount,
- int $originalAmount,
- int $remainingAmount,
- string $pickSource,
- ?int $sourceId,
- FarmLand $land,
- FarmCrop $crop,
- FarmCropLog $cropLog
- ) {
- $this->pickerId = $pickerId;
- $this->ownerId = $ownerId;
- $this->landId = $landId;
- $this->cropId = $cropId;
- $this->itemId = $itemId;
- $this->pickAmount = $pickAmount;
- $this->originalAmount = $originalAmount;
- $this->remainingAmount = $remainingAmount;
- $this->pickSource = $pickSource;
- $this->sourceId = $sourceId;
- $this->land = $land;
- $this->crop = $crop;
- $this->cropLog = $cropLog;
- }
- }
|