diff --git a/app/Service/v3/Implementations/CategoryService.php b/app/Service/v3/Implementations/CategoryService.php index 911c59c..6be32bd 100644 --- a/app/Service/v3/Implementations/CategoryService.php +++ b/app/Service/v3/Implementations/CategoryService.php @@ -37,9 +37,9 @@ class CategoryService implements CategoryServiceInterface public function allForStore($storeId) { - $goodsTypeIds = Goods::query()->select('category_id') + $goodsTypeIds = Goods::query()->select('id','category_id') ->where(['store_id' => $storeId]) - ->groupBy(['category_id']) + ->groupBy('category_id', 'id') ->get()->toArray(); return Category::query() diff --git a/app/Service/v3/Implementations/ShopCartService.php b/app/Service/v3/Implementations/ShopCartService.php index 0247fd6..818f40f 100644 --- a/app/Service/v3/Implementations/ShopCartService.php +++ b/app/Service/v3/Implementations/ShopCartService.php @@ -83,8 +83,8 @@ class ShopCartService implements ShopCartServiceInterface ['goods_id','=',$goodsId], ]) ->select('num') - ->get(); - return $ShoppingCart->num; + ->first(); + return $ShoppingCart->num ?? 0; } public function undo($userId,$marketId)