liuyu 4 лет назад
Родитель
Сommit
6e2511ee4d
1 измененных файлов с 13 добавлено и 11 удалено
  1. 13 11
      app/service/room.js

+ 13 - 11
app/service/room.js

@@ -56,18 +56,20 @@ class RoomService extends CrudService {
   async startrecord(data) {
     // 接收录播参数
     const { stream_id } = data;
-    const arr = stream_id.split('_');
-    const id = arr[1];
-    console.log('id--->' + id);
-    const res = await this.model.findById(id);
-    if (res) {
-      res.stream_id = stream_id;
-      res.url = data.video_url;
-      res.file_id = data.file_id;
-      res.ishis = '1';
-      await res.save();
+    console.log('视频回调--->' + data);
+    if (stream_id) {
+      const arr = stream_id.split('_');
+      const id = arr[1];
+      console.log('id--->' + id);
+      const res = await this.model.findById(id);
+      if (res) {
+        res.stream_id = stream_id;
+        res.url = data.video_url;
+        res.file_id = data.file_id;
+        res.ishis = '1';
+        await res.save();
+      }
     }
-    return res;
   }
 
   async updaterequid(id, requestid) {