From 20a8ff5e9860d41fe1ac331d6e1a1ade61006d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Wed, 24 Dec 2025 17:05:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BC=93=E5=AD=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/Room.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/api/model/Room.php b/application/api/model/Room.php index dc3e2066..0938df3f 100644 --- a/application/api/model/Room.php +++ b/application/api/model/Room.php @@ -1061,7 +1061,7 @@ class Room extends Model //各种房间类型的具体信息 在各个类型中获取 把下面有获取房间类型中的状态等信息的信息 放到各自的类型中去 这里只根据类型调用相关的就行 public function join_room($user_id, $room_id, $password) { //房间基础信息先从缓存获取 - $room = Cache::get('room_info_' . $room_id); + $room = json_decode(Cache::get('room_info_' . $room_id)); if(!$room){ $room = db::name('vs_room')->where(['id' => $room_id])->find(); $room['is_use_code'] = 0; @@ -1070,7 +1070,7 @@ class Room extends Model $room['is_use_code'] = 1; $room['room_number'] = $liang; } - Cache::set('room_info_' . $room_id, $room, 7200); + Cache::set('room_info_' . $room_id, json_encode($room), 7200); } if(isset($room['password']) && $user_id != $room['user_id']){ @@ -1081,11 +1081,11 @@ class Room extends Model //房主信息 //先从缓存中获取 - $room_owner = Cache::get('room_owner_' . $room_id); + $room_owner = json_decode(Cache::get('room_owner_' . $room_id)); if(!$room_owner){ $room_owner = db::name('user')->where('id', $room['user_id'])->field('id as user_id,user_code,sex,nickname,avatar')->find(); $room_owner['user_code'] = model('api/Decorate')->user_decorate_detail($room['user_id'],6); - Cache::set('room_owner_' . $room_id, $room_owner, 7200); + Cache::set('room_owner_' . $room_id, json_encode($room_owner), 7200); } $room_type = $this->get_room_type($room_id);