diff --git a/app/api/logic/ShopLogic.php b/app/api/logic/ShopLogic.php index 0b74e66b..5e943a30 100644 --- a/app/api/logic/ShopLogic.php +++ b/app/api/logic/ShopLogic.php @@ -169,7 +169,7 @@ class ShopLogic extends Logic ['status', '=', GoodsEnum::STATUS_SHELVES], // 上架中 ['audit_status', '=', GoodsEnum::AUDIT_STATUS_OK], // 审核通过 ]; - $shop['on_sale_count'] = Goods::where($onSaleWhere)->where('shop_id', $shopId)->count(); + $shop['on_sale_count'] = Goods::where($onSaleWhere)->where('shop_id', $shop['id'])->count(); // 店铺推荐商品 $shop['goods_list'] = Goods::field('id,image,name,min_price,market_price') @@ -185,20 +185,20 @@ class ShopLogic extends Logic // 用户是否关注店铺 $shop['shop_follow_status'] = 0; if($userId) { // 用户已登录 - $shopFollow = ShopFollow::where(['user_id'=>$userId, 'shop_id'=>$shopId])->findOrEmpty(); + $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' => $shopId,'status' => 1])->count('id'); - $image = ConfigServer::get('shop_customer_service', 'image', '', $shopId); + $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) : ''; - $shop['customer_wechat'] = ConfigServer::get('shop_customer_service', 'wechat', '', $shopId); - $shop['customer_phone'] = ConfigServer::get('shop_customer_service', 'phone', '', $shopId); + $shop['customer_wechat'] = ConfigServer::get('shop_customer_service', 'wechat', '', $shop['id']); + $shop['customer_phone'] = ConfigServer::get('shop_customer_service', 'phone', '', $shop['id']); // 店铺广告 $adWhere = [ - [ 'shop_id', '=', $shopId ], + [ 'shop_id', '=', $shop['id'] ], [ 'status', '=', 1 ], ]; $shop['ad'] = [