From c8801c23ea58c8563bcd645fb4d70c5c61523e76 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sat, 3 Aug 2024 16:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=93=81=E7=B1=BB=E5=95=86?= =?UTF-8?q?=E5=AE=B6=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=88=99=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/IndexLogic.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/api/logic/IndexLogic.php b/app/api/logic/IndexLogic.php index 931d3671..988cc04e 100755 --- a/app/api/logic/IndexLogic.php +++ b/app/api/logic/IndexLogic.php @@ -16,6 +16,7 @@ use app\common\model\goods\GoodsCategory; use app\common\server\ConfigServer; use app\common\server\UrlServer; use app\api\logic\SeckillGoodsLogic; +use app\api\logic\GoodsLogic; use think\facade\Db; use app\common\model\activity_area\ActivityArea; use think\facade\Event; @@ -674,6 +675,12 @@ class IndexLogic extends Logic public static function categoryRecommend($platform_category_id,$p_id,$set_id) { + $shop_id = GoodsLogic::filterShopsIds(); + $shopWhere = []; + if (!empty($shop_id)) { + $shopWhere[] = ['shop_id', 'not in', $shop_id]; + } + // 销售中商品:未删除/审核通过/已上架 $where = [ ['del', '=', GoodsEnum::DEL_NORMAL], // 未删除 @@ -682,6 +689,7 @@ class IndexLogic extends Logic ['first_cate_id|second_cate_id|third_cate_id', '=', $platform_category_id], // 分类id ['is_recommend', '=', 1] // 推荐商品 ]; + $order = [ 'min_price' => 'asc', // 价格排序 ]; @@ -710,10 +718,12 @@ class IndexLogic extends Logic $lists = Goods::field('id,name,image,min_price,market_price,wholesale_price,purchase_price,issuing_price,sales_actual,(sales_actual + sales_virtual) as sales_total') ->where($where1) ->where($where) + ->where($shopWhere) ->order($order) ->limit(4) ->select() ->toArray(); + $set_price_type = 0; if ($set != null&&$settpye!=1) { foreach ($lists as $key => $value) { @@ -758,6 +768,7 @@ class IndexLogic extends Logic return $lists; } + public static function config() { $navigation = Db::name('dev_navigation')