lrf402788946 4 years ago
parent
commit
3f32cfe39d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/service/liveroom.js

+ 2 - 1
app/service/liveroom.js

@@ -32,9 +32,10 @@ class LiveroomService extends CrudService {
     // 取出已经进入直播的用户列表
     let list = await this.app.redis.get(`liveroom${number}`);
     if (list) {
+      console.log(_.cloneDeep(list));
       // 已经开始直播,并且有人观看
       list = JSON.parse(list);
-      list = JSON.stringify(list.push({ name, userid }));
+      list = JSON.stringify(_.uniqBy(list.push({ name, userid }), 'userid'));
     } else {
       // 还没有人进直播
       list = JSON.stringify([{ name, userid }]);