lrf 2 年 前
コミット
190e2f7d37
1 ファイル変更5 行追加2 行削除
  1. 5 2
      app/service/view/shop.js

+ 5 - 2
app/service/view/shop.js

@@ -24,8 +24,11 @@ class ShopService extends CrudService {
       // 收藏
       const follow_num = await this.storeShopModel.count({ shop });
       // 当前用户是否收藏
-      const store_num = await this.storeShopModel.count({ shop, customer });
-      const is_follow = store_num > 0;
+      let is_follow = false;
+      if (customer) {
+        const store_num = await this.storeShopModel.count({ shop, customer });
+        is_follow = store_num > 0;
+      }
       const res = await this.ctx.service.view.goods.indexGoodsList({ shop }, { skip: 0, limit: 3 });
       const obj = { _id: shop, logo, name, market_num, follow_num, is_follow, market: res.list };
       arr.push(obj);