From 32ec0607d01dcdfbaf5752dbcf2e134b6798ebbc Mon Sep 17 00:00:00 2001 From: xucong <850806214@qq.com> Date: Sat, 18 Apr 2026 14:40:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Shop.php | 5 ++--- app/api/logic/ShopLogic.php | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/api/controller/Shop.php b/app/api/controller/Shop.php index ce8cb1fc..ba87932f 100644 --- a/app/api/controller/Shop.php +++ b/app/api/controller/Shop.php @@ -26,7 +26,7 @@ use app\api\logic\ShopLogic; class Shop extends Api { - public $like_not_need_login = ['getShopInfo', 'getShopList','getNearbyShops']; + public $like_not_need_login = ['getShopInfo', 'getShopList','getNearbyShops','getShopCityInfo']; /** * 店铺信息 @@ -52,8 +52,7 @@ class Shop extends Api { if($this->request->isGet()) { $city_id = $this->request->get('city_id', 0); -// $this->user_id - $data = ShopLogic::getShopCityInfo($city_id,"" , input()); + $data = ShopLogic::getShopCityInfo($city_id, $this->user_id, input()); return JsonServer::success('获取店铺信息成功', $data); }else{ return JsonServer::error('请求类型错误'); diff --git a/app/api/logic/ShopLogic.php b/app/api/logic/ShopLogic.php index 4e82cfc5..a48e2c7c 100644 --- a/app/api/logic/ShopLogic.php +++ b/app/api/logic/ShopLogic.php @@ -177,12 +177,12 @@ class ShopLogic extends Logic // 用户是否关注店铺 $shop['shop_follow_status'] = 0; -// if($userId) { // 用户已登录 -// $shopFollow = ShopFollow::where(['user_id'=>$userId, 'shop_id'=>$shop['id']])->findOrEmpty(); -// if(!$shopFollow->isEmpty()) { -// $shop['shop_follow_status'] = $shopFollow['status']; -// } -// } + if($userId) { // 用户已登录 + $shopFollow = ShopFollow::where(['user_id'=>$userId, 'shop_id'=>$shop['id']])->findOrEmpty(); + if(!$shopFollow->isEmpty()) { + $shop['shop_follow_status'] = $shopFollow['status']; + } + } $shop['follow_num'] = ShopFollow::where(['shop_id' => $shop['id'],'status' => 1])->count('id'); $image = ConfigServer::get('shop_customer_service', 'image', '', $shop['id']); $shop['customer_image'] = $image ? UrlServer::getFileUrl($image) : '';