소스 검색

Merge branch 'master' of http://git.9026.com/wesley/furniture

gq 6 년 전
부모
커밋
c3293aef16
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      app/Http/Controllers/Api/V1/AlbumController.php

+ 3 - 0
app/Http/Controllers/Api/V1/AlbumController.php

xqd
@@ -2245,6 +2245,9 @@ class AlbumController extends Controller
         $res = AlbumFavoriteModel::whereIn('user_id',$users)->where([['store_id',$store_id]])->groupBy('product_id')->get(['product_id'])->toArray();
         foreach($res as $key=>$val){
             $goods = AlbumProductModel::where([['id',$val['product_id']],['store_id',$store_id]])->get();
+            if(!$goods){
+                unset($res[$key]);continue;
+            }
             $res[$key]['name'] = $goods->name;
             $res[$key]['count'] = AlbumFavoriteModel::whereIn('user_id',$users)->where([['store_id',$store_id],['product_id',$val['product_id']]])->count();
         }