作者 lyh

gx

... ... @@ -64,6 +64,15 @@ class ProductLogic extends BaseLogic
$info['gallery'][$k] = $v;
}
}
//图标
if(!empty($info['icon'])){
$info['icon'] = json_decode($info['icon']);
foreach ($info['icon'] as $k => $v){
$v = (array)$v;
$v['image_link'] = $this->getImageUrl($v['url']);
$info['icon'][$k] = $v;
}
}
return $info;
}
... ...
... ... @@ -43,17 +43,6 @@ class Product extends Base
}
// /**
// * @remark :图标获取器
// * @name :getGalleryAttribute
// * @author :lyh
// * @method :post
// * @time :2023/7/21 11:11
// */
// public function setIconAttribute($value){
// $this->attributes['icon'] = Arr::a2s($value);
// }
/**
* @remark :图标获取器
* @name :getGalleryAttribute
... ... @@ -61,14 +50,11 @@ class Product extends Base
* @method :post
* @time :2023/7/21 11:11
*/
public function getIconAttribute($value){
$value = Arr::s2a($value);
foreach ($value as &$v){
$v = $this->getImageUrl($v);
}
return $value;
public function setIconAttribute($value){
$this->attributes['icon'] = Arr::a2s($value);
}
public function setAttrsAttribute($value){
$this->attributes['attrs'] = Arr::a2s($value);
}
... ...