|
|
@@ -13,6 +13,12 @@ class PrintPartImageService
|
|
|
|
|
|
protected $modelClass = PrintPartImage::class;
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存上传文件
|
|
|
+ * @param PrintPartImage $model
|
|
|
+ * @param $file
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
public function saveFile(PrintPartImage $model, $file): array
|
|
|
{
|
|
|
$result = $this->saveImage($file,$model);
|
|
|
@@ -22,7 +28,13 @@ class PrintPartImageService
|
|
|
return ['success' => true, 'message' => '文件上传成功', 'data' => $model ];
|
|
|
}
|
|
|
|
|
|
- public function saveImage($file,$model)
|
|
|
+ /**
|
|
|
+ * 保存上传图片
|
|
|
+ * @param $file
|
|
|
+ * @param $model
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function saveImage($file,$model): array
|
|
|
{
|
|
|
$tmpFil = $file->getRealPath();
|
|
|
if (!$file) return ['success' => false, 'message' => '上传图片为找到'];
|
|
|
@@ -46,6 +58,12 @@ class PrintPartImageService
|
|
|
else return ['success' => false, 'message' => '文件上传失败'];
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改打印图片
|
|
|
+ * @param PrintPartImage $model
|
|
|
+ * @param $file
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
public function updateFile(PrintPartImage $model,$file): array
|
|
|
{
|
|
|
$result = $this->saveImage($file,$model);
|