getDetail(params: ['room_no' => $params['room_no']],with: ['log']); if (!$room) { return $this->error('直播间异常'); } // 更新发言权 $counter[] = [ 'key' => 'talk_status', 'value' => (string)$room['talk_status'] ]; // 更新直播间右上角头像 $model = new LiveRoomLogLikeModel(); $list = $model->getTopList($room['room_no'], $room['user_id'], 4); $avatar = array_column($list, 'avatar'); $counter[] = [ 'key' => 'top_avatar', 'value' => !empty($avatar) ? implode(',', $avatar) : '' ]; // 更新直播间点赞量 $counter[] = [ 'key' => 'like', 'value' => (string)($room['log']['like'] ?? 0) ]; // 更新直播间ccu数 $im->get_online_member_num($room['room_no']); $online_member = $im->getData()['OnlineMemberNum'] ?? 0; $online_member = $online_member > 0 ? $online_member - 1 : 0; LiveRoomLogModel::query()->where('room_no', $room['room_no'])->where('session', $room['session'])->update(['ccu' => $online_member]); $counter[] = [ 'key' => 'online_member_num', 'value' => (string)$online_member ]; $now = md5(json_encode($counter)); $old = RedisUtil::getInstance(RedisKeyEnum::ROOM_SEND_DATA, $params['room_no'])->get(); if ($now != $old){ // 统一更新群属性 $im->modify_group_attr($room['room_no'], $counter); } RedisUtil::getInstance(RedisKeyEnum::ROOM_SEND_DATA, $params['room_no'])->setex($now,10); return $this->success('执行成功', $im->getData()); } }