|
@@ -1887,7 +1887,7 @@ class NewsService implements NewsServiceInterface
|
|
|
{
|
|
|
return $goods->map(function ($good) use ($data) {
|
|
|
$catid = $good->catid ?? 0;
|
|
|
- $pinyin = '';
|
|
|
+ // $pinyin = '';
|
|
|
$category = WebsiteCategory::where('category_id', $catid)->where('website_id', $data['website_id'])->first();
|
|
|
if (!empty($category->pid) && $category->pid != 0) {
|
|
|
$level = json_decode($category->category_arr_id);
|
|
@@ -1967,7 +1967,8 @@ class NewsService implements NewsServiceInterface
|
|
|
->offset($goodStart)
|
|
|
->limit($goodNum)
|
|
|
->get();
|
|
|
- $all_goods = $this->processGoods($all_goods, $website);
|
|
|
+ $web['website_id'] = $website;
|
|
|
+ $all_goods = $this->processGoods($all_goods, $web);
|
|
|
|
|
|
}
|
|
|
return $all_goods;
|
|
@@ -2020,7 +2021,8 @@ class NewsService implements NewsServiceInterface
|
|
|
if(empty($category)){
|
|
|
return Result::error("栏目查询失败", 0);
|
|
|
}
|
|
|
- // $cat_tree = $this->processGoods($cat, $website);
|
|
|
+ $cat_tree = Result::buildMenuTree($category);
|
|
|
+ $web['website_id'] = $website;
|
|
|
$goods = Good::where('website_id', $website)
|
|
|
->where('status', 2)
|
|
|
->select('good.id as good_id', 'name', 'imgurl', 'description', 'updated_at', 'catid', 'type_id', 'website_id')
|
|
@@ -2028,11 +2030,12 @@ class NewsService implements NewsServiceInterface
|
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
->limit($data['pageSize'])
|
|
|
->get();
|
|
|
+
|
|
|
if($goods->isEmpty()){
|
|
|
return Result::error("商品查询失败", 0);
|
|
|
}
|
|
|
- if(count($goods) > 1){
|
|
|
- $goods = $this->processGoods($goods, $website);
|
|
|
+ if($goods->count() > 1){
|
|
|
+ $goods = $this->processGoods($goods, $web);
|
|
|
}else{
|
|
|
$catid = $goods[0]['catid'] ?? 0;
|
|
|
$good_category = WebsiteCategory::where('category_id', $catid)->where('website_id', $data['website_id'])->first();
|
|
@@ -2048,7 +2051,6 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
$goods[0]['pinyin'] = $pinyin;
|
|
|
}
|
|
|
- $cat_tree = Result::buildMenuTree($category);
|
|
|
$result = [
|
|
|
'category' => $cat_tree,
|
|
|
'goods' => $goods,
|