|
@@ -1,6 +1,6 @@
|
|
|
'use strict';
|
|
|
const { CrudService } = require('naf-framework-mongoose/lib/service');
|
|
|
-
|
|
|
+const { ObjectId } = require('mongoose').Types;
|
|
|
// 产品
|
|
|
class ProductService extends CrudService {
|
|
|
constructor(ctx) {
|
|
@@ -60,6 +60,13 @@ class ProductService extends CrudService {
|
|
|
const patent = await this.getSample('patent');
|
|
|
// 专家:expert:limit=>8
|
|
|
const expert = await this.getSample('expert', 8);
|
|
|
+ // 专家需要姓名
|
|
|
+ const ids = expert.map(i => i.user_id);
|
|
|
+ const personal = await this.personal.find({ _id: ids }, 'name');
|
|
|
+ for (const exp of expert) {
|
|
|
+ const r = await personal.find(f => ObjectId(f._id).equals(exp.user_id));
|
|
|
+ if (r) exp.name = r.name;
|
|
|
+ }
|
|
|
// 路演:roadShow:limit=>5
|
|
|
const roadShow = await this.getSample('roadShow', 5);
|
|
|
return { require, achieve, serve, patent, expert, roadShow };
|