type = $disasterInfo['type'] ?? 0; $dto->typeName = DISASTER_TYPE::getName($dto->type); $dto->generatedAt = $disasterInfo['generated_ts'] ?? ''; $dto->status = $disasterInfo['status'] ?? 'active'; $dto->clearedAt = $disasterInfo['cleared_at'] ?? null; return $dto; } /** * 转换为数组 * * @return array */ public function toArray(): array { return [ 'type' => $this->type, 'type_name' => $this->typeName, 'generated_ts' => $this->generatedAt, 'status' => $this->status, 'cleared_at' => $this->clearedAt, ]; } }