作者 李小龙

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

... ... @@ -31,7 +31,7 @@ class ProductLogic extends BaseLogic
$data = parent::getList($map, $sort, $columns, $limit);
foreach ($data['list'] as &$v){
$v = $this->formatData($v);
$v['thumb']['image_link'] = $v['thumb']['url'];//图片统一
$v['thumb']['image_link'] = $this->getImageUrl($v['thumb']['url']);//图片统一
}
return $this->success($data);
}
... ... @@ -40,6 +40,14 @@ class ProductLogic extends BaseLogic
{
$info = $this->model->read(['id'=>$id]);
$info = $this->formatData($info);
//统一图片链接
if(!empty($info['gallery'])){
foreach ($info['gallery'] as $k => $v){
$v['image_link'] = $this->getImageUrl($v['url']);
$info['gallery'][$k] = $v;
}
}
$info['icon_link'] = $this->getImageUrl($info['icon']);
return $this->success($info);
}
... ... @@ -55,13 +63,6 @@ class ProductLogic extends BaseLogic
$info['status_text'] = Product::statusMap()[$info['status']] ?? '';
$info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? '';
$info['url'] = $this->getProjectDomain() . $info['route'] ;
//统一图片链接
if(!empty($info['gallery'])){
foreach ($info['gallery'] as $k => $v){
$v['image_link'] = $v['url'];
$info['gallery'][$k] = $v;
}
}
return $info;
}
... ...
... ... @@ -394,7 +394,7 @@ class Logic
if(is_array($hash)){
$url = [];
foreach ($hash as $k => $v){
$url['images_link'][$k] = $this->getImageUrl($v);
$url[$k] = $this->getImageUrl($v);
}
}else{
$imageModel = new Image();
... ...
... ... @@ -36,12 +36,12 @@ class Category extends Base
public function getImageAttribute($value)
{
return Upload::path2url($value);
return $this->getImageUrl($value);
}
public function setImageAttribute($value)
{
$this->attributes['image'] = Upload::url2path($value);
$this->attributes['image'] = $value;
}
... ...
... ... @@ -38,7 +38,6 @@ class Product extends Base
public function getThumbAttribute($value){
$value = Arr::s2a($value);
$value['url'] = $this->getImageUrl($value['url']);
return $value;
}
... ... @@ -48,9 +47,6 @@ class Product extends Base
public function getGalleryAttribute($value){
$value = Arr::s2a($value);
foreach ($value as &$v){
$v['url'] = $this->getImageUrl($v['url']);
}
return $value;
}
... ... @@ -74,9 +70,6 @@ class Product extends Base
*/
public function getIconAttribute($value){
$value = Arr::s2a($value);
foreach ($value as &$v){
$v = $this->getImageUrl($v);
}
return $value;
}
... ...