|
@@ -40,16 +40,26 @@ class ChatService extends CrudService {
|
|
}
|
|
}
|
|
// 产品
|
|
// 产品
|
|
async goods({ id }, body) {
|
|
async goods({ id }, body) {
|
|
- const apply = await this.model.findOne({ _id: ObjectId(id) });
|
|
|
|
- if (!apply) {
|
|
|
|
- throw new BusinessError('没有查询到该申请用户');
|
|
|
|
|
|
+ // console.log(body);
|
|
|
|
+ const dock = await this.model.findOne({ _id: ObjectId(id) });
|
|
|
|
+ if (!dock) {
|
|
|
|
+ throw new BusinessError('没有查询到该对接会');
|
|
|
|
+ }
|
|
|
|
+ if (body._id) {
|
|
|
|
+ const goods = dock.apply.map(i => i.goodsList).flat().find(function(item) {
|
|
|
|
+ return item.id === body._id;
|
|
|
|
+ });
|
|
|
|
+ if (body.dockStatus) {
|
|
|
|
+ goods.dockStatus = body.dockStatus;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ dock.apply.goodsList.push({
|
|
|
|
+ ...body,
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- apply.goods.push({
|
|
|
|
- ...body,
|
|
|
|
- // apply_time: moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
- });
|
|
|
|
- const res = await apply.save();
|
|
|
|
- const info = _.last(res.goods);
|
|
|
|
|
|
+
|
|
|
|
+ const res = await dock.save();
|
|
|
|
+ const info = _.last(res.apply.goodsList);
|
|
return info;
|
|
return info;
|
|
}
|
|
}
|
|
|
|
|