作者 李小龙

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -31,7 +31,7 @@ class ProductLogic extends BaseLogic @@ -31,7 +31,7 @@ class ProductLogic extends BaseLogic
31 $data = parent::getList($map, $sort, $columns, $limit); 31 $data = parent::getList($map, $sort, $columns, $limit);
32 foreach ($data['list'] as &$v){ 32 foreach ($data['list'] as &$v){
33 $v = $this->formatData($v); 33 $v = $this->formatData($v);
34 - $v['thumb']['image_link'] = $v['thumb']['url'];//图片统一 34 + $v['thumb']['image_link'] = $this->getImageUrl($v['thumb']['url']);//图片统一
35 } 35 }
36 return $this->success($data); 36 return $this->success($data);
37 } 37 }
@@ -40,6 +40,14 @@ class ProductLogic extends BaseLogic @@ -40,6 +40,14 @@ class ProductLogic extends BaseLogic
40 { 40 {
41 $info = $this->model->read(['id'=>$id]); 41 $info = $this->model->read(['id'=>$id]);
42 $info = $this->formatData($info); 42 $info = $this->formatData($info);
  43 + //统一图片链接
  44 + if(!empty($info['gallery'])){
  45 + foreach ($info['gallery'] as $k => $v){
  46 + $v['image_link'] = $this->getImageUrl($v['url']);
  47 + $info['gallery'][$k] = $v;
  48 + }
  49 + }
  50 + $info['icon_link'] = $this->getImageUrl($info['icon']);
43 return $this->success($info); 51 return $this->success($info);
44 } 52 }
45 53
@@ -55,13 +63,6 @@ class ProductLogic extends BaseLogic @@ -55,13 +63,6 @@ class ProductLogic extends BaseLogic
55 $info['status_text'] = Product::statusMap()[$info['status']] ?? ''; 63 $info['status_text'] = Product::statusMap()[$info['status']] ?? '';
56 $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? ''; 64 $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? '';
57 $info['url'] = $this->getProjectDomain() . $info['route'] ; 65 $info['url'] = $this->getProjectDomain() . $info['route'] ;
58 - //统一图片链接  
59 - if(!empty($info['gallery'])){  
60 - foreach ($info['gallery'] as $k => $v){  
61 - $v['image_link'] = $v['url'];  
62 - $info['gallery'][$k] = $v;  
63 - }  
64 - }  
65 return $info; 66 return $info;
66 } 67 }
67 68
@@ -394,7 +394,7 @@ class Logic @@ -394,7 +394,7 @@ class Logic
394 if(is_array($hash)){ 394 if(is_array($hash)){
395 $url = []; 395 $url = [];
396 foreach ($hash as $k => $v){ 396 foreach ($hash as $k => $v){
397 - $url['images_link'][$k] = $this->getImageUrl($v); 397 + $url[$k] = $this->getImageUrl($v);
398 } 398 }
399 }else{ 399 }else{
400 $imageModel = new Image(); 400 $imageModel = new Image();
@@ -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
@@ -38,7 +38,6 @@ class Product extends Base @@ -38,7 +38,6 @@ class Product extends Base
38 38
39 public function getThumbAttribute($value){ 39 public function getThumbAttribute($value){
40 $value = Arr::s2a($value); 40 $value = Arr::s2a($value);
41 - $value['url'] = $this->getImageUrl($value['url']);  
42 return $value; 41 return $value;
43 } 42 }
44 43
@@ -48,9 +47,6 @@ class Product extends Base @@ -48,9 +47,6 @@ class Product extends Base
48 47
49 public function getGalleryAttribute($value){ 48 public function getGalleryAttribute($value){
50 $value = Arr::s2a($value); 49 $value = Arr::s2a($value);
51 - foreach ($value as &$v){  
52 - $v['url'] = $this->getImageUrl($v['url']);  
53 - }  
54 return $value; 50 return $value;
55 } 51 }
56 52
@@ -74,9 +70,6 @@ class Product extends Base @@ -74,9 +70,6 @@ class Product extends Base
74 */ 70 */
75 public function getIconAttribute($value){ 71 public function getIconAttribute($value){
76 $value = Arr::s2a($value); 72 $value = Arr::s2a($value);
77 - foreach ($value as &$v){  
78 - $v = $this->getImageUrl($v);  
79 - }  
80 return $value; 73 return $value;
81 } 74 }
82 75