diff --git a/app/api/logic/LocalStoreGoodsLogic.php b/app/api/logic/LocalStoreGoodsLogic.php index 387b04eb..4a863ca0 100644 --- a/app/api/logic/LocalStoreGoodsLogic.php +++ b/app/api/logic/LocalStoreGoodsLogic.php @@ -25,25 +25,28 @@ class LocalStoreGoodsLogic extends Logic // 获取商品列表 public static function lists($get) { + // 1 已上架 2 已下架 + if ($get['type'] == 1 || $get['type'] == 2) { + $where[] = ['state', '=', $get['type']]; + } + + // 待审核 + if ($get['type'] == 3) { + $where[] = ['audit_status', '=', self::$AUDIT_STATUS['audit_status_stay']]; + } + + $where[] = ['lstore_id', '=', $get['lstore_id']]; + $where[] = ['lstore_id', '=', 0]; + $list = LocalStoreGoods::with('pic') ->field('id, lstore_id, title, price') - ->where([ - 'lstore_id' => $get['lstore_id'], - 'state' => $get['type'], - 'audit_status' => self::$AUDIT_STATUS['audit_status_ok'], - 'delete_time' => 0, - ]) + ->where($where) ->order('id', 'desc') ->page($get['page_no'], $get['page_size']) ->select() ->toArray(); - $count = LocalStoreGoods::where([ - 'lstore_id' => $get['lstore_id'], - 'state' => $get['lstore_id'], - 'audit_status' => self::$AUDIT_STATUS['audit_status_ok'], - 'delete_time' => 0, - ])->count(); + $count = LocalStoreGoods::where($where)->count(); foreach ($list as &$v) { foreach ($v['pic'] as &$v1) {