|
@@ -49,6 +49,7 @@ class AppearanceImport extends RowAction
|
|
|
DistAppearanceTemplate::deleteTemplates(0, $appearanceId);
|
|
|
// 导入模板
|
|
|
$this->readDirectory($path);
|
|
|
+ // 更新状态
|
|
|
DistAppearance::setStatusToImported($appearanceId);
|
|
|
// 返回响应结果并刷新页面
|
|
|
return $this->response()->success("Successfully imported")->refresh();
|
|
@@ -90,15 +91,16 @@ class AppearanceImport extends RowAction
|
|
|
//echo "文件夹: $fullPath<br />";
|
|
|
//插数据库
|
|
|
$filePath = str_replace($this->sourcePath, '', $fullPath);
|
|
|
- $newParentId = DistAppearanceTemplate::insertTemplateFolder(0, $this->appearanceId, $filePath, $parentId);
|
|
|
+ $fileName = basename($fullPath);
|
|
|
+ $newParentId = DistAppearanceTemplate::insertTemplateFolder(0, $this->appearanceId, $filePath,$fileName, $parentId);
|
|
|
$this->readDirectory($fullPath,$newParentId); // 递归调用
|
|
|
} else {
|
|
|
// 如果是文件,读取文件内容
|
|
|
$content = file_get_contents($fullPath);
|
|
|
$filePath = str_replace($this->sourcePath, '', $fullPath);
|
|
|
- $filePath = str_replace('/' .$file, '', $filePath);
|
|
|
+ $fileName = basename($fullPath);
|
|
|
// 插入数据库
|
|
|
- DistAppearanceTemplate::insertTemplateContent(0, $this->appearanceId, $filePath,$file, $parentId, $content);
|
|
|
+ DistAppearanceTemplate::insertTemplateContent(0, $this->appearanceId, $filePath,$fileName, $parentId, $content);
|
|
|
}
|
|
|
}
|
|
|
|