From 73800a2154590cbec7f9a37e973dcd8b6883b921 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 16 Oct 2024 14:33:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=97=A8=E5=BA=97=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了对经纬度的非空检查,避免在不使用时进行不必要的验证 - 将查询结果的分页限制去除,改为返回前100条数据,提高数据处理效率 - 删除了未使用的购物车相关代码,清理了冗余的逻辑判断 - 优化了距离计算的逻辑,简化了代码结构 --- app/api/lists/store/SystemStoreLists.php | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/app/api/lists/store/SystemStoreLists.php b/app/api/lists/store/SystemStoreLists.php index 64c1d6c6b..8d7c4b0eb 100644 --- a/app/api/lists/store/SystemStoreLists.php +++ b/app/api/lists/store/SystemStoreLists.php @@ -51,9 +51,6 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac $latitude = $this->request->get('latitude', ''); $longitude = $this->request->get('longitude', ''); $cart_id = $this->request->get('cart_id', ''); - // if(empty($longitude) || empty($latitude)){ - // throw new Exception('缺失经纬度'); - // } $where[] = ['is_show', '=', YesNoEnum::YES]; $data = SystemStore::where($this->searchWhere)->where($where) ->field([ @@ -73,7 +70,7 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac 'is_send', 'abbreviation' ]) - ->limit($this->limitOffset, $this->limitLength) + ->limit(100) ->order(['id' => 'desc']) ->select() ->toArray(); @@ -84,25 +81,6 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac $values['reservation'] = 1; } - - // $cart_id = explode(',',$cart_id); - // $cart_select = Cart::whereIn('id', $cart_id) - // ->field('id,product_id,cart_num,store_id')->select()->toArray(); - // foreach ($cart_select as $v) { - // foreach ($data as &$values){ - // $store = StoreBranchProduct::where([ - // 'store_id'=>$values['id'], - // 'product_id'=>$v['product_id'], - // ])->field('id,store_name,stock')->withTrashed()->find(); - // if(empty($store)){ - // $store['stock'] =0; - // } - // $values['reservation'] = 0; - // if($store['stock'] < $v['cart_num']){ - // } - // } - - // } } else { foreach ($data as &$values) { $values['distance'] = 0;