|
@@ -1466,26 +1466,14 @@ 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()){
|
|
|
|
- return Result::error("商品查询失败", 0);
|
|
|
|
- }
|
|
|
|
- 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();
|
|
|
|
- if (!empty($good_category->pid) && $good_category->pid != 0) {
|
|
|
|
- $level = json_decode($good_category->category_arr_id);
|
|
|
|
- $pinyin = WebsiteCategory::whereIn('category_id', $level)
|
|
|
|
- ->orderByRaw('FIELD(category_id, '. implode(',', $level). ')')
|
|
|
|
- ->get(['aLIas_pinyin'])
|
|
|
|
- ->pluck('aLIas_pinyin')
|
|
|
|
- ->implode('/');
|
|
|
|
- } else {
|
|
|
|
- $pinyin = $good_category->aLIas_pinyin ?? '';
|
|
|
|
- }
|
|
|
|
- $goods[0]['pinyin'] = $pinyin;
|
|
|
|
- }
|
|
|
|
|
|
+ if(!empty($goods)){
|
|
|
|
+ if($goods->count() > 1 && !empty($goods)){
|
|
|
|
+ $goods = $this->processGoods($goods, $web);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ $goods = [];
|
|
|
|
+ }
|
|
|
|
+
|
|
$result = [
|
|
$result = [
|
|
'category' => $cat_tree,
|
|
'category' => $cat_tree,
|
|
'goods' => $goods,
|
|
'goods' => $goods,
|