From d51d1539ad35a3de4ddbd778a2b40230abc5e317 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sat, 5 Oct 2024 14:14:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=95=86=E5=AE=B6=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LocalStoreLogic.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/api/logic/LocalStoreLogic.php b/app/api/logic/LocalStoreLogic.php index 1d95c452..ae8784bd 100644 --- a/app/api/logic/LocalStoreLogic.php +++ b/app/api/logic/LocalStoreLogic.php @@ -17,6 +17,7 @@ class LocalStoreLogic extends Logic $model = new LocalStore; $distance = ""; $s = $s1 = ""; + $keyword = $keyword1 = ""; $city_where = []; if (isset($data['c_name'])) { @@ -30,9 +31,16 @@ class LocalStoreLogic extends Logic // } } + // 搜索商家名称 + if (isset($data['keyword']) && $data['keyword'] != '') { + $keyword1 = "shopName like '%" . $data['keyword'] . "%'"; + $keyword = "and shopName like '%" . $data['keyword'] . "%'"; + } + $count = $model->where('is_delete', 0) ->where($city_where) ->where($s1) + ->where($keyword1) ->where("store_state", 1) ->where("shopLogo is not null") ->count(); @@ -50,7 +58,7 @@ class LocalStoreLogic extends Logic // if (isset($data['c_name']) && $data['c_name'] == '嘉兴市') { // $sql = "SELECT * FROM ls_local_store where lstore_id = 138 and is_delete = 0 and store_state = 1 and shopLogo is not null $s ORDER BY lstore_id asc limit " . $page . "," . $size; // } else { - $sql = "SELECT * FROM ls_local_store where is_delete = 0 and store_state = 1 and shopLogo is not null $s ORDER BY lstore_id asc limit " . $page . "," . $size; + $sql = "SELECT * FROM ls_local_store where is_delete = 0 and store_state = 1 and shopLogo is not null $s $keyword ORDER BY lstore_id asc limit " . $page . "," . $size; // } // var_dump($sql);