| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace App\Module\Game\Dtos;
- /**
- * 条件项DTO
- */
- class ConditionItemDto
- {
- /**
- * 条件项ID
- *
- * @var int
- */
- public int $id;
- /**
- * 条件组ID
- *
- * @var int
- */
- public int $groupId;
- /**
- * 条件类型
- *
- * @var int
- */
- public int $conditionType;
- /**
- * 目标ID
- *
- * @var int
- */
- public int $targetId;
- /**
- * 比较运算符
- *
- * @var int
- */
- public int $operator;
- /**
- * 比较值
- *
- * @var int
- */
- public int $value;
- /**
- * 参数1
- *
- * @var int
- */
- public int $param1;
- /**
- * 参数2
- *
- * @var int
- */
- public int $param2;
- /**
- * 额外数据
- *
- * @var array|null
- */
- public ?array $extraData;
- /**
- * 从模型创建DTO
- *
- * @param \App\Module\Game\Models\GameConditionItem $model
- * @return self
- */
- public static function fromModel($model): self
- {
- $dto = new self();
- $dto->id = $model->id;
- $dto->groupId = $model->group_id;
- $dto->conditionType = $model->condition_type;
- $dto->targetId = $model->target_id;
- $dto->operator = $model->operator;
- $dto->value = $model->value;
- $dto->param1 = $model->param1;
- $dto->param2 = $model->param2;
- $dto->extraData = $model->extra_data;
- return $dto;
- }
- }
|