|
@@ -1887,11 +1887,12 @@ class NewsService implements NewsServiceInterface
|
|
{
|
|
{
|
|
return $goods->map(function ($good) use ($data) {
|
|
return $goods->map(function ($good) use ($data) {
|
|
$catid = $good->catid ?? 0;
|
|
$catid = $good->catid ?? 0;
|
|
- $pinyin = '';
|
|
|
|
|
|
+ // $pinyin = '';
|
|
$category = WebsiteCategory::where('category_id', $catid)->where('website_id', $data['website_id'])->first();
|
|
$category = WebsiteCategory::where('category_id', $catid)->where('website_id', $data['website_id'])->first();
|
|
if (!empty($category->pid) && $category->pid != 0) {
|
|
if (!empty($category->pid) && $category->pid != 0) {
|
|
$level = json_decode($category->category_arr_id);
|
|
$level = json_decode($category->category_arr_id);
|
|
- $pinyin = WebsiteCategory::whereIn('category_id', $level)
|
|
|
|
|
|
+ $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
|
+ ->whereIn('category_id', $level)
|
|
->orderByRaw('FIELD(category_id, ' . implode(',', $level) . ')')
|
|
->orderByRaw('FIELD(category_id, ' . implode(',', $level) . ')')
|
|
->get(['aLIas_pinyin'])
|
|
->get(['aLIas_pinyin'])
|
|
->pluck('aLIas_pinyin')
|
|
->pluck('aLIas_pinyin')
|
|
@@ -1945,7 +1946,6 @@ class NewsService implements NewsServiceInterface
|
|
break;
|
|
break;
|
|
case 6:
|
|
case 6:
|
|
$goods = $query->where('type_id', 2);
|
|
$goods = $query->where('type_id', 2);
|
|
-
|
|
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
return [];
|
|
return [];
|
|
@@ -1967,7 +1967,8 @@ class NewsService implements NewsServiceInterface
|
|
->offset($goodStart)
|
|
->offset($goodStart)
|
|
->limit($goodNum)
|
|
->limit($goodNum)
|
|
->get();
|
|
->get();
|
|
- $all_goods = $this->processGoods($all_goods, $website);
|
|
|
|
|
|
+ $web['website_id'] = $website;
|
|
|
|
+ $all_goods = $this->processGoods($all_goods, $web);
|
|
}
|
|
}
|
|
return $all_goods;
|
|
return $all_goods;
|
|
}, $data);
|
|
}, $data);
|
|
@@ -1979,7 +1980,7 @@ class NewsService implements NewsServiceInterface
|
|
})
|
|
})
|
|
->where('catid', $catid)
|
|
->where('catid', $catid)
|
|
->where('article.status', 1)
|
|
->where('article.status', 1)
|
|
- ->leftJoin('article_data', 'article_data.article_id', 'article.catid')
|
|
|
|
|
|
+ ->leftJoin('article_data', 'article_data.article_id', 'article.id')
|
|
->select('article.id', 'article.title', 'article.updated_at', 'introduce', 'islink', 'linkurl', 'article_data.content')
|
|
->select('article.id', 'article.title', 'article.updated_at', 'introduce', 'islink', 'linkurl', 'article_data.content')
|
|
->orderBy('article.updated_at', 'desc')
|
|
->orderBy('article.updated_at', 'desc')
|
|
->first();
|
|
->first();
|
|
@@ -2018,7 +2019,8 @@ class NewsService implements NewsServiceInterface
|
|
if (empty($category)) {
|
|
if (empty($category)) {
|
|
return Result::error("栏目查询失败", 0);
|
|
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)
|
|
$goods = Good::where('website_id', $website)
|
|
->where('status', 2)
|
|
->where('status', 2)
|
|
->select('good.id as good_id', 'name', 'imgurl', 'description', 'updated_at', 'catid', 'type_id', 'website_id')
|
|
->select('good.id as good_id', 'name', 'imgurl', 'description', 'updated_at', 'catid', 'type_id', 'website_id')
|
|
@@ -2026,11 +2028,12 @@ class NewsService implements NewsServiceInterface
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
->limit($data['pageSize'])
|
|
->limit($data['pageSize'])
|
|
->get();
|
|
->get();
|
|
|
|
+
|
|
if ($goods->isEmpty()) {
|
|
if ($goods->isEmpty()) {
|
|
return Result::error("商品查询失败", 0);
|
|
return Result::error("商品查询失败", 0);
|
|
}
|
|
}
|
|
- if (count($goods) > 1) {
|
|
|
|
- $goods = $this->processGoods($goods, $website);
|
|
|
|
|
|
+ if ($goods->count() > 1) {
|
|
|
|
+ $goods = $this->processGoods($goods, $web);
|
|
} else {
|
|
} else {
|
|
$catid = $goods[0]['catid'] ?? 0;
|
|
$catid = $goods[0]['catid'] ?? 0;
|
|
$good_category = WebsiteCategory::where('category_id', $catid)->where('website_id', $data['website_id'])->first();
|
|
$good_category = WebsiteCategory::where('category_id', $catid)->where('website_id', $data['website_id'])->first();
|
|
@@ -2046,7 +2049,6 @@ class NewsService implements NewsServiceInterface
|
|
}
|
|
}
|
|
$goods[0]['pinyin'] = $pinyin;
|
|
$goods[0]['pinyin'] = $pinyin;
|
|
}
|
|
}
|
|
- $cat_tree = Result::buildMenuTree($category);
|
|
|
|
$result = [
|
|
$result = [
|
|
'category' => $cat_tree,
|
|
'category' => $cat_tree,
|
|
'goods' => $goods,
|
|
'goods' => $goods,
|