正在显示
3 个修改的文件
包含
4 行增加
和
9 行删除
| @@ -58,10 +58,11 @@ class ProductLogic extends BaseLogic | @@ -58,10 +58,11 @@ class ProductLogic extends BaseLogic | ||
| 58 | //统一图片链接 | 58 | //统一图片链接 |
| 59 | if(!empty($info['gallery'])){ | 59 | if(!empty($info['gallery'])){ |
| 60 | foreach ($info['gallery'] as $k => $v){ | 60 | foreach ($info['gallery'] as $k => $v){ |
| 61 | - $v['image_link'] = $v['url']; | 61 | + $v['image_link'] = $this->getImageUrl($v['url']); |
| 62 | $info['gallery'][$k] = $v; | 62 | $info['gallery'][$k] = $v; |
| 63 | } | 63 | } |
| 64 | } | 64 | } |
| 65 | + $info['icon_link'] = $this->getImageUrl($info['icon']); | ||
| 65 | return $info; | 66 | return $info; |
| 66 | } | 67 | } |
| 67 | 68 |
| @@ -36,12 +36,12 @@ class Category extends Base | @@ -36,12 +36,12 @@ class Category extends Base | ||
| 36 | 36 | ||
| 37 | public function getImageAttribute($value) | 37 | public function getImageAttribute($value) |
| 38 | { | 38 | { |
| 39 | - return Upload::path2url($value); | 39 | + return $this->getImageUrl($value); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | public function setImageAttribute($value) | 42 | public function setImageAttribute($value) |
| 43 | { | 43 | { |
| 44 | - $this->attributes['image'] = Upload::url2path($value); | 44 | + $this->attributes['image'] = $value; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | 47 |
| @@ -48,9 +48,6 @@ class Product extends Base | @@ -48,9 +48,6 @@ class Product extends Base | ||
| 48 | 48 | ||
| 49 | public function getGalleryAttribute($value){ | 49 | public function getGalleryAttribute($value){ |
| 50 | $value = Arr::s2a($value); | 50 | $value = Arr::s2a($value); |
| 51 | - foreach ($value as &$v){ | ||
| 52 | - $v['url'] = $this->getImageUrl($v['url']); | ||
| 53 | - } | ||
| 54 | return $value; | 51 | return $value; |
| 55 | } | 52 | } |
| 56 | 53 | ||
| @@ -74,9 +71,6 @@ class Product extends Base | @@ -74,9 +71,6 @@ class Product extends Base | ||
| 74 | */ | 71 | */ |
| 75 | public function getIconAttribute($value){ | 72 | public function getIconAttribute($value){ |
| 76 | $value = Arr::s2a($value); | 73 | $value = Arr::s2a($value); |
| 77 | - foreach ($value as &$v){ | ||
| 78 | - $v = $this->getImageUrl($v); | ||
| 79 | - } | ||
| 80 | return $value; | 74 | return $value; |
| 81 | } | 75 | } |
| 82 | 76 |
-
请 注册 或 登录 后发表评论