Commit 80ecdf5e by 杨树贤

优化

parent f3662775
Showing with 9 additions and 3 deletions
...@@ -45,7 +45,7 @@ class StandardBrandService ...@@ -45,7 +45,7 @@ class StandardBrandService
$brandNames = array_map(function ($value) { $brandNames = array_map(function ($value) {
return $value ? str_replace("\t", '', $value) : $value; return $value ? str_replace("\t", '', $value) : $value;
}, $brandNames); }, $brandNames);
$value['mapping_brand_names'] = $brandNames ? '[ ' . implode($brandNames, ' | ') . ' ] ' : '-'; $value['mapping_brand_names'] = $brandNames ? implode($brandNames, ' | ') : '-';
$value['show_name'] = $value['brand_name']; $value['show_name'] = $value['brand_name'];
return $value; return $value;
}, $list['data']); }, $list['data']);
...@@ -69,8 +69,13 @@ class StandardBrandService ...@@ -69,8 +69,13 @@ class StandardBrandService
$brandIds = explode(',', $brandIds); $brandIds = explode(',', $brandIds);
$brands = StandardBrandModel::whereIn('standard_brand_id', $brandIds)->select([ $brands = StandardBrandModel::whereIn('standard_brand_id', $brandIds)->select([
'brand_name', 'brand_name',
'standard_brand_id as brand_id' 'standard_brand_id as brand_id',
])->get(); ])->get();
return !empty($brands) ? $brands->toArray() : []; $brands = !empty($brands) ? $brands->toArray() : [];
return array_map(function ($brand) {
$brand['show_name'] = $brand['brand_name'];
$brand['mapping_brand_names'] = '-';
return $brand;
}, $brands);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment