id = $model->id; $dto->adminId = $model->admin_id; $dto->userId = $model->user_id; $dto->type = $model->type; $dto->desc = $model->desc; $dto->expTime = $model->exp_time; $dto->reId = $model->re_id; $dto->reType = $model->re_type; $dto->status = $model->status; $dto->createdAt = $model->created_at ? $model->created_at->toDateTimeString() : ''; $dto->updatedAt = $model->updated_at ? $model->updated_at->toDateTimeString() : ''; return $dto; } /** * 转换为数组 * * @return array */ public function toArray(): array { return [ 'id' => $this->id, 'admin_id' => $this->adminId, 'user_id' => $this->userId, 'type' => $this->type->value, 'type_name' => $this->type->name, 'desc' => $this->desc, 'exp_time' => $this->expTime, 're_id' => $this->reId, 're_type' => $this->reType, 'status' => $this->status->value, 'status_name' => $this->status->name, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, ]; } }