@@ -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);
@@ -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;
@@ -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);
+ }