wesmiler před 1 měsícem
rodič
revize
2a7ec9408e

+ 2 - 3
app/Helpers/common.php

@@ -919,9 +919,8 @@ if (!function_exists('get_image_path')) {
         }
 
         // 是否七牛
-        $driver = \App\Services\ConfigService::make()->getConfigByCode('file_upload_driver','local');
-        if($driver == 'qiniu'){
-            return $image_url;
+        if(preg_match("/^qiniu/", $image_url)){
+            return \App\Services\QiniuService::make()->getImagePath($image_url);
         }
 
         $data = explode('/uploads', $image_url);

+ 1 - 2
app/Models/GoodsModel.php

@@ -41,8 +41,7 @@ class GoodsModel extends BaseModel
      */
     public function getAlbumsAttribute($value)
     {
-
-        $value = $value? get_format_images(json_decode($value,true),'url','array') : [];
+        $value = $value? get_images_preview($value) : [];
         return $value;
     }
 

+ 10 - 0
app/Services/QiniuService.php

@@ -125,4 +125,14 @@ class QiniuService extends BaseService
     {
         return str_replace('/qiniu', $this->host, $path);
     }
+
+    /**
+     * 图片路径
+     * @param $path
+     * @return string|string[]
+     */
+    public function getImagePath($path)
+    {
+        return str_replace($this->host,'/qiniu' , $path);
+    }
 }