作者 lyh

gx

@@ -55,15 +55,7 @@ class ProductLogic extends BaseLogic @@ -55,15 +55,7 @@ class ProductLogic extends BaseLogic
55 $info['status_text'] = Product::statusMap()[$info['status']] ?? ''; 55 $info['status_text'] = Product::statusMap()[$info['status']] ?? '';
56 $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? ''; 56 $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? '';
57 $info['url'] = $this->getProjectDomain() . $info['route'] ; 57 $info['url'] = $this->getProjectDomain() . $info['route'] ;
58 - //统一图片链接  
59 - if(!empty($info['gallery'])){  
60 - $info['gallery'] = json_decode($info['gallery']);  
61 - foreach ($info['gallery'] as $k => $v){  
62 - $v = (array)$v;  
63 - $v['image_link'] = $this->getImageUrl($v['url']);  
64 - $info['gallery'][$k] = $v;  
65 - }  
66 - } 58 +
67 return $info; 59 return $info;
68 } 60 }
69 61
@@ -42,6 +42,17 @@ class Product extends Base @@ -42,6 +42,17 @@ class Product extends Base
42 return $value; 42 return $value;
43 } 43 }
44 44
  45 + public function setGalleryAttribute($value){
  46 + $this->attributes['gallery'] = Arr::a2s($value);
  47 + }
  48 +
  49 + public function getGalleryAttribute($value){
  50 + $value = Arr::s2a($value);
  51 + foreach ($value as &$v){
  52 + $v['url'] = $this->getImageUrl($v['url']);
  53 + }
  54 + return $value;
  55 + }
45 56
46 /** 57 /**
47 * @remark :图标获取器 58 * @remark :图标获取器