|
@@ -204,10 +204,27 @@ class ChatService extends CrudService {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- async getdockByopenid({ openid }){
|
|
|
+ async getdockByopenid({ openid }) {
|
|
|
const res = await this.model.findOne({ openid });
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ async getgoodslist({ name }) {
|
|
|
+ assert(name, '请输入产品名称');
|
|
|
+ const res = await this.model.find({ 'apply.goodsList.name': { $regex: name } });
|
|
|
+ const data = [];
|
|
|
+ for (const elm of res) {
|
|
|
+ const applys = elm.apply;
|
|
|
+ for (const el of applys) {
|
|
|
+ const goodlists = el.goodsList;
|
|
|
+ const goodlist = _.filter(goodlists, function(o) {
|
|
|
+ return _.includes(o.name, name);
|
|
|
+ });
|
|
|
+ data.concat(goodlist);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = ChatService;
|