diff --git a/app/Controller/v3/GoodsRecommendController.php b/app/Controller/v3/GoodsRecommendController.php index 95ee76d..59a1325 100644 --- a/app/Controller/v3/GoodsRecommendController.php +++ b/app/Controller/v3/GoodsRecommendController.php @@ -28,7 +28,11 @@ class GoodsRecommendController extends BaseController $page = $this->request->input('page', 1); $pagesize = $this->request->input('pagesize', 10); - $builder = Goods::query()->with('store')->where('market_id', $marketId); + $builder = Goods::query()->with('store') + ->where('market_id', $marketId) + ->where(function ($query) { + $query->where('inventory', '>', 0)->orWhere('is_infinite', '=', 1); + }); switch ($tab) { case Tabs::APPLET_INDEX_RECOMMEND: @@ -67,6 +71,9 @@ class GoodsRecommendController extends BaseController $goods = Goods::query() ->with(['store']) ->where('market_id', $marketId) + ->where(function ($query) { + $query->where('inventory', '>', 0)->orWhere('is_infinite', '=', 1); + }) ->inRandomOrder() ->limit(20) ->get()->toArray(); diff --git a/app/Service/v3/Implementations/SearchService.php b/app/Service/v3/Implementations/SearchService.php index 6b6a0b1..ca609bd 100644 --- a/app/Service/v3/Implementations/SearchService.php +++ b/app/Service/v3/Implementations/SearchService.php @@ -19,7 +19,9 @@ class SearchService implements \App\Service\v3\Interfaces\SearchServiceInterface return $query->select(['id', 'logo', 'name']); }]) ->where(['market_id' => $params['market_id']]) - ->where('inventory', '>', 0); + ->where(function ($query) { + $query->where('inventory', '>', 0)->orWhere('is_infinite', '=', 1); + });; if (isset($params['type_id']) && $params['type_id']) { $typeIds = explode(',', $params['type_id']);