|
@@ -9,31 +9,33 @@ class BlackHole implements BIMContact
|
|
|
{
|
|
|
public function uploadFile(UploadedFile $file, array $params = [])
|
|
|
{
|
|
|
- //$this->addLeafNodes(['Node1', 'Node2'], config("bim.black_hole.project_id"));
|
|
|
-
|
|
|
$projectId = config("bim.black_hole.project_id");
|
|
|
$treeInfo = $this->getTreeById($projectId);
|
|
|
|
|
|
$modelFile = $this->modelFileCreate($projectId, $treeInfo['subNodes'][0]['nodeId'], $file);
|
|
|
+ $dataSetId = $modelFile['dataSetId'];
|
|
|
|
|
|
$uploadFormData = [
|
|
|
['name' => 'FileId', 'contents' => $modelFile['fileId']],
|
|
|
- ['name' => 'FileInfo', 'contents' => $file],
|
|
|
+ ['name' => 'FileInfo', 'contents' => fopen($file, 'r'), 'filename' => $file->getClientOriginalName()],
|
|
|
['name' => 'FileDataId', 'contents' => $modelFile['fileDataId']],
|
|
|
- ['name' => 'Key', 'contents' => uniqid()],
|
|
|
+ ['name' => 'Key', 'contents' => $modelFile['extraProperties']['ResumableKey']],
|
|
|
['name' => 'BlobIndex', 'contents' => 0],
|
|
|
];
|
|
|
|
|
|
- $result = Client::getInstance()->post("/blackHole3D/project/modelFile/append", [
|
|
|
+ Client::getInstance()->post("/blackHole3D/project/modelFile/append", [
|
|
|
'multipart' => $uploadFormData,
|
|
|
'headers' => [
|
|
|
'fileUploadScheme' => 'Bim',
|
|
|
- 'fileUploadMode' => 'ResumableCreate'
|
|
|
- ]
|
|
|
+ 'fileUploadMode' => 'ResumableAppend',
|
|
|
+ ],
|
|
|
]);
|
|
|
|
|
|
- dump($result);
|
|
|
-
|
|
|
+ return [
|
|
|
+ 'bim_data_set_id' => $dataSetId,
|
|
|
+ 'bim_file_id' => $modelFile['fileId'],
|
|
|
+ 'bim_convert_status' => 0,
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
public function downloadSourceFile()
|
|
@@ -74,7 +76,7 @@ class BlackHole implements BIMContact
|
|
|
];
|
|
|
|
|
|
$result = Client::getInstance()->post("/blackHole3D/project/modelFile/addToConvertQueue", [
|
|
|
- 'json' => $formData
|
|
|
+ 'json' => $formData,
|
|
|
]);
|
|
|
|
|
|
return $result['data'] ?? [];
|