From 136cab72d13123e8740d2fae5dcaa234eeff56b0 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Tue, 27 Aug 2024 10:56:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=AE=A1=E6=A0=B8=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E5=95=86=E5=93=81=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LocalStoreGoodsLogic.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/api/logic/LocalStoreGoodsLogic.php b/app/api/logic/LocalStoreGoodsLogic.php index 4d68253d..df1ca1e1 100644 --- a/app/api/logic/LocalStoreGoodsLogic.php +++ b/app/api/logic/LocalStoreGoodsLogic.php @@ -28,7 +28,7 @@ class LocalStoreGoodsLogic extends Logic // 1 已上架 2 已下架 if ($get['type'] == 1 || $get['type'] == 2) { $where[] = ['state', '=', $get['type']]; - $where[] = ['audit_status', '=', self::$AUDIT_STATUS['audit_status_ok']]; + $where[] = ['audit_status', '=', self::$AUDIT_STATUS['audit_status_ok']]; // 审核成功 } // 待审核 @@ -36,18 +36,24 @@ class LocalStoreGoodsLogic extends Logic $where[] = ['audit_status', '=', self::$AUDIT_STATUS['audit_status_stay']]; } - $where[] = ['lstore_id', '=', $get['lstore_id']]; - $where[] = ['delete_time', '=', 0]; + // 审核失败 + if ($get['type'] == 4) { + $where[] = ['audit_status', '=', self::$AUDIT_STATUS['audit_status_refuse']]; + } + + $m_where[] = ['lstore_id', '=', $get['lstore_id']]; + $m_where[] = ['delete_time', '=', 0]; $list = LocalStoreGoods::with('pic') ->field('id, lstore_id, title, price') ->where($where) + ->where($m_where) ->order('id', 'desc') ->page($get['page_no'], $get['page_size']) ->select() ->toArray(); - $count = LocalStoreGoods::where($where)->count(); + $count = LocalStoreGoods::where($where)->where($m_where)->count(); foreach ($list as &$v) { foreach ($v['pic'] as &$v1) { @@ -55,7 +61,11 @@ class LocalStoreGoodsLogic extends Logic } } + // 统计审核失败的商品数量 + $fail_goods_count = LocalStoreGoods::where($m_where)->where(['audit_status' => self::$AUDIT_STATUS['audit_status_refuse']])->count(); + $result = [ + 'fail_goods_count' => $fail_goods_count, 'count' => $count, 'lists' => $list, 'more' => is_more($count, $get['page_no'], $get['page_size']),