Browse Source

Merge branch 'master' of http://git.cc-lotus.info/service-platform/service-live

liuyu 5 years ago
parent
commit
b656d13e77
1 changed files with 3 additions and 1 deletions
  1. 3 1
      app/service/personroom.js

+ 3 - 1
app/service/personroom.js

@@ -17,7 +17,9 @@ class PersonroomService extends CrudService {
     assert(seller_id, '缺少卖家信息');
     assert(buyer_name, '缺少买家信息');
     assert(seller_name, '缺少卖家信息');
-    const res = await this.model.create({ buyer_id, seller_id, buyer_name, seller_name });
+    //先查询是否有该房间
+    let res = await this.model.findOne({ buyer_id, seller_id });
+    if(!res) res = await this.model.create({ buyer_id, seller_id, buyer_name, seller_name });
     // TODO MQ
     const { mq } = this.ctx;
     if (mq) {