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) : '';