shish hace 4 años
padre
commit
db3f0fe059

+ 4 - 3
app-ghs/controllers/UploadController.php

@@ -25,10 +25,11 @@ class UploadController extends BaseController
         if (!is_uploaded_file($file['tmp_name'])) {
             util::fail('please upload img');
         }
-        $sjId = $this->sjId;
+        $mainId = $this->sjId;
+        $shopId = $this->shopId;
         $month = date("Ym");
         $date = date("d");
-        $path = dirUtil::getImgUploadDir() . "/{$sjId}/{$month}/{$date}/";
+        $path = dirUtil::getImgUploadDir() . "/{$mainId}/{$shopId}/{$month}/{$date}/";
         if (!file_exists($path)) {
             //检查是否有该文件夹,如果没有就创建,并给予最高权限
             mkdir($path, 0700, true);
@@ -37,7 +38,7 @@ class UploadController extends BaseController
         $newFile = $preFileName . ".jpg";
         $fullPathFile = $path . $newFile;
         if (move_uploaded_file($file['tmp_name'], $fullPathFile)) {
-            $img = "uploads/{$sjId}/{$month}/{$date}/" . $newFile;
+            $img = "uploads/{$mainId}/{$shopId}/{$month}/{$date}/" . $newFile;
             oss::uploadImage($img, $fullPathFile);
             $data = business::formatUploadImg($img);
             $data['shortUrl'] = $img;

+ 4 - 3
app-hd/controllers/UploadController.php

@@ -25,10 +25,11 @@ class UploadController extends BaseController
         if (!is_uploaded_file($file['tmp_name'])) {
             util::fail('please upload img');
         }
-        $sjId = $this->sjId;
+        $mainId = $this->sjId;
+        $shopId = $this->shopId;
         $month = date("Ym");
         $date = date("d");
-        $path = dirUtil::getImgUploadDir() . "/{$sjId}/{$month}/{$date}/";
+        $path = dirUtil::getImgUploadDir() . "/{$mainId}/{$shopId}/{$month}/{$date}/";
         if (!file_exists($path)) {
             //检查是否有该文件夹,如果没有就创建,并给予最高权限
             mkdir($path, 0700, true);
@@ -37,7 +38,7 @@ class UploadController extends BaseController
         $newFile = $preFileName . ".jpg";
         $fullPathFile = $path . $newFile;
         if (move_uploaded_file($file['tmp_name'], $fullPathFile)) {
-            $img = "uploads/{$sjId}/{$month}/{$date}/" . $newFile;
+            $img = "uploads/{$mainId}/{$shopId}/{$month}/{$date}/" . $newFile;
             oss::uploadImage($img, $fullPathFile);
             $data = business::formatUploadImg($img);
             $data['shortUrl'] = $img;