From 7b38c5f606c8bdb4348f9314e3315a4a021208ff Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Mon, 29 Jul 2024 11:08:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=90=9C=E7=B4=A2=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E8=AF=8D=E7=9A=84=E6=A8=A1=E7=B3=8A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/GoodsLogic.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/api/logic/GoodsLogic.php b/app/api/logic/GoodsLogic.php index 02511a62..58d6f683 100644 --- a/app/api/logic/GoodsLogic.php +++ b/app/api/logic/GoodsLogic.php @@ -491,6 +491,9 @@ class GoodsLogic extends Logic second_cate_id,third_cate_id,sort_weight,brand_id,shop_id,sales_virtual, (sales_actual + sales_virtual) as sales_total,purchase_price,issuing_price'; + // dump($wh); + // dump($where); + // dump($order);die; $list = Goods::with(['shop']) ->field($field) ->where($wh) @@ -498,6 +501,7 @@ class GoodsLogic extends Logic ->order($order) ->page($get['page_no'], $get['page_size']) ->select(); + $set_price_type = 0; foreach ($list as $item) { $item['shop_type'] = $item['shop']['type']; @@ -867,6 +871,12 @@ class GoodsLogic extends Logic 'audit_status' => GoodsEnum::AUDIT_STATUS_OK, // 审核通过 ]; + $where = []; + if (!empty(self::filterShopsIds())) { + // 过滤已删除、已冻结、已暂停营业、已到期的店铺 + $where[] = ['shop_id', 'not in', self::filterShopsIds()]; + } + $where[] = ['name', 'like', '%' . trim($shop_name) . '%']; SearchRecord::create([ @@ -880,7 +890,7 @@ class GoodsLogic extends Logic $goods = Goods::field('id, name') ->where($onSaleWhere) ->where($where) - ->order('id desc') + ->order('sort_weight asc, sort asc, id desc') ->select()->toArray(); if ($goods) { return $goods;