liuyu 4 年之前
父节点
当前提交
2ad82dadfb
共有 3 个文件被更改,包括 12 次插入11 次删除
  1. 4 3
      app/controller/.room.js
  2. 1 1
      app/model/room.js
  3. 7 7
      app/service/room.js

+ 4 - 3
app/controller/.room.js

@@ -1,6 +1,6 @@
 module.exports = {
 module.exports = {
   create: {
   create: {
-    requestBody: ["title","name", "type", "filedir", "url", "anchorid","username","status","content","starttime","endtime","adverts","isadvert","stream_id","ishis","file_id","queid","isque","otheid","shmaiid","zjr","swichzjr"],
+    requestBody: ["title","name", "type", "filedir", "url", "anchorid","username","status","content","starttime","endtime","adverts","isadvert","stream_id","ishis","file_id","queid","isque","otheid","shmaiid","zjr","switchzjr"],
   },
   },
   destroy: {
   destroy: {
     params: ["!id"],
     params: ["!id"],
@@ -8,7 +8,7 @@ module.exports = {
   },
   },
   update: {
   update: {
     params: ["!id"],
     params: ["!id"],
-    requestBody: ["title","name", "type", "filedir", "url", "anchorid","username","status","content","starttime","endtime","adverts","isadvert","stream_id","ishis","file_id","queid","isque","otheid","shmaiid","zjr","swichzjr"],
+    requestBody: ["title","name", "type", "filedir", "url", "anchorid","username","status","content","starttime","endtime","adverts","isadvert","stream_id","ishis","file_id","queid","isque","otheid","shmaiid","zjr","switchzjr"],
   },
   },
   show: {
   show: {
     parameters: {
     parameters: {
@@ -32,7 +32,8 @@ module.exports = {
         ishis: "ishis",
         ishis: "ishis",
         queid: "queid",
         queid: "queid",
         isque: "isque",
         isque: "isque",
-        shmaiid: "shmaiid"
+        shmaiid: "shmaiid",
+        switchzjr: "switchzjr"
       },
       },
     },
     },
     service: "query",
     service: "query",

+ 1 - 1
app/model/room.js

@@ -31,8 +31,8 @@ const RoomSchema = {
   adverts: { type: [ AdvertInfo ], required: false, select: true }, // 广告位
   adverts: { type: [ AdvertInfo ], required: false, select: true }, // 广告位
   queid: { type: String, required: false, maxLength: 200 }, // 问卷id
   queid: { type: String, required: false, maxLength: 200 }, // 问卷id
   isque: { type: String, required: false, maxLength: 64, default: '0' }, // 状态0、无1、有
   isque: { type: String, required: false, maxLength: 64, default: '0' }, // 状态0、无1、有
+  switchzjr: { type: String, required: false, maxLength: 200 }, // 选择主讲人
   zjr: { type: Array, required: false, select: true }, // 主讲人列表
   zjr: { type: Array, required: false, select: true }, // 主讲人列表
-  swichzjr: { type: String, required: false }, // 选择主讲人
 };
 };
 
 
 const schema = new Schema(RoomSchema, { toJSON: { virtuals: true } });
 const schema = new Schema(RoomSchema, { toJSON: { virtuals: true } });

+ 7 - 7
app/service/room.js

@@ -157,10 +157,10 @@ class RoomService extends CrudService {
   }
   }
 
 
   async switchzjr({ id, switchzjr }) {
   async switchzjr({ id, switchzjr }) {
-    const res = await this.model.findById(id);
-    if (res) {
-      res.switchzjr = switchzjr;
-      const result = await res.save();
+    const resmodel = await this.model.findById(id);
+    if (resmodel) {
+      resmodel.switchzjr = switchzjr;
+      const result = await resmodel.save();
       if (result) {
       if (result) {
         const { mq } = this.ctx;
         const { mq } = this.ctx;
         if (mq) {
         if (mq) {
@@ -168,13 +168,13 @@ class RoomService extends CrudService {
           const parm = {
           const parm = {
             durable: true,
             durable: true,
             headers: {
             headers: {
-              userid: res.id,
+              userid: result.id,
             } };
             } };
-          await mq.fanout(exchange, res.id, JSON.stringify(res), parm);
+          await mq.fanout(exchange, result.id, JSON.stringify(result), parm);
         }
         }
       }
       }
     }
     }
-    return res;
+    return resmodel;
   }
   }
 }
 }