zs 8 miesięcy temu
rodzic
commit
e91f9f60df

+ 5 - 5
src/controller/platform/achievement.controller.ts

@@ -76,8 +76,8 @@ export class AchievementController implements BaseController {
     const others = pick(query, ['skip', 'limit']);
     const filter = await this.service.money(qobj);
     const { data, total } = await this.service.query(filter, others);
-    for (const i of data) {
-      await this.serviceUtil.fillOnwer(i);
+    for (let i of data) {
+      i = await this.serviceUtil.fillOnwer(i);
     }
     return { data, total };
   }
@@ -85,9 +85,9 @@ export class AchievementController implements BaseController {
   @Get('/detail/:id')
   @ApiResponse({ type: FVO_achievement })
   async detail(@Param('id') id: string) {
-    const data = await this.service.fetch({ id });
-    await this.serviceUtil.fillOnwer(data);
-    await this.serviceUtil.fillCollection(data);
+    let data = await this.service.fetch({ id });
+    data = await this.serviceUtil.fillOnwer(data);
+    data = await this.serviceUtil.fillCollection(data);
     return data;
   }
 }

+ 5 - 5
src/controller/platform/demand.controller.ts

@@ -73,8 +73,8 @@ export class DemandController implements BaseController {
     const qobj = omit(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
     const { data, total } = await this.service.query(qobj, others);
-    for (const i of data) {
-      await this.serviceUtil.fillOnwer(i);
+    for (let i of data) {
+      i = await this.serviceUtil.fillOnwer(i);
     }
     return { data, total };
   }
@@ -82,9 +82,9 @@ export class DemandController implements BaseController {
   @Get('/detail/:id')
   @ApiResponse({ type: FVO_demand })
   async detail(@Param('id') id: string) {
-    const data = await this.service.fetch({ id });
-    await this.serviceUtil.fillOnwer(data);
-    await this.serviceUtil.fillCollection(data);
+    let data = await this.service.fetch({ id });
+    data = await this.serviceUtil.fillOnwer(data);
+    data = await this.serviceUtil.fillCollection(data);
     return data;
   }
 }

+ 3 - 3
src/controller/platform/match.controller.ts

@@ -67,9 +67,9 @@ export class MatchController implements BaseController {
   @Get('/detail/:id')
   @ApiResponse({ type: FVO_match })
   async detail(@Param('id') id: string) {
-    const data = await this.service.fetch({ id });
-    await this.serviceUtil.fillOnwer(data);
-    await this.serviceUtil.fillCollection(data);
+    let data = await this.service.fetch({ id });
+    data = await this.serviceUtil.fillOnwer(data);
+    data = await this.serviceUtil.fillCollection(data);
     return data;
   }
 }

+ 5 - 5
src/controller/platform/project.controller.ts

@@ -73,8 +73,8 @@ export class ProjectController implements BaseController {
     const qobj = omit(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
     const { data, total } = await this.service.query(qobj, others);
-    for (const i of data) {
-      await this.serviceUtil.fillOnwer(i);
+    for (let i of data) {
+      i = await this.serviceUtil.fillOnwer(i);
     }
     return { data, total };
   }
@@ -82,9 +82,9 @@ export class ProjectController implements BaseController {
   @Get('/detail/:id')
   @ApiResponse({ type: FVO_project })
   async detail(@Param('id') id: string) {
-    const data = await this.service.fetch({ id });
-    await this.serviceUtil.fillOnwer(data);
-    await this.serviceUtil.fillCollection(data);
+    let data = await this.service.fetch({ id });
+    data = await this.serviceUtil.fillOnwer(data);
+    data = await this.serviceUtil.fillCollection(data);
     return data;
   }
 }

+ 2 - 2
src/controller/platform/sign.controller.ts

@@ -79,8 +79,8 @@ export class SignController implements BaseController {
     const qobj = omit(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
     const { data, total } = await this.service.query(qobj, others);
-    for (const i of data) {
-      await this.serviceUtil.fillMatchInfo(i);
+    for (let i of data) {
+      i = await this.serviceUtil.fillMatchInfo(i);
     }
     return { data, total };
   }

+ 5 - 5
src/controller/platform/supply.controller.ts

@@ -73,8 +73,8 @@ export class SupplyController implements BaseController {
     const qobj = omit(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
     const { data, total } = await this.service.query(qobj, others);
-    for (const i of data) {
-      await this.serviceUtil.fillOnwer(i);
+    for (let i of data) {
+      i = await this.serviceUtil.fillOnwer(i);
     }
     return { data, total };
   }
@@ -82,9 +82,9 @@ export class SupplyController implements BaseController {
   @Get('/detail/:id')
   @ApiResponse({ type: FVO_supply })
   async detail(@Param('id') id: string) {
-    const data = await this.service.fetch({ id });
-    await this.serviceUtil.fillOnwer(data);
-    await this.serviceUtil.fillCollection(data);
+    let data = await this.service.fetch({ id });
+    data = await this.serviceUtil.fillOnwer(data);
+    data = await this.serviceUtil.fillCollection(data);
     return data;
   }
 }

+ 5 - 5
src/controller/users/company.controller.ts

@@ -77,8 +77,8 @@ export class CompanyController implements BaseController {
     const qobj = omit(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
     const { data, total } = await this.service.query(qobj, others);
-    for (const i of data) {
-      await this.serviceUtil.fillOnwer(i);
+    for (let i of data) {
+      i = await this.serviceUtil.fillOnwer(i);
     }
     return { data, total };
   }
@@ -86,9 +86,9 @@ export class CompanyController implements BaseController {
   @Get('/detail/:id')
   @ApiResponse({ type: FVO_company })
   async detail(@Param('id') id: string) {
-    const data = await this.service.fetch({ id });
-    await this.serviceUtil.fillOnwer(data);
-    await this.serviceUtil.fillCollection(data);
+    let data = await this.service.fetch({ id });
+    data = await this.serviceUtil.fillOnwer(data);
+    data = await this.serviceUtil.fillCollection(data);
     return data;
   }
 }

+ 5 - 5
src/controller/users/expert.controller.ts

@@ -79,8 +79,8 @@ export class ExpertController implements BaseController {
     const qobj = omit(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
     const { data, total } = await this.service.query(qobj, others);
-    for (const i of data) {
-      await this.serviceUtil.fillOnwer(i);
+    for (let i of data) {
+      i = await this.serviceUtil.fillOnwer(i);
     }
     return { data, total };
   }
@@ -88,9 +88,9 @@ export class ExpertController implements BaseController {
   @Get('/detail/:id')
   @ApiResponse({ type: FVO_expert })
   async detail(@Param('id') id: string) {
-    const data = await this.service.fetch({ id });
-    await this.serviceUtil.fillOnwer(data);
-    await this.serviceUtil.fillCollection(data);
+    let data = await this.service.fetch({ id });
+    data = await this.serviceUtil.fillOnwer(data);
+    data = await this.serviceUtil.fillCollection(data);
     return data;
   }
 }

+ 3 - 0
src/service/serviceUtil.service.ts

@@ -27,6 +27,7 @@ export class ServiceUtilService {
       const dataUser = await this.userService.fetch({ id: get(data, 'user') });
       if (dataUser) data.userInfo = { name: get(dataUser, 'name', ''), phone: get(dataUser, 'phone', '') };
     }
+    return data;
   }
   /**
    * 填充是否收藏字段: is_collection boolean类型
@@ -38,6 +39,7 @@ export class ServiceUtilService {
       const collectionData = await this.collectionService.fetch({ user: get(user, 'id'), source: get(data, 'id') });
       if (collectionData) data.is_collection = true;
     }
+    return data;
   }
   /**
    * 填充赛事信息
@@ -48,6 +50,7 @@ export class ServiceUtilService {
     if (!match) return;
     const matchInfo = await this.matchService.fetch({ id: match });
     if (matchInfo) data = { ...data, matchInfo };
+    return data;
   }
 
   /**