zs 1 năm trước cách đây
mục cha
commit
27f2eb505b

+ 3 - 3
src/service/platform/achievement.service.ts

@@ -24,10 +24,10 @@ export class AchievementService extends BaseService<modelType> {
       // 查询成果发布者
       const userData = await this.uModel.findById(arr.user).lean();
       if (userData) data.userInfo = { name: userData.nick_name || '', phone: userData.phone || '' };
-      // 查询是否收藏该成果
-      const collection = await this.cModel.findOne({ user: user._id, source: arr._id }).lean();
-      if (collection) data.is_collection = true;
     }
+    // 查询是否收藏该成果
+    const collection = await this.cModel.findOne({ user: user._id, source: arr._id }).lean();
+    if (collection) data.is_collection = true;
     return { ...arr, ...data };
   }
 }

+ 3 - 3
src/service/platform/demand.service.ts

@@ -38,10 +38,10 @@ export class DemandService extends BaseService<modelType> {
       // 查询需求发布者
       const userData = await this.uModel.findById(arr.user).lean();
       if (userData) data.userInfo = { name: userData.nick_name || '', phone: userData.phone || '' };
-      // 查询是否收藏该需求
-      const collection = await this.cModel.findOne({ user: user._id, source: arr._id }).lean();
-      if (collection) data.is_collection = true;
     }
+    // 查询是否收藏该需求
+    const collection = await this.cModel.findOne({ user: user._id, source: arr._id }).lean();
+    if (collection) data.is_collection = true;
     return { ...arr, ...data };
   }
 }